Production-ready Authentication & Authorization Platform built with FastAPI, PostgreSQL, Redis & Docker.
AuthForge is a modular authentication and authorization platform designed with production-ready architecture and security best practices.
It provides secure user authentication, role-based authorization, JWT access & refresh tokens, Redis-powered token blacklisting, rate limiting, email verification, password reset, audit logging, automated testing, and CI/CD integration.
The project follows a clean modular architecture making it reusable across multiple applications.
- User Registration
- Secure Login
- JWT Access Tokens
- Refresh Token Rotation
- Logout
- Session Management
- Role-Based Access Control (RBAC)
- Admin/User Roles
- Protected Routes
- Password Hashing (bcrypt)
- Email Verification
- Password Reset
- Redis Token Blacklisting
- Login Rate Limiting
- Secure JWT Validation
- Redis User Caching
- Optimized Database Queries
- Audit Logging
- Request Tracking
- Security Event Logging
- Docker Support
- GitHub Actions CI
- Automated Testing
- Ruff
- Black
Client
β
βΌ
FastAPI Server
β
ββββββββββββ΄βββββββββββ
β β
Authentication Authorization
β β
ββββββββββββ¬βββββββββββ
β
Auth Service
β
ββββββββββββββΌββββββββββββββ
β β β
PostgreSQL Redis Email Provider
β β
βΌ βΌ
Persistent Cache &
Storage Blacklisting
- FastAPI
- SQLAlchemy
- PostgreSQL
- Redis
- Pydantic v2
- JWT
- OAuth2 Password Flow
- RBAC
- Refresh Token Rotation
- bcrypt
- Email Verification
- Password Reset
- Rate Limiting
- Docker
- GitHub Actions
- Pytest
- Ruff
- Black
app/
β
βββ cache/
βββ core/
βββ db/
βββ modules/
β βββ auth/
β βββ users/
β βββ roles/
β βββ audit/
β βββ ...
β
βββ providers/
βββ shared/
β
tests/
alembic/
Register
β
βΌ
Email Verification
β
βΌ
Login
β
βΌ
Access Token
Refresh Token
β
βΌ
Protected APIs
β
βΌ
Refresh Token Rotation
β
βΌ
Logout
β
βΌ
JWT Blacklisted
git clone https://github.com/YOUR_USERNAME/AuthForge.git
cd AuthForgepython -m venv .venvWindows
.venv\Scripts\activateLinux
source .venv/bin/activatepip install -r requirements.txtCreate
.env
DATABASE_URL=
JWT_SECRET_KEY=
JWT_ALGORITHM=
REDIS_URL=
SMTP_USERNAME=
SMTP_PASSWORD=
alembic upgrade headuvicorn app.main:app --reloadSwagger
http://localhost:8000/docs
Start Redis
docker run -d \
-p 6379:6379 \
--name authforge-redis \
redis:7Verify
docker exec -it authforge-redis redis-cliPING
PONG
pytestCurrent Status
13+ Tests Passing
| Method | Endpoint |
|---|---|
| POST | /api/v1/auth/register |
| POST | /api/v1/auth/login |
| POST | /api/v1/auth/logout |
| POST | /api/v1/auth/refresh |
| GET | /api/v1/auth/me |
| POST | /api/v1/auth/change-password |
| POST | /api/v1/auth/forgot-password |
| POST | /api/v1/auth/reset-password |
| GET | /api/v1/auth/verify-email |
β Password Hashing
β JWT Authentication
β Refresh Token Rotation
β Redis Token Blacklisting
β Login Rate Limiting
β RBAC
β Email Verification
β Password Reset
β Audit Logging
Every push automatically runs:
- Ruff
- Black
- Pytest
via GitHub Actions.
- Authentication
- RBAC
- Email Verification
- Password Reset
- Refresh Tokens
- JWT Blacklisting
- Redis Cache
- Rate Limiting
- Audit Logging
- Session Management
- Admin Dashboard APIs
- Frontend Dashboard
- Deployment
Contributions are welcome.
Please open an issue before submitting large changes.
MIT License