AI Startup Analyzer uses Prisma 6 as its ORM and Neon PostgreSQL as the recommended managed database provider, though any standard PostgreSQL instance works equally well. The schema defines three models —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Abbaddii-99/AI-Startup-Analyzer/llms.txt
Use this file to discover all available pages before exploring further.
User, RefreshToken, and Analysis — and the Analysis model stores the outputs of more than a dozen AI agents as JSON strings alongside a set of numeric scores that power the startup evaluation dashboard. This page walks through configuring your connection strings, understanding the schema, and running migrations safely across development, staging, and production environments.
Connection Strings
Prisma requires two separate PostgreSQL connection strings when using a connection pooler (such as Neon’s built-in PgBouncer):| Variable | Purpose |
|---|---|
DATABASE_URL | Pooled connection string — used by the running application for all queries at runtime. Routes through PgBouncer to keep connection counts low. |
DIRECT_DATABASE_URL | Direct connection string — used by Prisma Migrate and the Prisma schema engine. Must bypass the pooler because migrations require session-level features that PgBouncer does not support. |
.env file (development) and as environment variables on your server or container (production). The .env.example file in the repository root shows the expected format:
In the Neon dashboard, the pooled connection string contains
-pooler in the hostname. The direct string points to the endpoint without -pooler. Copy both strings from the Connection Details panel of your Neon project and paste them into your environment file.Prisma Schema
The schema lives atpackages/db/prisma/schema.prisma and defines three models. Below is an annotated overview of each.
User
Stores authenticated users, their subscription plan, and Stripe billing identifiers. Each user can own manyAnalysis records and many RefreshToken records.
RefreshToken
Stores JWT refresh tokens linked to users. Tokens are deleted automatically when the parent user is deleted (onDelete: Cascade). An index on userId keeps token lookup fast.
Analysis
The central model of the application. Each row represents one startup analysis job, starting inPENDING status and progressing through the agent pipeline.
The
status field follows this lifecycle: PENDING → PROCESSING → COMPLETED or FAILED. A job enters PROCESSING when BullMQ picks it up from the queue. If any agent step throws an unrecoverable error the row is marked FAILED and the error is surfaced to the frontend. Indexes on status and isPublic keep filtered list queries efficient as the table grows.ideaAnalysis, marketResearch, competitorAnalysis, mvpPlan, monetization, goToMarket, finalReport, riskRadar, roadmap, businessModel, visionMission, brandIdentity, budgetEstimate) are stored as serialised JSON strings. Each field is populated by a dedicated AI agent that runs as part of the BullMQ analysis pipeline.
The five score fields (marketDemandScore, competitionScore, executionDifficultyScore, profitPotentialScore, overallScore) are Float values between 0 and 100, derived from the agent results and written to the row once the pipeline completes.
Migration Commands
All database commands are defined at the monorepo root and delegate to Prisma CLI viapnpm.
Command Reference
| Command | When to use |
|---|---|
pnpm db:generate | After any change to schema.prisma to regenerate the type-safe Prisma Client. Run this before building the backend. |
pnpm db:migrate:dev --name <change> | During development to create a new SQL migration file in packages/db/prisma/migrations/ and apply it to your local database. The --name flag sets the human-readable suffix on the migration folder. |
pnpm db:migrate:deploy | In CI, in the production container startup script, or when manually promoting migrations to a staging or production database. This command applies all pending committed migrations without creating new ones. |
pnpm db:studio | To browse and edit database records through a local GUI at http://localhost:5555. Useful for inspecting analysis jobs during development. |
Automatic Migrations in Production
When using the Docker production stack, the backend container runsprisma migrate deploy automatically as part of its startup command before the NestJS server process begins. This means migrations are applied on every container start, including rolling deployments and container restarts. You do not need to run migrations manually against your production database as long as DIRECT_DATABASE_URL is correctly set in the backend container environment. See the Docker deployment guide for details.