Skip to content

sonnymay/TasksManagerAPI

Repository files navigation

Task Manager API

Python FastAPI SQLAlchemy PostgreSQL CI

A small RESTful task-management API built with FastAPI, SQLAlchemy, and Pydantic. It supports task CRUD, completion updates, automatic Swagger docs, and local SQLite development with a DATABASE_URL path for production databases.

Live Swagger Demo

Deploy to Render/Railway to generate a live Swagger URL.

Deploy to Render

After deployment, open /docs on the deployed service URL for Swagger UI.

Features

  • Create, list, read, update, complete, and delete tasks
  • Pydantic request and response schemas
  • SQLAlchemy model and session management
  • SQLite by default, with PostgreSQL-compatible DATABASE_URL configuration
  • Swagger UI at /docs and ReDoc at /redoc
  • GitHub Actions CI running pytest and Python compile checks

Tech Stack

Layer Technology
Framework FastAPI
ORM SQLAlchemy
Validation Pydantic
Database SQLite locally, PostgreSQL-compatible via DATABASE_URL
Server Uvicorn
Testing pytest + httpx
CI GitHub Actions

Quickstart

git clone https://github.com/sonnymay/TasksManagerAPI.git
cd TasksManagerAPI
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
uvicorn app.main:app --reload

Open http://localhost:8000/docs for the interactive Swagger UI.

API Endpoints

Method Endpoint Description
GET / Health-style welcome message
GET /tasks/ List all tasks
POST /tasks/ Create a task
GET /tasks/{task_id} Get one task
PUT /tasks/{task_id} Update a task
PATCH /tasks/{task_id}/complete Mark a task completed
DELETE /tasks/{task_id} Delete a task

Running Tests

pytest

Project Structure

app/
  main.py          # FastAPI app, CORS, router wiring
  database.py      # SQLAlchemy engine/session setup
  models.py        # SQLAlchemy Task model
  schemas.py       # Pydantic request/response schemas
  routes/tasks.py  # Task CRUD routes
tests/
  test_tasks.py    # API tests

What This Code Shows

  • FastAPI routing with dependency-injected database sessions
  • Clear separation between SQLAlchemy models and Pydantic schemas
  • Environment-based database configuration
  • Small, readable API surface with automated OpenAPI docs
  • CI-backed backend project hygiene

About

A clean RESTful task-manager API with full CRUD and auto-generated Swagger docs. Built with FastAPI, SQLAlchemy, and Pydantic — runs on SQLite locally or PostgreSQL in production.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages