Skip to content

About

A hands-on **FastAPI Authentication** project implementing secure user registration, login, and JWT-based authentication. Covers password hashing, access and refresh tokens, protected routes, authentication middleware, and user authorization using FastAPI and SQLAlchemy.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Authentication using FastAPI

πŸš€ Production-Ready Full Stack Authentication System

A modern authentication system built with React, FastAPI, and PostgreSQL featuring JWT Authentication, Password Hashing, Rate Limiting, and Production Deployment.




FastAPI React PostgreSQL JWT Vercel Render


🌐 Live Demo

https://authentication-using-fast-api.vercel.app


πŸ“Έ Preview

Add screenshots here

Login Signup
Image Image
Dashboard Profile
Image Image

✨ Features

πŸ” Authentication

  • JWT Authentication
  • Secure Login & Signup
  • Protected Routes
  • Logout Functionality

πŸ”’ Security

  • Argon2 Password Hashing
  • Password Strength Validation
  • Rate Limiting
  • OAuth2 Bearer Authentication
  • Environment Variables

πŸ—„ Database

  • PostgreSQL
  • SQLAlchemy ORM
  • Alembic Migrations

βš› Frontend

  • React 19
  • React Router
  • Axios Interceptors
  • Toast Notifications
  • Responsive Design

☁ Deployment

  • Backend β†’ Render
  • Frontend β†’ Vercel
  • Production Ready

πŸ›  Tech Stack

Category Technologies
🎨 Frontend React 19, Vite, React Router, Axios, React Toastify
⚑ Backend FastAPI, Pydantic, SQLAlchemy, Alembic
πŸ” Authentication JWT, OAuth2, python-jose, pwdlib (Argon2)
πŸ—„ Database PostgreSQL
🚦 Security SlowAPI Rate Limiter
☁ Deployment Render, Vercel
πŸ”§ Tools Git, GitHub

πŸ“‚ Project Structure

Authentication_using_FastAPI
β”‚
β”œβ”€β”€ backend
β”‚   β”œβ”€β”€ auth
β”‚   β”œβ”€β”€ schemas
β”‚   β”œβ”€β”€ tokens
β”‚   β”œβ”€β”€ limiter
β”‚   β”œβ”€β”€ utils
β”‚   β”œβ”€β”€ alembic
β”‚   β”œβ”€β”€ database.py
β”‚   β”œβ”€β”€ model.py
β”‚   β”œβ”€β”€ main.py
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ frontend
β”‚   β”œβ”€β”€ src
β”‚   β”‚   β”œβ”€β”€ pages
β”‚   β”‚   β”œβ”€β”€ services
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   └── main.jsx
β”‚   └── package.json
β”‚
└── README.md

βš™ Architecture

              React (Vite)
                    β”‚
             Axios API Calls
                    β”‚
                    β–Ό
             FastAPI Backend
                    β”‚
      JWT Authentication Layer
                    β”‚
        SQLAlchemy + Alembic
                    β”‚
                    β–Ό
             PostgreSQL Database

πŸš€ Installation

1️⃣ Clone Repository

git clone https://github.com/durgaprasadcodes/Authentication_using_FastAPI.git

cd Authentication_using_FastAPI

2️⃣ Backend

cd backend

python -m venv venv

source venv/bin/activate

# Windows
venv\Scripts\activate

pip install -r requirements.txt

Create .env

DATABASE_URL=

SECRET_KEY=

ALGORTHIM=HS256

EXPIRE_TIME=60

Run Migrations

alembic upgrade head

Start Server

uvicorn main:app --reload

3️⃣ Frontend

cd frontend

npm install

Create

VITE_API_URL=http://127.0.0.1:8000

Run

npm run dev

πŸ”‘ API Endpoints

Method Endpoint Authentication
GET / ❌
POST /auth/signup ❌
POST /auth/login ❌
GET /profile βœ…
POST /changePassword βœ…

πŸ“¦ Sample Requests

Signup

{
  "name":"John",
  "email":"john@gmail.com",
  "password":"Password@123"
}

Login

{
  "email":"john@gmail.com",
  "password":"Password@123"
}

πŸ”’ Password Rules

βœ” Minimum 8 Characters

βœ” One Uppercase Letter

βœ” One Lowercase Letter

βœ” One Number

βœ” One Special Character


🌍 Deployment

Backend

βœ… Render

Frontend

βœ… Vercel


πŸ’‘ Future Improvements

  • Google OAuth Login
  • Refresh Tokens
  • Email Verification
  • Forgot Password
  • Docker Support
  • CI/CD Pipeline
  • User Roles
  • Dark Mode

πŸ‘¨β€πŸ’» Author

Durga Prasad Kota

πŸ’Ό LinkedIn

https://linkedin.com/in/durgaprasadkota

πŸ“§ Email

durgaprasad04289@gmail.com


⭐ If you like this project, don't forget to star the repository!

Made with ❀️ using React + FastAPI + PostgreSQL

About

A hands-on **FastAPI Authentication** project implementing secure user registration, login, and JWT-based authentication. Covers password hashing, access and refresh tokens, protected routes, authentication middleware, and user authorization using FastAPI and SQLAlchemy.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages