Skip to content

Latest commit

 

History

History
111 lines (83 loc) · 2.8 KB

File metadata and controls

111 lines (83 loc) · 2.8 KB

Task Tracker API — Module 1 Skeleton

A minimal Python/FastAPI REST API skeleton for the Module 1 Task Tracker learning project. This first pass exposes only a /health endpoint, organized into a layered structure (routes / core / models / storage) so features can be added cleanly later. CRUD, storage implementation, authentication, and a frontend are intentionally out of scope for now.

Requirements

  • Python 3.10 or newer
  • pip

Project structure

task-tracker-api/
├── app/
│   ├── __init__.py
│   ├── main.py               # App instance + router registration
│   ├── api/
│   │   ├── __init__.py
│   │   └── routes/
│   │       ├── __init__.py
│   │       └── health.py     # GET /health router
│   ├── core/
│   │   ├── __init__.py
│   │   └── config.py         # Settings loaded from environment / .env
│   ├── models/
│   │   ├── __init__.py
│   │   └── health.py         # HealthResponse Pydantic model
│   └── storage/
│       └── .gitkeep          # Placeholder for the future storage layer
├── tests/
│   └── __init__.py
├── .env                      # Local config (gitignored)
├── .env.example
├── .gitignore
├── README.md
└── requirements.txt

Setup

Create and activate a virtual environment, then install dependencies.

Linux / macOS (bash):

python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt

Windows (PowerShell):

python -m venv venv
.\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt

After installing, run pip freeze and confirm versions match requirements.txt.

Run

From the project root:

uvicorn app.main:app --reload --port 8000

Or use the built-in runner, which reads PORT / APP_ENV from .env:

python -m app.main

Test the health endpoint

curl -i http://127.0.0.1:8000/health

Expected: an HTTP/1.1 200 OK status line and a JSON body like:

{ "status": "ok", "timestamp": "2026-07-10T12:34:56.789012+00:00" }

API docs (Swagger)

With the server running, open the interactive Swagger UI:

http://127.0.0.1:8000/docs

ReDoc is at http://127.0.0.1:8000/redoc; the raw OpenAPI schema is at http://127.0.0.1:8000/openapi.json.

Environment variables

Variable Default Purpose
PORT 8000 Port used by python -m app.main
APP_ENV development Enables auto-reload when development

.env is gitignored; commit .env.example instead.