Skip to content

Repository files navigation

Todo API – FastAPI

CI codecov

REST API for task management built with FastAPI, focusing on backend engineering practices, automated testing, and continuous integration.

Live API Docs (Swagger) https://todo-api-latest-82ru.onrender.com/docs


Technologies

  • Python 3.11
  • FastAPI
  • SQLAlchemy
  • PostgreSQL
  • Pytest
  • Docker
  • GitHub Actions (CI)
  • Codecov
  • Alembic (database migrations)

Project Structure

app/
├── routes/        # FastAPI route definitions (API endpoints)
├── services/      # Business logic and application services
├── models/        # Database models
├── schemas/       # Pydantic schemas for request/response validation
├── database/      # Database configuration and session management
├── exceptions/    # Custom exception handling
└── main.py        # FastAPI application entry point

tests/
├── unit/          # Unit tests
└── integration/   # Integration tests

Testing

The project includes two types of automated tests:

  • Unit Tests: fast, isolated and use SQLite in-memory
  • Integration Tests: use a real PostgreSQL database and run in an isolated Docker environment

Run in an isolated Docker environment

pytest -m unit
pytest -m integration

Run tests with coverage

pytest --cov=app

Code Coverage

Test coverage is automatically monitored using Codecov.

  • Minimum required coverage: 70%
  • Pull Requests fail if coverage drops below the threshold.

CI – Continuous Integration

A CI pipeline runs automatically using GitHub Actions on:

  • Push to main or develop
  • Pull Requests

Pipeline steps:

  1. Install dependencies
  2. Run unit tests
  3. Run integration tests
  4. Generate coverage report
  5. Upload coverage to Codecov

Running the API Locally

The API and PostgreSQL database run in containers using Docker Compose.

Start the environment:

docker compose up -d

The interactive API documentation will be available at:

http://localhost:8000/docs


Deployment

The application is deployed using Docker containers on Render.

During container startup:

  • Database migrations run automatically via Alembic
  • The FastAPI application is started with Uvicorn

License

This project was developed for learning and portfolio purposes.

About

Python, FastAPI, PostgreSQL, Docker, GitHub Actions, Codecov – REST API with automated testing, CI pipeline, and containerized deployment on Render.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages