Skip to content

A simple, secure, and production-ready Task Manager REST API built with FastAPI, JWT Authentication, Argon2 Password Hashing, and SQLAlchemy ORM.

Notifications You must be signed in to change notification settings

nahidulhasan/fastapi-task-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“˜ FastAPI Task Manager API

A simple, secure, and production-ready Task Manager REST API built with FastAPI, JWT Authentication, Argon2 Password Hashing, and SQLAlchemy ORM. This project is perfect for learning backend development, FastAPI, authentication, and CRUD APIs.

๐Ÿš€ Features

User Registration & Login (JWT Authentication)

Secure password hashing using Argon2

Create, read, update, delete tasks (CRUD)

SQLite database (easy to run locally)

Protected routes using OAuth2 Bearer Tokens

Pydantic models for validation

Auto-generated API documentation (Swagger UI)

Clean, modular project structure

๐Ÿ“ฆ Tech Stack

FastAPI

SQLAlchemy ORM

Pydantic

Argon2 (argon2-cffi)

SQLite

Python-Jose (JWT)

Uvicorn

โš™๏ธ Installation & Setup

1๏ธโƒฃ Clone the repository

git clone https://github.com/nahidulhasan/fastapi-task-manager.git

cd fastapi-task-manager

2๏ธโƒฃ Create & activate virtual environment

python3 -m venv .venv

source .venv/bin/activate

3๏ธโƒฃ Install dependencies

pip install -r requirements.txt

4๏ธโƒฃ Run the API

uvicorn app.main:app --reload

API will be available at: http://127.0.0.1:8000

Interactive API docs (Swagger UI): http://127.0.0.1:8000/docs

๐Ÿ” Authentication Flow

1๏ธโƒฃ Register a user

POST /auth/register

Body:

{ "email": "test@example.com", "password": "123456" }

2๏ธโƒฃ Login to get JWT token

POST /auth/token

Form-data:

username=test@example.com password=123456

Response:

{

"access_token": "<JWT_TOKEN>",

"token_type": "bearer"

}

Use this token for all protected routes:

Authorization: Bearer

๐Ÿ“ Task Endpoints

โž• Create a Task

POST /tasks/ Requires authentication.

Example:

{

"title": "Buy groceries",

"description": "Milk, eggs, bread",

"priority": "HIGH",

"due_date": "2025-01-31T10:00:00" }

๐Ÿ“– Get All Tasks

GET /tasks/

๐Ÿ” Get Single Task

GET /tasks/{task_id}

โœ๏ธ Update Task

PUT /tasks/{task_id}

Example:

{

"title": "Updated title",

"completed": true

}

๐Ÿ—‘ Delete Task

DELETE

/tasks/{task_id}

๐Ÿ—„ Database

SQLite is used by default:

app/tasks.db

โค๏ธ Contributing

Pull requests are welcome! Feel free to open issues or suggest new features.

๐Ÿ“œ License

MIT License.

About

A simple, secure, and production-ready Task Manager REST API built with FastAPI, JWT Authentication, Argon2 Password Hashing, and SQLAlchemy ORM.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages