Blog Postings (Using Django Rest Framework + JavaScript)

Blog Posting Platform with Django and JavaScript

This blog posting platform is a full-stack web application built using Django REST Framework (DRF) for the backend and JavaScript, HTML, and CSS for the frontend. The platform allows users to register, log in, create, read, update, and delete blog posts, ensuring secure access through JWT authentication.

This project is ideal for bloggers, developers, and anyone looking for a scalable API-based blogging system with seamless frontend and backend integration.

Key Features:

✅ User Authentication & JWT Security – Implements JWT authentication to ensure secure login, session management, and automatic logout after token expiration.
✅ Blog Management System – Users can create, edit, delete, and view blog posts. Blogs are synced between the frontend and backend in real-time.
✅ Frontend Functionalities – Users can log in, register, add new blogs, read more blogs, select categories, and search blogs using a dynamic search bar.
✅ Data Synchronization – Blogs created in the backend are visible in the frontend, and blogs created in the frontend are automatically saved in the backend.
✅ User Restrictions – Only logged-in users can view blogs. If the authentication token expires, the user must re-login.
✅ Role-Based Access – Unauthorized users cannot post or edit blogs without authentication.

Technology Stack

Backend:

• Django REST Framework (DRF) – For building the API endpoints.
• SQLite – Database for storing user credentials and blog posts.
• JWT Authentication – Secure token-based authentication.

Frontend:

• JavaScript – Handles UI interactions and API requests.
• HTML & CSS – Provides a clean and responsive design.
• Fetch API – For seamless communication with the backend.

Workflow Overview

1️. Django Setup & API Creation

Install Django & DRF, set up models for User and BlogPost.
Create serializers to convert data into JSON format.
Define API views and endpoints for CRUD operations.

Outcome: Backend ready with API endpoints for user and blog management.

2️. JWT Authentication Integration

Use djangorestframework-simplejwt for secure authentication.
Implement login & registration with JWT token generation.
Protect API routes to ensure only authenticated users can access certain features.

Outcome: Users must log in to interact with the platform.

3️. Frontend-Backend Connection

Use Fetch API to retrieve and display blog posts dynamically.
Implement login, registration, blog posting, and fetching from API.
Store JWT tokens in local storage for authentication.

Outcome: Seamless data exchange between frontend and backend.

4️.User Authorization & Token Handling

Restrict blog access to logged-in users.
Implement token expiration & auto logout after session expiry.
Users need to re-login after the token expires.

Outcome: Secure access control with session handling.

5️. Search & Filter Blogs

Implement search bar to find blogs by title/content.
Allow users to filter blogs by categories.

Outcome: Easy navigation and discovery of relevant blogs.
DRF-Filter-blog

Use Cases

Personal Blogging Platform – A simple and secure blog management system.
Content Management Systems – Manage, categorize, and update content easily.
API-Based Applications – Serves as a backend solution for blog-based apps.

Video Tutorial

Link: