- Change into the backend directory
- Run
npm install
- If changes are made run
npm run build
to build with those changes - To run the backend locally, execute
npm run start
- Change into the frontend directory
- Run
npm install
- To run the frontend locally, execute
npm run dev
We assume that you already have the PostgreSQL server set up. On Windows:
- Make sure PostgreSQL is running
- Add PostgreSQL/{version}/bin to PATH
- Add PostgreSQL/{version}/lib to PATH
- Open Windows PowerShell
- cd into a directory you want the database to export to
- Run the command
pg_dump -U {username} -E=UTF-8 -d PromptLibrary -f {filename}.txt
, replacing {username} and {filename} with your username and filename - Type your password for the server
To load the database from a dump on Windows
- Delete your current database if you have one
- Remake a new one with the name PromptLibrary
- Open Windows PowerShell
- cd into the directory with the db dump
- Run the command "cat dump.txt | psql PromptLibrary postgres"
The project has 3 docker-compose files within the PromptLibrary, Frontend, and Backend directories which can be used to deploy the PropmtLibrary.
In order to run the entire PromptLibrary, a user should run this command while in the PromptLibrary directory: docker compose up -d --build
If the user desires, the same command can be ran within the Frontend or Backend directory in order to build only the frontend or backend respectively.
On the first build of the docker container, the user will also need to run the following:
docker exec -it web npx prisma db push
docker exec -it web npx prisma db seed
This must be done in order to sync the PostgreSQL database with the Prisma file while also seeding the database.
Once deployed, the front end will be visible on localhost:8000 while the backend can be directly accessed within localhost:8080. These ports are determined within the docker-compose.yml files and can be modified if required by the user.