A small birthday API using FastAPI, Pydantic, SQLAlchemy, and PostgreSQL.
PUT /hello/{username}
- body:
{ "dateOfBirth": "YYYY-MM-DD" } - validation: username letters only, date before today
- response: 204 No Content
GET /hello/{username}
- response:
200with message Hello, <username>! Happy birthday!if todayHello, <username>! Your birthday is in N day(s)otherwise
- Install dependencies:
uv sync --locked --all-extras - Install pre commit hooks
pre-commit install
- Install dependencies:
uv sync --locked --all-extras - Start PostgreSQL:
docker compose up db -d - Set up
DATABASE_URLif you are not using the default local container value. - Run app:
uv run uvicorn app.main:app --reload
Run unit tests:
uv run pytest tests/unit -v
Run integration tests against the containers:
docker compose up --build -duv run pytest tests/integration -v
docker compose up --build -d