Installation
Add ContractSpec to your existing Next.js or Bun project, or start fresh.
Prerequisites
Node.js 20+ (or Bun 1.0+)
Existing Next.js app or Bun HTTP server
PostgreSQL database (for persistence)
Install Core Libraries
Add the contracts runtime and your choice of adapter:
bun add @lssm-tech/lib.contracts-spec @lssm-tech/lib.schemaFor Next.js projects
bun add @lssm-tech/lib.contracts-specFor database models
bun add @lssm-tech/app.cli-database prisma @prisma/clientSet up your project
Initialize a new ContractSpec project structure:
bash
bunx contractspec init
# Follow the interactive prompts to configure your projectInitialize the database
If using Prisma, set up your schema and generate the client:
bash
bunx prisma init
# Edit prisma/schema.prisma with your models
bunx prisma generate
bunx prisma migrate dev --name init