Skip to content

About

Modern authentication system built with Django REST Framework, Djoser, JWT, React, TypeScript and Vite.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

2 Commits

Folders and files

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

Repository files navigation

πŸš€ Djoser Authentication Demo

Python Django DRF Djoser SimpleJWT React TypeScript Vite TailwindCSS shadcn/ui Axios


πŸ“– About

A modern full-stack authentication system built with Django REST Framework, Djoser, JWT, and React + TypeScript.

This project demonstrates a production-style authentication workflow with secure JWT authentication, email activation, password reset, automatic token refresh, protected routes, modern UI, and clean architecture.


πŸ“Έ Screenshots

🏠 Home

Home


πŸ” User Register & Login

Login


βš™οΈ dashboard

dashboard


πŸ‘€ Profile Page

Profile Page


πŸ”‘ Change Password

change_password


Reset Password

reset_password


πŸ— Frontend Architecture

A detailed architecture document is available here:

πŸ“„ Frontend Architecture


✨ Features

πŸ” Authentication

  • User Registration
  • Email Account Activation
  • Login using JWT
  • Logout
  • Automatic JWT Refresh
  • Protected Routes
  • Guest Routes
  • Persistent Authentication
  • Session Restoration
  • Authorization Guards

πŸ‘€ User Management

  • View Current Profile
  • Edit Profile
  • Change Password
  • Forgot Password
  • Password Reset via Email
  • Resend Activation Email

βš™οΈ Backend Features

  • Django REST Framework
  • Djoser Authentication
  • JWT Authentication
  • Email Activation
  • Password Reset Flow
  • Token Blacklisting Support
  • CORS Configuration
  • SMTP Email Configuration
  • Environment Variables

🎨 Frontend Features

  • React 19
  • TypeScript
  • Vite
  • TailwindCSS v4
  • shadcn/ui
  • Responsive Layout
  • Dark Mode
  • Light Mode
  • Beautiful Authentication Pages
  • Modern Dashboard
  • Error Handling
  • Loading States

πŸ”„ API Features

  • Axios Instance
  • Request Interceptors
  • Response Interceptors
  • Automatic Access Token Refresh
  • Retry Failed Requests
  • Secure Token Storage
  • Centralized API Layer

πŸ— Project Architecture

                React Frontend
                       β”‚
                       β”‚
                 Axios Instance
                       β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚                           β”‚
 Access Token                  Refresh Token
         β”‚                           β”‚
         β–Ό                           β–Ό
 Django REST Framework + Djoser + JWT
         β”‚
         β–Ό
      SQLite Database

πŸ”„ Authentication Flow

User Registration
        β”‚
        β–Ό
Activation Email Sent
        β”‚
        β–Ό
User Clicks Activation Link
        β”‚
        β–Ό
Account Activated
        β”‚
        β–Ό
Login
        β”‚
        β–Ό
Access Token + Refresh Token
        β”‚
        β–Ό
Protected Pages
        β”‚
        β–Ό
Access Token Expired
        β”‚
        β–Ό
Automatic Refresh
        β”‚
        β–Ό
Retry Original Request

πŸ“‚ Project Structure

Djoser_SimpleApp/
β”‚
β”œβ”€β”€ djoser_api/
β”‚   β”œβ”€β”€ manage.py
β”‚   β”œβ”€β”€ api.http
β”‚   β”œβ”€β”€ schema.yml
β”‚   └── djoser_api/
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚
β”‚   β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ context/
β”‚   β”œβ”€β”€ hooks/
β”‚   β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ types/
β”‚   └── utils/
β”‚
└── README.md

πŸ“š API Endpoints Covered

Authentication

Method Endpoint
POST /auth/users/
POST /auth/users/activation/
POST /auth/users/resend_activation/
POST /auth/jwt/create/
POST /auth/jwt/refresh/
POST /auth/jwt/verify/
POST /auth/jwt/logout/

User

Method Endpoint
GET /auth/users/me/
PATCH /auth/users/me/

Password

Method Endpoint
POST /auth/users/set_password/
POST /auth/users/reset_password/
POST /auth/users/reset_password_confirm/

πŸ›  Tech Stack

Backend

  • Python 3.12
  • Django
  • Django REST Framework
  • Djoser
  • SimpleJWT

Frontend

  • React 19
  • TypeScript
  • Vite
  • TailwindCSS v4
  • shadcn/ui
  • Axios
  • React Router

βš™οΈ Installation

Clone Repository

git clone https://github.com/yourusername/Djoser_SimpleApp.git

cd Djoser_SimpleApp

🐍 Backend Setup

cd djoser_api

python -m venv .venv

Activate environment

Linux

source .venv/bin/activate

Windows

.venv\Scripts\activate

Install dependencies

pip install -r requirements.txt

Run migrations

python manage.py migrate

Start server

python manage.py runserver

βš›οΈ Frontend Setup

cd frontend

npm install

npm run dev

πŸ”‘ Environment Variables

Backend (.env)

SECRET_KEY=your_secret_key

EMAIL_USER=your_email@gmail.com

EMAIL_PASS=your_app_password

FRONTEND_URL=http://localhost:5173

Frontend (.env)

VITE_API_URL=http://127.0.0.1:8000

πŸ“Œ Security Features

  • JWT Authentication
  • Access Token Rotation
  • Refresh Token
  • Token Blacklisting Ready
  • Protected API Endpoints
  • Route Guards
  • Email Verification
  • Password Validation
  • CORS Protection

πŸ“– What You'll Learn From This Project

This project demonstrates:

  • Building a complete authentication system
  • Connecting React with Django REST Framework
  • Using Djoser without writing authentication logic manually
  • JWT Authentication
  • Automatic Token Refresh
  • Axios Interceptors
  • Protected Routes
  • Guest Routes
  • Context API
  • Custom Hooks
  • Service Layer Architecture
  • Modern Folder Structure
  • Environment Variables
  • Production Ready Project Organization

πŸš€ Future Improvements

  • Custom User Model
  • Social Authentication (Google/GitHub)
  • Two-Factor Authentication (2FA)
  • User Avatar Upload
  • Celery Email Queue
  • Redis Integration
  • Docker Support
  • CI/CD Pipeline
  • PostgreSQL Deployment
  • Nginx + Gunicorn
  • GitHub Actions

πŸ“„ License

This project is intended for educational purposes and learning Django REST Framework, Djoser, JWT authentication, and React integration.


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

Mohammed Al-Basha

Backend & Frontend Developer

  • Django
  • Django REST Framework
  • React
  • TypeScript
  • REST APIs

⭐ If you found this project helpful, don't forget to give it a star!

About

Modern authentication system built with Django REST Framework, Djoser, JWT, React, TypeScript and Vite.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages