A production-oriented backend system built with FastAPI, demonstrating secure authentication, Redis-based security controls, rate limiting, and scalable API architecture.
This project focuses primarily on backend engineering, while the React frontend acts as a client interface used to interact with backend APIs.
The goal of this project is to demonstrate skills relevant for Backend / Python Developer roles, including authentication systems, Redis-based security mechanisms, modular backend architecture, and API development.
[https://fastapi-jwt-redis-backend.vercel.app]
[https://fastapi-jwt-redis-backend.onrender.com]
[https://fastapi-jwt-redis-backend.onrender.com/docs]
Users can browse products and add items to their cart.
Interactive API documentation generated by FastAPI.
graph TD
User --> ReactFrontend
ReactFrontend --> FastAPIBackend
FastAPIBackend --> PostgreSQL
FastAPIBackend --> Redis
ReactFrontend[React Frontend - Vercel]
FastAPIBackend[FastAPI Backend - Render]
PostgreSQL[PostgreSQL Database - Neon]
Redis[Redis Security Layer - Upstash]
This project demonstrates real-world backend engineering patterns:
β’ Secure authentication system β’ Redis security layers β’ Rate limiting implementation β’ Structured logging β’ Modular API architecture β’ Token lifecycle management β’ Background task scheduling β’ Role-based access control
The application uses a JWT-based authentication system.
β’ Access Token authentication β’ Refresh Token rotation β’ Refresh token reuse detection β’ HTTPOnly refresh token cookies β’ Secure logout using Redis blacklist β’ Secure logout using refresh token revokation β’ Password hashing using bcrypt
sequenceDiagram
User->>Frontend: Login Request
Frontend->>Backend: /auth/login
Backend->>Database: Verify credentials
Backend->>Frontend: Access Token + Refresh Token
Frontend->>Backend: API Request (Authorization Header)
Backend->>Frontend: Response
Frontend->>Backend: /auth/refresh
Backend->>Frontend: New Access Token
Role-Based Access Control is implemented.
Roles:
Admin
User
Admin permissions:
β’ Create products β’ Update products β’ Delete products
User permissions:
β’ View products β’ Add products to cart β’ Manage cart items
Authorization is enforced through FastAPI dependencies.
Redis is used to implement backend security features.
Redis enables:
β’ Login rate limiting β’ Refresh token rate limiting β’ Token blacklist for logout β’ Fast token validation β’ Automatic expiration using TTL
Example Redis keys:
login:ip:<ip>
login:email:<email>
refresh:ip:<ip>
refresh:user_id:<id>
blacklist:<access_token>
Login and Refresh tokens attempts are limited to prevent brute-force attacks per Email or Username and IP address.
Example configuration:
Maximum attempts: 5
Window: 60 seconds
Exceeded attempts return:
HTTP 429 Too Many Requests
Redis automatically resets counters using TTL.
Security events are logged using structured logs.
Example logs:
event=login_attempt ip=103.x.x.x email=user@email.com
event=login_rate_limit_exceeded ip=103.x.x.x
event=login_success user_id=3
This demonstrates observability practices used in production systems.
Each user maintains an isolated cart.
Features:
β’ Add products to cart β’ Update cart quantity β’ Remove cart items β’ User-specific cart isolation
Example endpoints:
POST /cart/add
PATCH /cart/update/{product_id}
DELETE /cart/remove/{product_id}
Admin-controlled inventory system.
Endpoints:
GET /products
POST /products
PATCH /products/{id}
DELETE /products/{id}
Users can browse products and add them to their cart.
Background tasks are implemented using APScheduler.
Tasks include:
Cleanup of expired tokens
Maintenance of revoked tokens
This demonstrates backend background job scheduling.
FastAPI Python PostgreSQL SQLAlchemy ORM Redis APScheduler python-jose (JWT) passlib / bcrypt
React Vite Axios
The frontend is intentionally lightweight because the primary focus of this project is backend architecture.
Database: Neon PostgreSQL Redis: Upstash Backend Deployment: Render Frontend Deployment: Vercel
fastapi-jwt-redis-backend
β
βββ app
β βββ core
β β βββ auth.py
β β βββ security.py
β β βββ redis_client.py
β β βββ rate_limiter.py
β β
β βββ db
β β βββ database.py
β β βββ database_models.py
β β
β βββ routers
β β βββ auth_router.py
β β βββ product_router.py
β β βββ cart_router.py
β β
β βββ services
β β βββ cart_service.py
β β βββ product_service.py
β β
β βββ tasks
β β βββ token_cleanup.py
β β
β βββ main.py
β
βββ frontend
β βββ src
β βββ pages
β βββ components
β βββ api
β
βββ screenshots
β
βββ requirements.txt
βββ README.md
git clone https://github.com/AkashAkuthota/fastapi-jwt-redis-backend.git
cd fastapi-jwt-redis-backend
python -m venv myenv
source myenv/bin/activate
pip install -r requirements.txt
Create .env
SECRET_KEY=your_secret_key
DATABASE_URL=your_postgres_connection
REDIS_HOST=your_upstash_host
REDIS_PORT=6379
REDIS_PASSWORD=your_upstash_password
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=7
uvicorn app.main:app --reload
API docs:
http://localhost:8000/docs
cd frontend
npm install
npm run dev
This project demonstrates backend engineering practices such as:
β’ Secure authentication systems β’ Redis-based security controls β’ Rate limiting implementation β’ Scalable API design β’ Modular backend architecture β’ Token lifecycle management β’ Background job scheduling β’ Observability through structured logging
The project is designed to showcase capabilities relevant for Backend / Python Developer roles, while also demonstrating the ability to integrate backend APIs with a frontend client.
Akash Akuthota
GitHub [https://github.com/AkashAkuthota]
LinkedIn [https://www.linkedin.com/in/akashakuthota/]
Consider giving the repository a star β on GitHub.

