Skip to content

iamdeveloperrayhan/django-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Django REST API Framework

πŸš€ A Powerful Django REST API with JWT Authentication, Search, Filtering, Ordering, Pagination & Throttling


Python Django DRF JWT SQLite REST API License


πŸ“– Project Overview

This project is a RESTful API built with Django REST Framework (DRF).

It provides a clean and secure API for managing books with modern backend features including:

  • πŸ” Search
  • πŸ“‘ Filtering
  • ↕️ Ordering
  • πŸ“„ Pagination
  • πŸ” JWT Authentication
  • 🚦 API Throttling
  • πŸ›‘οΈ Permission Control

The API is designed following REST principles and can easily be integrated with Web, Mobile or Desktop applications.


✨ Features

βœ… JWT Authentication

βœ… CRUD Operations

βœ… Search by Title

βœ… Filter by Author

βœ… Order by Price

βœ… Pagination

βœ… API Throttling

βœ… Secure Permissions

βœ… RESTful API


πŸ›  Technology Stack

Technology Description
Python Programming Language
Django Web Framework
Django REST Framework REST API Development
Simple JWT Authentication
SQLite Database
Django ORM Database Operations
REST API Backend Architecture

πŸ“‚ Installation

Clone the repository

git clone https://github.com/iamdeveloperrayhan/REST-API.git

Go to project

cd REST-API

🐍 Virtual Environment Setup

Create Virtual Environment

python -m venv venv

Activate

Windows

venv\Scripts\activate

Linux / macOS

source venv/bin/activate

πŸ“¦ Package Installation

Install required packages

pip install django
pip install djangorestframework
pip install djangorestframework-simplejwt
pip install django-filter

Or

pip install -r requirements.txt

πŸ—„ Database Migration

python manage.py makemigrations
python manage.py migrate

Create Superuser

python manage.py createsuperuser

▢️ Run Development Server

python manage.py runserver

Visit

http://127.0.0.1:8000/

πŸ“‘ API Documentation

Base URL

http://127.0.0.1:8000/api/

πŸ” JWT Authentication Flow

Step 1

Register a new account

POST /register/

Replace the URL according to your project.


Step 2

Login

POST /login/

Receive

Access Token

Refresh Token

Step 3

Send Access Token

Authorization

Bearer YOUR_ACCESS_TOKEN

πŸ‘€ Registration & Login

If you don't have an account,

Register first

↓

Login

↓

Receive JWT Token

↓

Access Protected APIs


πŸ”‘ Permissions

Method Permission
GET AllowAny
POST IsAuthenticated
PUT IsAuthenticated
PATCH IsAuthenticated
DELETE IsAuthenticated

πŸ” Search Functionality

Search by Title

Query Parameter

title

Example

/api/books/?title=django

Internally this project uses

Q()

with

|

(Pipe Operator)

for searching.


🎯 Filter

Filter books by Author

Example

/api/books/?author=John

↕️ Ordering

Order books by Price

Query Parameter

order

Example

Ascending

/api/books/?order=price

Descending

/api/books/?order=-price

Uses

.order_by()

πŸ“„ Pagination

Pagination is enabled.

Every page returns

2 Books

Example

?page=2

🚦 Throttling Configuration

User Type Requests
Authenticated User 50 Requests / Minute
Anonymous User 20 Requests / Minute

πŸ“Œ API Endpoints

Method Endpoint Description
GET /api/books/ Get All Books
GET /api/books/<id>/ Get Single Book
POST /api/books/ Create Book
PUT /api/books/<id>/ Update Entire Book
PATCH /api/books/<id>/ Partial Update
DELETE /api/books/<id>/ Delete Book

πŸ“¬ Example Request

Create Book

POST /api/books/
Content-Type: application/json

{
  "title": "title",
  "author": "author",
  "price": 100
}

Response

{
  "id":1,
  "title":"title",
  "author":"author",
  "price":"100.00",
  "published_date":"2026-07-08T12:50:33.721511Z"
}

PATCH

PATCH /api/books/5/

{
    "price":170
}

Response

{
  "id":5,
  "title":"title",
  "author":"author",
  "price":"170.00",
  "published_date":"2026-07-08T12:50:33.721511Z"
}

πŸ“ Project Structure

REST_API_Framework/
β”‚
β”œβ”€β”€ REST_MAIN/
β”‚   β”œβ”€β”€ migrations/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ admin.py
β”‚   β”œβ”€β”€ apps.py
β”‚   β”œβ”€β”€ models.py
β”‚   β”œβ”€β”€ stabilizer.py
β”‚   β”œβ”€β”€ tests.py
β”‚   β”œβ”€β”€ views.py
β”‚
β”œβ”€β”€ db.sqlite3
β”œβ”€β”€ manage.py
β”œβ”€β”€ README.md 
└── requirements.txt

πŸš€ Future Improvements

  • Swagger Documentation
  • API Versioning
  • Docker Support
  • PostgreSQL
  • Redis Cache
  • Celery
  • Unit Testing
  • CI/CD Pipeline
  • Production Deployment

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

Developer Rayhan

Full Stack Developer

Connect With Me

🌐 Portfolio

GitHub

https://github.com/iamdeveloperrayhan

LinkedIn

https://linkedin.com/in/iamdeveloperrayhan

Facebook

https://facebook.com/iamdeveloperrayhan

Email

iamdeveloperrayhan@gmail.com

⭐ Support

If you like this project,

⭐ Star this repository

Fork it

Share it


πŸ“„ License

This project is licensed under the MIT License.

About

A backend REST API developed using Django and Django REST Framework (DRF) with secure authentication, Searching, Filtering, Ordering, CRUD operations, and clean API design for modern web applications.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages