Installation
This guide will help you get started with the Tracker GraphQL API.
Prerequisites
Core Requirements
- Python 3.8 or later
- PostgreSQL database with PostGIS extension
- Redis server or Dragonfly (Redis-compatible server used in development)
Frontend Development (Optional)
- Node.js 16 or later (only needed if developing the React frontend)
Cache Server
You can use either:
- Redis server (production recommended)
- Dragonfly server (development alternative, Redis-compatible)
Environment Setup
- Clone the repository:
git clone https://github.com/Glimpse-Analytics/tracker-graphql-2.git
cd tracker-graphql-2
- Install Python dependencies:
pip install -r requirements.txt
- Set up environment variables:
cp .env.example .env
Edit .env with your configuration:
DATABASE_URL=postgresql://user:password@localhost:5432/tracker
# Use either Redis or Dragonfly URL
REDIS_URL=redis://localhost:6379
# or
REDIS_URL=redis://localhost:6380 # Default Dragonfly port
JWT_SECRET=your-secret-key
Note: Dragonfly is a Redis-compatible server that can be used as a lightweight alternative during development.
- Initialize the database:
python manage.py db upgrade
Running the Backend Server
- Start the cache server (either Redis or Dragonfly):
# For Redis
redis-server
# Or for Dragonfly
dragonfly-server
- Start the development server:
python -m uvicorn app.main:app --reload
- The GraphQL playground will be available at:
http://localhost:8000/graphql
Frontend Development (Optional)
If you want to develop or modify the React frontend:
- Navigate to the React project directory:
cd app/static/react
- Install Node.js dependencies:
npm install
- Start the frontend development server:
npm run dev
The frontend will be available at http://localhost:3000
Note: The frontend runs on port 3000 by default, which matches the CORS settings in the backend configuration.
Docker Setup
Alternatively, you can use Docker:
- Build the containers:
docker compose build
- Start the services:
docker compose up
Next Steps
- Learn about Authentication
- Configure your Environment
- Explore the API Reference