Skip to content

Database Setup (PostgreSQL & Prisma)

LaunchKit Pro uses PostgreSQL with Prisma for schema management and migrations.

PostgreSQL setup

Create database and app user

Use placeholder values in docs — replace with your own secure password locally (never commit it).

sql
CREATE USER launchkit_user WITH PASSWORD 'replace_with_secure_password';
CREATE DATABASE launchkit_app OWNER launchkit_user;
GRANT ALL PRIVILEGES ON DATABASE launchkit_app TO launchkit_user;

Set DATABASE_URL in backend .env:

env
DATABASE_URL=postgresql://launchkit_user:replace_with_secure_password@127.0.0.1:5432/launchkit_app

Schema ownership and permissions

The app user should own the database (or have sufficient privileges on the public schema). If migrations fail with access denied (P1010), grant schema access:

sql
-- Connect to launchkit_app as superuser, then:
GRANT ALL ON SCHEMA public TO launchkit_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO launchkit_user;

Without these grants, Prisma may not create or alter tables.

pgAdmin connection fields

When connecting in pgAdmin (or any SQL client), each field is separate:

FieldExample placeholderNotes
Host127.0.0.1Server address
Port5432Default PostgreSQL port
Databaselaunchkit_appDatabase name — not your password
Usernamelaunchkit_userPostgreSQL role
Passwordreplace_with_secure_passwordRole password

WARNING

The database name (e.g. launchkit_app) is not the same as the password. Enter username and password in their own fields.


Prisma migration guidance

Buyers and production → migrate deploy

Apply shipped migrations to an empty or existing database:

bash
cd launchkit-pro-backend   # or backend/
npx prisma generate
npx prisma migrate deploy

Use this for: marketplace install, fresh RC test, staging, and production VPS.

Developers changing schema → migrate dev

When you modify prisma/schema.prisma and create new migrations locally:

bash
npx prisma migrate dev

migrate dev may create a temporary shadow database. If it fails with P3014, the DB user cannot create that shadow DB.

Fixes for developers:

  1. Grant CREATEDB to the dev PostgreSQL user, or
  2. Configure shadowDatabaseUrl in Prisma, or
  3. For install/testing only, use migrate deploy on a throwaway database instead

Buyers should not rely on migrate dev — always use migrate deploy.


Prisma commands reference

CommandWhen to use
npx prisma generateAfter install or schema changes
npx prisma migrate deployBuyer install, production, staging
npx prisma migrate devDevelopers creating new migrations locally
npx prisma studioVisual DB browser (local only)
bash
npm run prisma:generate
npm run prisma:migrate:deploy

Prisma Studio

bash
npm run prisma:studio

Opens a local UI (default port 5555) to inspect users, workspaces, plans, and other tables.

WARNING

Do not expose Prisma Studio to the public internet.


Seed and default data

LaunchKit Pro does not ship a mandatory buyer seed script. On startup (when the database is configured):

  • Default billing plans are upserted: lite, pro, enterprise
  • Plan features and limits align with the feature-limits module defaults

You create your first user via register or direct SQL for admin promotion.

Default plans (reference)

CodeNameTypical limits (summary)
liteLaunchKit LiteBaseline features; no API keys/webhooks
proLaunchKit ProFull module set; moderate API key/webhook limits
enterpriseLaunchKit EnterpriseHighest limits; advanced features

Safe production notes

  1. Backups — schedule pg_dump before migrations
  2. Migrations — use prisma migrate deploy, not migrate dev, in production
  3. Credentials — inject DATABASE_URL via environment manager, not git
  4. Least privilege — DB user should not be superuser in production
  5. Connection pooling — consider PgBouncer at scale

First admin user

After registering normally, promote to platform admin:

sql
UPDATE "User" SET role = 'ADMIN' WHERE email = 'your-email@example.com';

See Admin Panel for admin capabilities.


Troubleshooting

IssueHint
Migration failedPostgreSQL running? DATABASE_URL correct?
P1010 access deniedDB user owns DB / schema grants — see above
P3014 shadow databaseUse migrate deploy for install; or grant CREATEDB for migrate dev
Client out of syncRun npx prisma generate

See Troubleshooting and Deployment Gotchas.

LaunchKit Pro by LaunchKit Labs — buyer documentation. No secrets in this site.