Running the Tracker System
This guide explains how to run the Tracker System, including both the API and Admin Panel, in various environments.
Running in Production
Production is deployed through Terraform into AWS ECS, not via Docker Compose.
Running in Development
For development, you can use the development services provided by Docker Compose, or run the services locally.
Using Docker Compose for Development
docker compose up
# Check the status of the services
docker compose ps
# View logs
docker compose logs -f
This will start the following services:
- API (development mode): http://localhost:8100
- Admin Panel (development mode): http://localhost:3000
- PostgreSQL: localhost:5432
- Dragonfly (Redis): localhost:6379
The development services include:
- Live code reloading for both the API and Admin Panel
- Debugging support for the API
- Development tools and utilities
Running Locally
You can also run the API and Admin Panel locally for development.
Running the API Locally
# Activate the virtual environment
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Run the API with live reloading
uvicorn app.main:app --reload --port 8000
The API will be available at http://localhost:8000.
Running the Admin Panel Locally
# Navigate to the admin panel directory
cd tracker-admin
# Install dependencies (if not already installed)
npm install
# Run the development server
npm run dev
The Admin Panel will be available at http://localhost:3000.
Debugging
Debugging the API
The API includes support for remote debugging with VSCode. To debug the API:
- Start the development service:
docker compose up
- Attach the VSCode debugger:
- Open the project in VSCode
- Go to the "Run and Debug" view (Ctrl+Shift+D or Cmd+Shift+D on macOS)
- Select "Python: Remote Attach" from the dropdown menu
- Click the green play button or press F5
VSCode will attach to the running container, and the application will start. You can now set breakpoints in your code and debug as usual.
Debugging the Admin Panel
The Admin Panel includes support for debugging with browser developer tools:
- Start the development service:
docker compose up
- Open the Admin Panel in your browser:
- Navigate to http://localhost:3000
- Open the browser developer tools (F12 or Ctrl+Shift+I or Cmd+Option+I on macOS)
- Go to the "Sources" tab
- Set breakpoints in your code
You can also use the React Developer Tools extension for Chrome or Firefox to inspect and debug React components.
Monitoring
Monitoring the API
The API includes a performance monitoring middleware that logs request times and other metrics. You can view these logs using:
docker compose logs -f api
Monitoring the Admin Panel
The Admin Panel includes React Query DevTools for monitoring API requests and cache state. To enable the DevTools:
- Open the Admin Panel in your browser
- Press Ctrl+Shift+Q or Cmd+Shift+Q on macOS to toggle the DevTools
Common Issues
API Not Starting
If the API fails to start, check the logs for errors. Use dev for the local development stack:
docker compose logs dev
Common issues include:
- Database connection errors
- Missing environment variables
- Port conflicts
Admin Panel Not Starting
If the Admin Panel fails to start, check the logs for errors. Use admin-dev for the local development stack:
docker compose logs admin-dev
Common issues include:
- Node.js version incompatibility
- Missing dependencies
- Port conflicts
CORS Errors
If you encounter CORS errors when the Admin Panel tries to connect to the API, check that:
- The API is configured to allow requests from the Admin Panel's origin
- The Admin Panel is using the correct API URL
See the CORS Error Handling guide for more information.
Performance Tuning
API Performance
To improve API performance:
- Enable Redis caching by setting the
REDIS_CACHE_TTLenvironment variable - Increase the number of workers by setting the
WORKERS_PER_COREenvironment variable - Use connection pooling for database connections
Admin Panel Performance
To improve Admin Panel performance:
- Enable production mode by setting the
NODE_ENVenvironment variable toproduction - Use code splitting to reduce bundle size
- Implement caching strategies for API responses
VSCodium Test Setup
If you want VSCodium to run unit tests against a local Python environment, use the project's
local virtual environment and the existing Docker Compose services for the database and cache.
The editor should use venv/bin/python, which points at the same environment as .venv.
1. Create the local Python environment
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
ln -s .venv venv
2. Start the supporting services
docker compose up -d db dragonfly
3. Configure VSCodium
- Select
venv/bin/pythonas the interpreter - Enable pytest discovery
- Point coverage tools at the generated
coverage.xml - If VS Code keeps using another project's interpreter, see VS Code Python Interpreter Reset
4. Run tests
pytest tests/ --cov=app --cov-report=xml -v
5. Optional coverage HTML
pytest tests/ --cov=app --cov-report=html -v
open htmlcov/index.html
Testing Approach
The project favors behavioral tests:
- Organize tests around user workflows and business scenarios
- Keep small unit tests for simple utilities and configuration
- Use integration tests for cross-feature workflows
- Track coverage, but do not test only by file structure
When writing tests, mock external dependencies but prefer real application code, database interactions, and service logic. Over-mocking our own code makes tests pass without validating real behavior.