Schema Generator API
Generate selective migrations, Drizzle schemas, and focused development seeds for PostgreSQL or SQLite/D1.
The public storage artifact generator is available at:
https://effect-auth.itsbroly.com/api/generator/v1It is a stateless, deterministic Cloudflare Worker API for the interactive builder, automation, and coding agents. It emits fresh-install PostgreSQL or SQLite migration SQL, matching Drizzle declarations, and development-only seed launchers. Select sqlite for Cloudflare D1 artifacts.
The generated migration and Drizzle schema cover every catalog feature and table. They are DDL/catalog output, not a claim that a first-party runtime adapter implements every selected domain port.
Compose the schema you actually need
Choose a database, select auth capabilities, and inspect the exact fresh-install artifacts returned by the public Worker API.
Generate PostgreSQL SQL and typed pgTable declarations. Runtime support is provided by focused direct Drizzle stores, not by the generated DDL catalog.
Runtime support boundary
First-party durable direct Drizzle support covers all 42 ports tracked in the project plan across SQLite, D1, and PostgreSQL. The complete account/password slice has focused Bun, Node, and PostgreSQL compositions. Individual focused stores cover the current OAuth, token, passkey, login-security, MFA, audit-log, domain-verification, security-timeline, permission, invitation, and access-grant ports.
Other domain features and their migrations remain usable. Applications must provide their own implementations of the required public store ports until focused direct adapters land. Do not interpret generated tables as runtime parity, and do not use memory storage for production durability.
Agent workflow
- Read
GET /api/generator/v1/catalogand select a supporteddatabaseand feature IDs. - Request
migration-sql; requestdrizzle-schemaas well when the application needs typed table declarations. - Request a development seed only from
developmentSeedTargetsByDatabase. Seeds use focused account compositions and are available for D1 through Alchemy, Bun SQLite, Node SQLite, and PostgreSQL. - Write every returned
files[].pathwith the exactfiles[].content. - Report
resolved.impliedModulesand recordgeneratorVersion,schemaVersion, andfingerprint. - Never apply a fresh baseline to an existing database. Use reviewed upgrade migrations for an existing schema ledger.
The complete machine-readable contract is available at GET /api/generator/v1/openapi.json.
Generate artifacts
curl "https://effect-auth.itsbroly.com/api/generator/v1/artifacts/migration-sql?database=postgres&features=password,totp&layout=module"curl "https://effect-auth.itsbroly.com/api/generator/v1/artifacts/migration-sql?database=sqlite&features=password,totp&layout=module"curl "https://effect-auth.itsbroly.com/api/generator/v1/artifacts/drizzle-schema?database=postgres&features=password,totp&layout=table&includeRelations=true"Migration layouts are single and module. Drizzle layouts are single, module, and table. Logical Drizzle relations do not create foreign keys; database constraints and indexes come from migration SQL.
Generate a bundle
curl https://effect-auth.itsbroly.com/api/generator/v1/generate \
--header "Content-Type: application/json" \
--data '{
"database": "postgres",
"mode": "fresh",
"features": ["password", "totp"],
"outputs": [
{ "kind": "migration-sql", "layout": "single" },
{ "kind": "drizzle-schema", "layout": "table", "includeRelations": true },
{ "kind": "development-seed", "target": "postgres", "complexity": "medium" }
]
}'The fingerprint is a deterministic change marker, not a cryptographic integrity signature. Cacheable GET responses use a separate SHA-256 HTTP ETag.
Development seed
The seed creates the same 100 userN@example.test identities and adds password credentials only when password is selected. It is idempotent within its owned namespace. There is no count parameter or Faker dependency.
| Database | Supported targets |
|---|---|
| SQLite | bun-sqlite, node-sqlite |
| PostgreSQL | postgres |
| D1 | alchemy-d1 |
The default medium output exports AppDevelopmentSeedLive and runDevelopmentSeed; low adds top-level execution. Standalone scripts require EFFECT_AUTH_DEVELOPMENT_SEED=true and refuse NODE_ENV=production.
Development only
The credentials are deliberately public and memorable. Never invoke the seed against production data or expose it through an HTTP route.
Fresh installs only
Version 1 supports only mode: "fresh". It renders the current final schema and does not replay historical transformations. Never use that output to upgrade an existing database.
Errors
Validation failures use a stable JSON shape:
{
"error": {
"code": "UNKNOWN_FEATURE",
"path": "features[0]",
"message": "Unsupported storage feature ...",
"suggestions": ["password", "totp"]
}
}The API accepts CORS requests because it processes only bounded declarative configuration and never accepts source code, SQL, credentials, or database connections.