This repository contains a FastAPI backend and a React frontend. Both services can be started together using Docker Compose or separately for development.
- Docker and Docker Compose installed (optional for Docker setup).
- Git installed for cloning the repository.
- Python 3.8+ and Node.js installed for running the backend and frontend separately.
To clone the repository and its submodule (task-tracker-frontend), run the following commands:
git clone --recurse-submodules https://github.com/tobslob/task-tracker.git
cd task-trackerIf you have already cloned the repository without the submodule, you can initialize and update the submodule with:
git submodule init
git submodule updateFrom the repository root run:
docker-compose up --buildYou might likely face this sh: react-scripts: command not found after running npm start after build.
Solution
cd task-tracker-frontend
npm install
cd ../ #back to the repository root
docker-compose down
docker-compose upThe backend will be available on http://localhost:8000 and the React frontend on http://localhost:3000.
-
Navigate to the
backenddirectory:cd backend -
Create and activate a Python virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Python dependencies:
pip install -r requirements.txt
-
Seed the database with sample data (required for first-time setup):
python seed_db.py
-
Start the FastAPI server:
uvicorn app.main:app --reload
The backend will be available on http://localhost:8000.
-
Navigate to the
task-tracker-frontenddirectory:cd task-tracker-frontend -
Install Node.js dependencies:
npm install
-
Start the React development server:
npm start
The frontend will be available on http://localhost:3000.
The compose configuration seeds the SQLite database on startup using
seed_db.py so the app loads with sample data. On the first run it also
creates a superuser defined by the environment variables
SUPERUSER_EMAIL, SUPERUSER_PASSWORD and SUPERUSER_NAME (defaults are set
in docker-compose.yml). If the account already exists the seeder will skip it
so you can safely restart the containers.
If you need to allow additional origins for CORS, update the
BACKEND_CORS_ORIGINS variable in docker-compose.yml to a JSON list, for
example:
BACKEND_CORS_ORIGINS: '["http://localhost:3000", "http://localhost:3001"]'