Skip to content

harshanakira/task-manager-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📝 Task Tracker API

Python FastAPI CI License: MIT

A clean, production-style basic FastAPI project.
Includes JWT authentication, CRUD APIs, SQLAlchemy ORM, pytest tests, Docker, and GitHub Actions CI.


Features

  • JWT authentication (signup/login)
  • CRUD for tasks (per-user access)
  • SQLite + SQLAlchemy ORM
  • Dockerfile for containerization
  • GitHub Actions CI (tests run on every push)
  • Clear project structure & unit tests

Demo (Swagger UI)

Swagger Screenshot


Example Flow

  1. Signup
    POST /auth/signup
    {
      "email": "test@example.com",
      "password": "secret1"
    }
  2. Login
    POST /auth/login
    username=test@example.com
    password=secret1
    
    → copy access_token
  3. Authorize in Swagger (top-right) with Bearer <token>
  4. Create a Task
    POST /tasks
    {
      "title": "My first task",
      "description": "demo",
      "is_done": false
    }
  5. List Tasks
    GET /tasks
    [
      { "id": 1, "title": "My first task", "description": "demo", "is_done": false, "owner_id": 1 }
    ]

Quick Start (Local)

1) Create & activate a virtual environment

python3 -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
python -m pip install --upgrade pip

2) Install dependencies

pip install -r requirements.txt

3) Run the API

uvicorn app.main:app --reload

Open: http://127.0.0.1:8000/docs

4) Run tests

pytest -q

🐳 Docker

docker build -t task-tracker-api:dev .
docker run -p 8000:8000 task-tracker-api:dev

🌍 Environment

Copy .env.example.env and optionally edit the secret key. Defaults are safe for local dev.


📌 Endpoints (overview)

  • POST /auth/signup – Create user
  • POST /auth/login – Get JWT token
  • GET /tasks – List tasks (per-user only)
  • POST /tasks – Create task
  • PUT /tasks/{task_id} – Update task
  • DELETE /tasks/{task_id} – Delete task

Use the Authorize button in /docs (bearer token) after login.


📂 Repo Structure

task-tracker-api/
├─ app/
│  ├─ main.py
│  ├─ db.py
│  ├─ models.py
│  ├─ schemas.py
│  ├─ crud.py
│  ├─ auth.py
│  ├─ dependencies.py
│  └─ routers/
│     ├─ users.py
│     └─ tasks.py
├─ tests/
│  ├─ test_auth.py
│  └─ test_tasks.py
├─ docs/
│  └─ swagger.png
├─ .github/workflows/ci.yml
├─ requirements.txt
├─ Dockerfile
├─ .gitignore
├─ .env.example
└─ LICENSE

📜 License

MIT © 2025

About

A Python Flask-based API for task management with JWT auth and Docker deployment.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors