Introduction
Backend-first questionnaire infrastructure for TypeScript servers and React clients.
dimah-form is backend-first questionnaire infrastructure for product-embedded forms. It owns the typed protocol, per-response definition snapshots, drafts, and submit validation. Your application owns authentication and rendering and supplies the persistence adapter.
Use it when a questionnaire belongs inside your product and must keep its original definition after the live form changes. It is not a visual builder, hosted survey service, authentication system, or analytics warehouse.
Start here: complete Quickstart, then prepare for production with Integration, Security, and Persistence. Use Forms and Responses for the data model.
The model
- AuthorDefine or save a form
- StartFreeze the definition
- FillDraft and validate
- SubmitValidate the snapshot
When a response starts, the server stores a copy of the active form in
response.definition. Later edits to the live questionnaire do not affect
that draft or submitted response.
What you install
| Need | Package |
|---|---|
| Server instance, handler, and adapters | @dimah-form/server |
| React client and fill session | @dimah-form/react |
| Production SQL adapter | @dimah-form/db |
| Optional shadcn renderer | @dimah-form/ui |
| Optional scoring, export, and summaries | @dimah-form/scoring, @dimah-form/dataset, @dimah-form/insights |
database is required on dimahForm(). SQL is optional: use
memoryAdapter() for tests and local development, or a persistent
ResponseStore such as db() from @dimah-form/db in production.
Choose the right tool
Quickstart
Build and mount a working Next.js form.
Comparison
Compare the model with form libraries, builders, and SaaS.
Forms
Define a questionnaire and infer answer types.
Responses
Understand snapshots, drafts, and concurrency.
Example app
See scoring, custom fields, SQL, and exports together.
For coding agents, fetch llms.txt for the decision sheet or llms-full.txt for the complete Markdown corpus.