Backend service for the DIY Project platform. Provides an API that interacts with OpenAI to fetch DIY project details and suggestions.
- Navigate to the server directory:
cd server
- Install the dependencies:
npm install
- Set up your environment variables:
Copy the
.env.example
file and create a new.env
file with your own settings.
For development:
npm run watch:dev
For production:
npm run start
This project uses Prisma as an ORM to interact with the database. Follow these steps to set up and seed the database:
-
Ensure you have PostgreSQL installed and running on your system.
-
Apply database migrations to create the schema:
npx prisma migrate dev --name init
2.1. If there's already a migration file use this to sync:
npx prisma db push
- If seed doesn't automatically run, it will seed the database with initial data
npx prisma db seed
# or
npx prisma migrate reset
- Deploy in the production
npx prisma migrate dev --create-only
npx prisma migrate deploy
This sets up the database schema and populates it with initial data, allowing your server to interact with the database using Prisma.