A serverless application that tracks and displays New York Times Crossword puzzle completion times, built with Python, FastAPI, and AWS Serverless technologies.
This application fetches user statistics from the New York Times Crossword API, stores the data in DynamoDB, and provides API endpoints to retrieve daily leaderboards.
- AWS Serverless Architecture: Lambda, DynamoDB, API Gateway
- FastAPI: Web framework with automatic OpenAPI documentation
- Mangum: AWS Lambda integration for FastAPI
- Python 3.12: Runtime environment
- Docker: Containerized deployment
- Single-table design with a Global Secondary Index for efficient date-based leaderboard queries
- Stores user metadata and daily puzzle scores
- API Function: Serves leaderboard data via FastAPI endpoints
- Update Function: Fetches user data from NYT's API and updates the database
- Python 3.12
- uv for dependency management
- AWS SAM CLI
- Docker
-
Install development dependencies:
uv sync --dev
-
Run the API locally:
uv run fastapi dev src/app/entrypoints/asgi.py
uv run ruff check --fix
uv run ruff formatuv run pytestThe application is deployed using AWS SAM.
sam build
sam deployIf you don't have a samconfig.toml file yet, run the guided deploy command for initial setup:
sam deploy --guidedAPP_ENVIRONMENT: Environment name (e.g., 'Dev', 'Prod')DYNAMODB_TABLE_NAME: DynamoDB table nameDYNAMODB_GSI_NAME: Name of the Global Secondary IndexDEFAULT_LEADERBOARD_LIMIT: Maximum leaderboard entries to return
GET /health
GET /api/leaderboard/{date}?limit=100
date: Date in YYYY-MM-DD formatlimit: Maximum number of entries to return (1-500, default: 100)