Backend service for the Amrita ICPC Coding Platform, built with FastAPI and SQLAlchemy.
-
Clone the repository
git clone <repository_url> cd Amrita-ICPC-backend
-
Environment Setup
Create the virtual environment and install dependencies using
uv:uv sync
-
Configuration
Copy the example environment file and configure it:
cp .env.example .env
Update
.envwith your specific configurations if needed. By default, it is configured to work with the provided Docker Compose setup.
-
Start Infrastructure Services
Start PostgreSQL and Redis using Docker Compose:
docker-compose up -d
-
Run the Backend Server
Start the FastAPI application:
uv run -m app.main
The API will be available at
http://localhost:8000. API Documentation (Swagger UI) is available athttp://localhost:8000/docs.
This project uses Alembic for database migrations.
-
Generate a new migration (after modifying models):
uv run alembic revision --autogenerate -m "Description of changes" -
Apply migrations:
uv run alembic upgrade head
To run the unit tests, use the following command:
uv run pytest- Development Mode: In development environment (default), the application automatically checks and creates tables on startup if they don't exist.
- Code Structure:
app/main.py: Application entry point.app/core/: Configuration and core utilities.app/models/: SQLAlchemy database models.app/api/: API route handlers (to be implemented).
Code-like payloads should be stored in MinIO via CodeStorageService.
- Usage guide:
docs/code-storage-service.md - Service implementation:
app/core/storage/code_storage.py