Skip to content

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌐 Social Media Platform — Enterprise Spring Boot Backend

License: MIT Java Spring Boot Spring Security PostgreSQL Hibernate

An enterprise-grade, relational backend engine built with Java and Spring Boot, engineered to power modern social networking features. The platform exposes robust RESTful APIs for stateless JWT authentication, social graph operations (follow/unfollow), media post publishing, threaded discussions, stories, reels, and peer-to-peer chat sessions.


✨ Architectural Highlights

  • 🔐 Spring Security & JWT: Configured custom security filter chains with stateless session management and JWT authentication tokens.
  • 📊 Relational Social Graph: Optimized PostgreSQL schemas with foreign-key constraints and indexing strategies designed for bi-directional graph traversals (followers, following, liked posts).
  • 🏗️ Domain-Driven Layering: Clean separation of concerns across Data Transfer Objects (DTOs), JPA Entities, Repository layers, business Services, and REST Controllers.
  • 💬 Real-Time Messaging & Chat: Integrated chat and direct message endpoints supporting threaded message persistence.
  • 📱 Multimedia Feeds: Dedicated subsystems for standard image/video posts, 24-hour stories, and algorithmic reels.

🛠️ Technology Stack

Layer Technologies
Language & Framework Java 17+, Spring Boot (Spring Web, Spring Data JPA)
Security & Auth Spring Security, JSON Web Tokens (JJWT), BCrypt Password Hashing
Database PostgreSQL, Hibernate ORM
Build Tool Apache Maven (mvnw wrapper included)
Client Frontend React.js & Redux (Repository: Social-frontend)

📡 RESTful API Reference

1. Authentication (/auth)

Method Endpoint Description
POST /auth/signup Register a new user account
POST /auth/signin Authenticate credentials and receive JWT

2. User & Social Graph (/api/users)

Method Endpoint Description
GET /api/users/profile Retrieve authenticated user profile
GET /api/users/{userId} Fetch public profile by user ID
PUT /api/users/update Update user metadata and bio
PUT /api/users/follow/{userId2} Follow or unfollow a user
GET /api/users/search?query=... Search users by name or username

3. Posts & Engagement (/api/posts)

Method Endpoint Description
POST /api/posts/user/{userId} Create a new multimedia post
GET /api/posts Retrieve global chronological post feed
GET /api/posts/{postId} Fetch post by unique ID
PUT /api/posts/like/{postId} Like or unlike a specific post
PUT /api/posts/save/{postId} Bookmark post to saved collection

4. Comments (/api/comments)

Method Endpoint Description
POST /api/comments/post/{postId} Post a comment on a target post
PUT /api/comments/like/{commentId} Like a specific comment

5. Stories & Reels (/api/story, /api/reels)

Method Endpoint Description
POST /api/story Publish an ephemeral story
GET /api/story/user/{userId} Fetch stories created by user
POST /api/reels Publish short-form video reel
GET /api/reels Retrieve reels stream

6. Chat & Messaging (/api/chats, /api/messages)

Method Endpoint Description
POST /api/chats Create or initiate a conversation
GET /api/chats/user Fetch active conversations for current user
POST /api/messages/chat/{chatId} Send a direct message within a chat
GET /api/messages/chat/{chatId} Retrieve chat message history

🚀 Quick Start Guide

Prerequisites

  • Java JDK: 17 or higher (java -version)
  • PostgreSQL: Running locally or via Docker (localhost:5432)
  • Maven: Bundled via ./mvnw

1. Database Setup

Ensure PostgreSQL is running and create the social database:

CREATE DATABASE social;

2. Configure Environment Properties

Edit src/main/resources/application.properties (or copy from application.properties.example):

spring.application.name=social-app
server.port=8080

spring.datasource.url=jdbc:postgresql://localhost:5432/social
spring.datasource.username=postgres
spring.datasource.password=postgres
spring.datasource.driver-class-name=org.postgresql.Driver

spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true

3. Build & Run the Backend

Using the included Maven wrapper:

# Clean and compile
./mvnw clean install -DskipTests

# Launch the Spring Boot application
./mvnw spring-boot:run

The server will initialize and begin listening for API requests on http://localhost:8080.


💻 Frontend Application

The companion client application built with React.js and Redux is available at: 👉 rishab2211/Social-frontend


📄 License

This project is open-source under the MIT License.

About

Backend of a social media app - made with JAVA & Spring boot

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages