Back to projects
Spring Social Media Blog API

Spring Social Media Blog API

/ April 25, 2025

🌱 Spring Social Media Blog API

This is a backend-only micro-blogging API built in Java using the Spring framework. It follows a 3-layer architecture (Controller, Service, Repository) and provides core social media functionality including user registration, login, and message handling.

🔧 Tech Stack

  • Java
  • Spring Boot
  • Spring MVC + Spring Data JPA
  • SQL (H2 or MySQL)
  • HTTP REST API

✅ Features

  • POST /register – Register a new user
  • POST /login – Login with username/password
  • POST /messages – Create a new message
  • GET /messages – View all messages
  • GET /messages/{messageId} – View message by ID
  • DELETE /messages/{messageId} – Delete a message
  • PATCH /messages/{messageId} – Edit message content
  • GET /accounts/{accountId}/messages – View all messages by a specific user

🗂 Structure

  • Controller – Handles HTTP endpoints using @RestController
  • Service – Contains business logic with @Service
  • Repository – Interfaces extending JpaRepository
  • Model – Entity classes for Account and Message
  • Database – Auto-configured and initialized via Spring with SQL schema

✅ Spring Features Used

  • Dependency injection with @Autowired
  • RESTful routing via Spring MVC
  • Automatic DB handling with Spring Data JPA
  • Exception handling and validation