Skip to content

A clean and scalable FastAPI authentication system with SQLAlchemy, JWT, role-based access, and Alembic migrations. Built for learning and understanding backend architecture.

Notifications You must be signed in to change notification settings

KarkiGaurav/fasty-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Fasty Auth – FastAPI Authentication System

An advanced, production-ready authentication system built with FastAPI, SQLAlchemy, PostgreSQL, and Alembic.

This project is created purely for learning backend architecture, and is designed as a clean, scalable template for future real applications (such as the Mendora project).


✨ Features

  • 🔐 JWT Authentication (Access + Refresh Tokens)
  • 🔄 Refresh Token Rotation
  • 🔑 Role-Based Access (Admin / User)
  • 🧩 SQLAlchemy ORM Models
  • 🛢 PostgreSQL Integration
  • 📦 Alembic Migrations
  • 🧱 Clean Folder Structure (Industry Standard)
  • 🛠 User CRUD Example
  • 🔒 Secure Password Hashing (bcrypt)
  • 📁 Environment Variable Support (.env)

🏗 Tech Stack

  • FastAPI
  • SQLAlchemy ORM
  • Alembic (Migrations)
  • PostgreSQL
  • Python-Jose (JWT)
  • Passlib[bcrypt] (Password hashing)
  • Pydantic v2
  • Uvicorn (Server)

🎯 Purpose of This Project

This repository is built for learning and understanding:

  • JWT and authentication flow
  • Refresh token rotation
  • Database architecture with SQLAlchemy
  • Alembic migrations
  • Role-based authorization
  • REST API design
  • Folder structure for scalable FastAPI projects

This is a learning-only project.


Getting Started

1. Clone the repository

git clone https://github.com/KarkiGaurav/fasty-auth.git
cd fasty-auth

python3 -m venv venv
source venv/bin/activate

pip install -r requirements.txt

cp .env.example .env

alembic upgrade head

Start the FastAPI Server

uvicorn main:app --reload

Some addtional migration commands

alembic init alembic

alembic revision --autogenerate -m "initial migration"

📝 License

MIT License
Copyright (c) 2025

About

A clean and scalable FastAPI authentication system with SQLAlchemy, JWT, role-based access, and Alembic migrations. Built for learning and understanding backend architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published