This repository contains a React frontend and a FastAPI backend. Below are instructions for setting up the development environment using Docker Compose.
- Docker installed on your machine
- Docker Compose installed on your machine
Generate locally-trusted SSL/TLS certificates using mkcert
.
-
Install
mkcert
. -
Create a directory/folder called
certs/
in the project's root. -
Generate certificates
localhost.key
andlocalhost.crt
withincerts/
usingmkcert
.
-
Open a terminal (for Linux/Mac users) or Command Prompt (for Windows users) and navigate to the repository root directory.
-
Build and start the services defined in
docker-compose.yml
:docker-compose up --build
-
Open a terminal (for Linux/Mac users) or Command Prompt (for Windows users) and navigate to the repository root directory.
-
Navigate inside the frontend directory, and run
npm install
.cd frontend/ npm install
-
Once the packages finish installing, run
npm run dev
.npm run dev
After executing these commands, you should be able to access:
- The React frontend at https://127.0.0.1/
- The FastAPI backend at https://127.0.0.1/api
To stop the services, press Ctrl+C
in the terminals where docker-compose up
and React are running.
To view logs for the services, you can run:
docker-compose logs
You can also view logs for individual services:
docker-compose logs frontend
docker-compose logs backend
That's it! You're now up and running with your development environment.
For any change to the schema you should create a database migration using alembic.
Generate a new alembic version:
cd backend
alembic revision -m "{description of revision}"
Your revision will be located within /backend/alembic/versions
Edit the generated revision file with your changes, make sure to specify both upgrade and downgrade function for reverse compatibility.
After making changes to your revision file, apply them using:
alembic upgrade head
If you deleted volumes and recreated the containers, you must point alembic to the latest version. This is because the backend automatically creates the latest schema for you. You can do this by running the following command:
alembic stamp head