Database
Raw Beats uses PostgreSQL with Prisma. The canonical schema for the API lives in api/prisma/schema.prisma; a root prisma/ folder also exists for legacy scripts.
Prisma
- ORM:
@prisma/clientin the Express API directUrlconfigured for Neon (migrations vs pooled runtime URL)- Migrations under
api/prisma/migrations/
Core models
- User — accounts, roles, producer profiles, avatars
- Beat — title, slug, BPM, genre, audio/cover URLs, publish state
- License — pricing tiers per beat (basic, premium, exclusive)
- Purchase — completed transactions and download access
- Message — direct messages between users
- Comment — beat comments
- Favorite — saved beats
- SystemSettings — platform-wide configuration
Environment
| Variable | Use |
|---|---|
DATABASE_URL | Pooled connection (runtime) |
DATABASE_URL_UNPOOLED | Direct connection (migrations) |
Commands
cd api && npx prisma db push # Apply schema to Neon/local
cd api && npx prisma studio # Browse data
npm run db:generate # Generate client (root prisma) Database migration from Railway to Neon is documented in Deployment and root DEPLOY.md.