Database Setup
Open Sky Commerce uses PostgreSQL as its database, accessed through Prisma ORM. The schema is fully defined in prisma/schema.prisma and managed through Prisma migrations.
1. Create a PostgreSQL Database
You can use a local PostgreSQL instance, a managed database (DigitalOcean Managed Databases, Supabase, Neon, Railway), or any PostgreSQL-compatible service.
# Example: create a local database
createdb openskycommerce2. Set the Connection String
Add your connection string to .env:
DATABASE_URL="postgresql://username:password@localhost:5432/openskycommerce"For a managed database with SSL:
DATABASE_URL="postgresql://username:password@host:25060/openskycommerce?sslmode=require"3. Run Migrations
npx prisma migrate dev --name initThis applies all migrations in prisma/migrations/ and creates the full schema in your database.
4. Generate the Prisma Client
npx prisma generateThis is also run automatically as part of npm run build.
5. Seed Demo Data (Optional)
npm run import-demo-dataThis script reads JSON files from seed-data/ and populates the database with sample products, categories, blog posts, users, and settings — useful for evaluating the platform before entering your own data.
Prisma Studio
You can browse and edit your database records directly using Prisma Studio:
npx prisma studioKey Models
Product/ProductVariant— product catalog with variantsCategory— hierarchical product categoriesOrder— customer orders with line itemsUser— customer and admin accountsPaymentSettings— singleton row holding all payment processor keysSeoSetting— site-wide SEO and homepage variant configurationBusinessInfo— company name, address, phone, emailPost/PostAuthor/PostCategory— blog systemHeroBanner/HeroSlider— homepage hero configurationCoupon— discount codesReview— product reviews