Next.js provider
The nextjs provider targets Next.js 16 with the App Router. It is the richest Codabra target: models, API routes, functions, events, voters and views are all rendered, with Drizzle or Prisma persistence.
Generated file mapping
| Configuration | Generated output |
|---|---|
models/User.json | src/types/User.ts and the ORM schema |
routes/Users.json → GET /api/users | src/app/api/users/route.ts |
routes/Users.json → GET /api/users/:id | src/app/api/users/[id]/route.ts |
views/LoginPage.json → /login | src/app/login/page.tsx |
functions/CreateUser.json | src/lib/functions/CreateUser.ts |
voters/ArticleVoter.json | src/lib/voters/ArticleVoter.ts |
Dynamic App Router parameters are generated using the asynchronous Next.js 16 contract: route handlers await params before reading an identifier.
Persistence
Choose the ORM and database independently in codabra.json:
{
"providers": [
{
"provider": "nextjs",
"orm": "drizzle",
"database": "postgresql"
}
]
}Supported combinations are:
| ORM | SQLite | PostgreSQL | MySQL |
|---|---|---|---|
| Drizzle | yes | yes | yes |
| Prisma | yes | yes | yes |
For Drizzle, Codabra generates src/drizzle/schema.ts and src/lib/db.ts. For Prisma, it generates prisma/schema.prisma and src/lib/prisma.ts.
Then apply the schema through the provider-aware CLI:
codabra db push --provider nextjsSet DATABASE_URL in apps/nextjs/.env.local when the selected database needs a connection string. Projects created before the multi-provider layout may keep using apps/web; Codabra still detects that legacy directory.
Development and build
codabra dev --provider nextjs
codabra build --provider nextjsThe default development port is 3000. Override it with --port.
