Launch Express supports the following database providers:

PostgreSQL Prisma Schema

Launch Express provides you with a prisma.schema file suitable for PostgreSQL. If you want to use PostgreSQL, you don’t need to make any changes.

To learn more about the Prisma usage with PostgreSQL check the official documentation.

  1. Update your DATABASE_URL in the .env file
.env
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
  1. Generate Prisma Client:
npx prisma generate
  1. Run migrations:
npx prisma migrate dev --name init

Example Usage

To interact with the database, you can use the Prisma Client. The Prisma Client is an auto-generated and type-safe query builder that’s tailored to your database schema.

import prisma from "@/lib/db";

const user = await prisma.user.findUnique({
	where: {
		email: "john.doe@example.com",
	},
});

Database Management

Development Commands

# Create a migration
npx prisma migrate dev --name <migration-name>

# Reset database
npx prisma migrate reset

# View database in Prisma Studio
npx prisma studio

# Format schema
npx prisma format

Production Commands

# Deploy migrations
npx prisma migrate deploy

# Generate client
npx prisma generate

Database Hosting

I recommend using PostgreSQL as the database provider for your application, because it is a powerful, open-source object-relational database system.

You can create a free PostgreSQL database by using Neon, Supabase or go with MongoDB and MongoDB Atlas.

But you can also use other service providers like: