SubTrack is a small full‑stack app: FastAPI backend + React frontend.
- Page “Random Data”: fetch mock/random Users, Companies, Subscriptions, edit, and save to DB
- Page “Data”: view, sort, inline‑edit and delete stored data;
- Docker Compose for one‑command run
- Backend: FastAPI, SQLAlchemy, SQLite
- Frontend: React (React Router)
Prereqs: Docker and Docker Compose
docker compose up --buildServices:
- Backend:
http://localhost:8000 - Frontend:
http://localhost:3000
Environment variables (optional overrides):
- Backend
DATABASE_URL(defaultsqlite:///app.db)RANDOM_DATA_API_BASE(defaulthttps://random-data-api.com/api/v2)
- Frontend
REACT_APP_API_BASE(defaulthttp://localhost:8000)
Create a venv and install deps.
Windows (PowerShell):
cd backend
py -m venv venv
./venv/Scripts/Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txtmacOS/Linux:
cd backend
python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txtRun the API (hot‑reload):
cd backend
uvicorn app.main:app --reloadcd frontend
npm install
npm startIf your backend isn’t on http://localhost:8000, set:
# in frontend/.env
REACT_APP_API_BASE=http://127.0.0.1:8000Random data proxy/save:
GET /random/usersGET /random/companiesGET /random/subscriptions(mocked)POST /random/users/save(maps & saves selected fields)POST /random/companies/save(maps & saves selected fields)POST /random/subscriptions/save(requires at least one user and one company in DB)
CRUD:
- Users:
/users - Companies:
/companies - Subscriptions:
/subscriptions
- User:
first_name,last_name,email,phone_number?,address? - Company:
business_name,industry?,catch_phrase?,buzzword?,address? - Subscription:
plan,status?,payment_method?,term?,user_id?,company_id?
Notes:
user_idandcompany_idon Subscription can be null in responses; create requires valid IDs- Timestamps are added automatically on all models
Python (Black):
python -m black backend/appbackend/
app/
routers/ (users, companies, subscriptions, random)
models/ (User, Company, Subscription)
schemas/ (pydantic models)
database.py, main.py
frontend/
src/ (App, pages, styles)
docker-compose.yml