Database
The project uses Prisma as the database ORM and PostgreSQL as the database.
Database URL
I recommend using Neon for your database hosting who provides a free tier for development. Wathever you can use any other provider or host your database on your own server, for example via Docker.
You need to set the DATABASE_URL
environment variable in your .env
file.
DATABASE_URL=postgresql://user:password@localhost:5432/database
Local PostgreSQL with Docker
The project includes a Docker Compose configuration for running PostgreSQL locally. You can start the database using:
docker-compose up -d postgres
This will start a PostgreSQL container with the following configuration:
- Database name:
nuxt_saas
- Username:
postgres
- Password:
postgres
- Port:
5432
Then, set the DATABASE_URL
in your .env
file as follows:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/nuxt_saas
Push the schema to the database
After setting the DATABASE_URL
environment variable, you can push the schema to the database by running the following command:
pnpm run prisma:push
This command will create the tables in the database based on the schema defined in the prisma/schema.prisma
file.