This file provides guidance to AI agents when working with code in this repository.
# Start development environment (with live logs)
make dev
# Start services in background
make up
# Stop services
make down
# View logs
make logs
# Check container status
make status
# Open shell in API container
make shell
# Build images
make build# Run all checks (lint, format, typecheck, tests)
make check
# Run specific test file
uv run pytest tests/test_filename.py -v
# Install dependencies for testing
uv sync# Install pre-commit hooks
uv run pre-commit install
# Run all checks (lint, format, typecheck, tests)
make check
# Run all pre-commit hooks manually
uv run pre-commit run --all-files# Deploy to production
make deploy
# Health check
make health-check
# Rollback to previous version
make rollback- Flask API Backend: Main application in
main.pywith modular blueprint architecture - React Frontend: Located in
web/directory with separate build process - Discord Bots: Two separate bot instances (summarizer and auth) running in dedicated threads
- Multi-Organization Support: Organization-scoped data and configurations
- Containerized Deployment: Docker/Podman with docker-compose for orchestration
All core functionality is organized in /modules/ with consistent structure:
api.py- REST endpoints and route handlersmodels.py- SQLAlchemy database modelsREADME.md- Module documentation
Active modules: auth, bot, calendar, merch, organizations, points, public, superadmin, users, utils
- SQLite database (
./data/user.db) with SQLAlchemy ORM - Base model class in
modules/utils/base.py - Centralized connection management via
DBConnectclass - Automatic table creation on startup
- Auth Bot: BotFork instance with HelperCog and GameCog for server management
- Bot runs in separate asyncio event loop in daemon thread
- Bot token managed via environment variable (
BOT_TOKEN)
- Calendar Sync Service: Syncs Notion data to Google Calendar (runs every 120 minutes)
- Token Cleanup: Automatic cleanup of expired refresh tokens (runs hourly)
- Multi-org Calendar Service: Handles calendar operations across organizations
- Environment variables via
.envfile (not tracked in git) Configclass inmodules/utils/config.pycentralizes configuration- Organization-specific configs stored in database
- Sentry integration for error monitoring
- React app in
/web/directory with separate package.json - Built files served from
/web/build/ - CORS configured for local development and production domains
- API communication via axios with organization headers
- Copy
.env.templateto.envand configure before running - Requires Discord bot token, Google API credentials, Notion API key
- Database file created automatically in
./data/directory
- uv manages Python dependencies and virtual environment
- GitHub Actions runs tests automatically on push/PR
- API container exposes port 8000
- Web container exposes port 5000
- Shared data volume for persistence
- Health checks configured for both services
- Buildkit enabled for optimized builds
- Stay away from vanilla
print()statements. There's a shared logging module. Use that instead.
- ruff: Fast Python linter and formatter (configured in pyproject.toml)
- Line length: 120
- Auto-formats code and checks style
- ty: Rust-based type checker for Python
- Configured via
.pre-commit-config.yaml - Runs
make check(lint, format, typecheck, tests) automatically on commits - Install with
uv run pre-commit install - All checks also run in CI on every push/PR