- Clone the repository:
git clone https://github.com/MoeeinAali-Teachings/Prisma-Postgresql.git
cd prisma-postgresql- Create a
.envfile in the root directory:
DATABASE_URL="postgresql://postgres:postgres@db:5432/department_db"
PORT="3000"- Start the application using Docker Compose:
sudo docker-compose up --build -dThe API will be available at http://localhost:3000
- Install dependencies:
npm install- Create a
.envfile with your database connection string:
DATABASE_URL="postgresql://username:password@localhost:5432/department_db"
PORT="3000"- Run database migrations:
npx prisma migrate dev- Start the development server:
npm run devTo make changes to the database schema:
- Modify the schema in
prisma/schema.prisma - Generate a new migration:
npx prisma migrate dev --name <migration-name>