Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/whitiue/logiMathApp/llms.txt

Use this file to discover all available pages before exploring further.

LogiMath is structured as a three-tier application where each layer has a clearly defined responsibility. The FastAPI backend exposes a REST API, the Flet frontend consumes it through a Python desktop client, and PostgreSQL persists all data. Docker Compose ties the services together on a shared bridge network, making the full stack reproducible in a single command.

System layers

Backend

FastAPI application serving a REST API on port 8000. Handles all business logic, database access via SQLAlchemy, and schema validation with Pydantic.

Frontend

Flet Python desktop application running at 400×750 px. Communicates with the backend through api_services.py and navigates between three views.

Database

PostgreSQL 16 (Alpine) instance persisting data across four tables: users, quizzes, questions, and user_scores.

Network and ports

All services communicate over logmath_network, a Docker bridge network defined in docker-compose.yml. No service is exposed to the host except the backend API.
ServiceInternal portHost portNotes
backend80008000FastAPI / uvicorn
postgres5432Not published to host

Docker Compose orchestration

The docker-compose.yml at the repository root defines both services, their health checks, resource limits, and shared network. The postgres service must pass its health check before backend starts, enforced with depends_on: condition: service_healthy.
docker-compose.yml
version: '3.8'

services:
  postgres:
    image: postgres:16-alpine
    container_name: logmath_db
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./docker/init.sql:/docker-entrypoint-initdb.d/01-init.sql
    networks:
      - logmath_network
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

  backend:
    build:
      context: ./
      dockerfile: ./src/BackEnd/Dockerfile
    container_name: logmath_backend
    ports:
      - "8000:8000"
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      - DATABASE_URL=${DATABASE_URL}
      - API_HOST=${API_HOST}
      - API_PORT=${API_PORT}
    networks:
      - logmath_network
    restart: unless-stopped

networks:
  logmath_network:
    driver: bridge

volumes:
  postgres_data:
    driver: local
The backend service will not start until the postgres health check passes. This prevents startup errors caused by the database not yet accepting connections.

Starting the stack

docker compose up --build
After startup, the backend API is reachable at http://localhost:8000 and interactive API docs at http://localhost:8000/docs.

Build docs developers (and LLMs) love