This repo is for a simple scroll timing game. There are three micro services running on docker containers:
Frontend -- React/Typescript/vite
Backend -- Apollo/Graphql/prisma
Database -- Postgres
To get it up and running you must build and run both FE/BE simultaneously
node must be >= 18.15.0 and npm must be >= 9.5.0
-
Clone the repo
git clone https://github.com/bcaliva21/factory_game.git
-
Enter repo
cd factory_game
-
Install Docker
-
Install frontend dependencies
cd frontend && npm i
-
Once dependencies are installed
npm run dev
-
Ensure .env database url points to localhost
postgresql://USER:PASSWORD@localhost:5432/DBNAME?schema=public
-
Install backend dependencies
cd server && npm i
-
Spin up docker database
docker-compose up -d postgres
-
Generate prisma client locally
npx prisma generate
-
Sync prisma client with local schemas
npx prisma migrate dev
-
Start Back-end ```npm run serve``
-
Complete docker migration as described below
-
Navigate to localhost:4173 to view project
-
Make sure the postgres container is running
docker ps
-
Ensure .env database url points to docker postgres
postgresql://USER:PASSWORD@postgres:5432/DBNAME?schema=public
-
Start docker container
docker-compose up --build
-
Open side terminal and execute the following command to enter a bash terminal inside the prisma container
docker exec -it "factory_server" sh
-
Inside the factory_server container run the migration command
npx prisma migrate dev --name migration-name
-
lint repo
npm run lint
-
format repo
npm run prettier-format
-
start a local web server that serves the built solution from ./dist
npm run preview