npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dmc--98/dfe-prisma

v0.1.3

Published

Prisma database adapter for Dynamic Form Engine

Downloads

512

Readme

@dmc--98/dfe-prisma

Prisma ORM adapter for the Dynamic Form Engine.

Install

npm install @dmc--98/dfe-prisma @dmc--98/dfe-server @prisma/client
npm install -D prisma

Recommended Migration Flow

Use the adapter-aware CLI first, then hand off to Prisma's normal migration command:

npx dfe migrate plan --adapter prisma
npx dfe migrate generate --adapter prisma
npx prisma migrate dev --schema prisma/schema.prisma --name add_dfe_tables
npx dfe migrate doctor --adapter prisma --database-url "$DATABASE_URL"

What each step does:

  • plan inspects the project and tells you whether DFE models are already wired into prisma/schema.prisma.
  • generate scaffolds prisma/dfe-schema.prisma when the DFE models are not merged yet.
  • prisma migrate dev remains the source of truth for creating or applying the actual migration.
  • doctor verifies local project wiring and, when DATABASE_URL is provided, checks the live PostgreSQL tables and columns too.

If generate creates prisma/dfe-schema.prisma, merge that fragment into your main prisma/schema.prisma before running Prisma migrations.

Lower-Level Schema Options

Option A: scaffold the fragment directly:

npx dfe add prisma-schema

Option B: copy from the package:

cat node_modules/@dmc--98/dfe-prisma/schema/schema.prisma >> prisma/schema.prisma

Tables Created

| Table | Purpose | |-------|---------| | dfe_forms | Form definitions (slug, title, description) | | dfe_form_versions | Versioned form configs (draft/published/archived) | | dfe_steps | Step definitions with config (API contracts, review) | | dfe_fields | Field definitions (type, config, conditions) | | dfe_field_options | Dynamic SELECT options | | dfe_submissions | Form submission state (progress, context) |

Usage

import { PrismaClient } from '@prisma/client'
import { PrismaDatabaseAdapter } from '@dmc--98/dfe-prisma'

const prisma = new PrismaClient()
const db = new PrismaDatabaseAdapter(prisma)

Custom API Contract Execution

By default, API contracts use an in-memory store. For production, provide your own:

const db = new PrismaDatabaseAdapter(prisma, {
  executeApiContract: async (contract, body) => {
    switch (contract.resourceName) {
      case 'Employee':
        return prisma.employee.create({ data: body as any })
      case 'Assignment':
        return prisma.assignment.create({ data: body as any })
      default:
        throw new Error(`Unknown resource: ${contract.resourceName}`)
    }
  },
})

This maps the logical resourceName in the API contract to your actual Prisma models.


Links