Skip to main content

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

  1. Clone the repository:
git clone https://github.com/Glimpse-Analytics/tracker-graphql-2.git
cd tracker-graphql-2
  1. Install Python dependencies:
pip install -r requirements.txt
  1. 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.

  1. Initialize the database:
python manage.py db upgrade

Running the Backend Server

  1. Start the cache server (either Redis or Dragonfly):
# For Redis
redis-server

# Or for Dragonfly
dragonfly-server
  1. Start the development server:
python -m uvicorn app.main:app --reload
  1. The GraphQL playground will be available at:
http://localhost:8000/graphql

Frontend Development (Optional)

If you want to develop or modify the React frontend:

  1. Navigate to the React project directory:
cd app/static/react
  1. Install Node.js dependencies:
npm install
  1. 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:

  1. Build the containers:
docker compose build
  1. Start the services:
docker compose up

Next Steps