Skip to content

A Spring Boot backend for a blogging platform with features like: βœ… Create, update, delete, and fetch blogs πŸ“ βœ… AI-powered blog summarization using Hugging Face πŸ€– βœ… Pagination & sorting support for fetching blogs πŸ“„ βœ… Role-based authentication with JWT πŸ” βœ… Comments system for user engagement πŸ’¬

Notifications You must be signed in to change notification settings

Devansh-ds/BlogApplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Blog Application - Spring Boot Backend

A backend-only blog application built with Spring Boot. It supports JWT authentication, image storage in MySQL (BLOB with compression & decompression), and AI-powered summarization using Hugging Face.

πŸš€ Features

βœ… User Authentication (JWT-based login & registration)
βœ… Create, Update, Delete, and Fetch Blogs
βœ… AI-Powered Blog Summarization (via facebook/bart-large-cnn)
βœ… Pagination & Sorting (for efficient blog retrieval)
βœ… Blog Image Uploads (Stored in MySQL as compressed BLOBs)
βœ… Comments System (Users can comment on blogs)


πŸ›  Tech Stack

  • Spring Boot 3.4.0 - Backend framework
  • Spring Security & JWT - Authentication & Authorization
  • Spring Data JPA & MySQL - Database & ORM
  • WebClient - External API calls (Hugging Face)
  • Docker - Deployment (Planned)

πŸ“¦ Setup & Installation

1️⃣ Clone the Repository

git clone https://github.com/Devansh-ds/BlogApplication cd BlogApplication

2️⃣ Configure Environment Variables

Edit the application.yml file and set:

URL=jdbc:mysql://localhost:3306/<your-schema-name> USERNAME= <your-username> PASSWORD= <your-passowrd> HUGGINGFACE_API_KEY= Bearer <hugging-face-token> 

3️⃣ Run the Application

mvn spring-boot:run

or

docker-compose up --build

πŸ”— API Endpoints

Authentication

  • POST /auth/register β†’ Register a new user
  • POST /auth/login β†’ Authenticate & get JWT
  • POST /auth/logout β†’ To logout from the application

Blog Management

  • POST /api/v1/blog β†’ Create a new blog
  • GET /api/v1/blog β†’ Fetch all blogs (with pagination & sorting)
  • GET /api/v1/blog/{id} β†’ Get a blog by ID
  • GET /api/v1/blog/{id}/summarize β†’ Get AI-generated summary
  • DELETE /api/v1/blog/{id}/ β†’ Delete blog by blogId
  • PUT /api/v1/blog/{id}/ β†’ Update blog by blogId

Comments

  • POST /api/v1/comment/blog/{id} β†’ Add a comment
  • GET /api/v1/comment/blogs/{id} β†’ Get all comments for a blog
  • GET /api/v1/comment/{id} β†’ Get comment by comment Id
  • GET /api/v1/comment/{id} β†’ Get comment by comment Id
  • PUT /api/v1/comment/{id} β†’ Update comment made by the user
  • DELETE /api/v1/comment/{id} β†’ Delete comment made by the user

πŸ–Ό Blog Image Storage (BLOB in MySQL)

  • Images are stored in MySQL as BLOB (byte[]).
  • Compression is applied before saving, and decompression happens while fetching.

πŸš€ Future Enhancements

  • Role-Based Access Control (RBAC) (Currently, Admin role is not implemented)
  • Swagger API Documentation

πŸ“„ License

This project is open-source under the MIT License.


About

A Spring Boot backend for a blogging platform with features like: βœ… Create, update, delete, and fetch blogs πŸ“ βœ… AI-powered blog summarization using Hugging Face πŸ€– βœ… Pagination & sorting support for fetching blogs πŸ“„ βœ… Role-based authentication with JWT πŸ” βœ… Comments system for user engagement πŸ’¬

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published