https://github.com/mdmazidulislam26/sm-web
The **SM-WEB** is an open-source initiative to create a fully functional social media application backend using Spring Boot. It is tailored for developers who want to learn about modern backend development practices, including authentication, database integration, and RESTful API design.
https://github.com/mdmazidulislam26/sm-web
globalexceptionhandler jpa jpa-hibernate lombok mysql-database spring-boot spring-security-jwt
Last synced: about 2 months ago
JSON representation
The **SM-WEB** is an open-source initiative to create a fully functional social media application backend using Spring Boot. It is tailored for developers who want to learn about modern backend development practices, including authentication, database integration, and RESTful API design.
- Host: GitHub
- URL: https://github.com/mdmazidulislam26/sm-web
- Owner: mdmazidulislam26
- Created: 2024-12-20T10:47:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-19T14:14:13.000Z (over 1 year ago)
- Last Synced: 2025-03-13T07:44:00.343Z (about 1 year ago)
- Topics: globalexceptionhandler, jpa, jpa-hibernate, lombok, mysql-database, spring-boot, spring-security-jwt
- Language: Java
- Homepage:
- Size: 161 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Introduction to Java Spring Boot
---
This repository contains the source code for a **Full-Stack Social Media Web Application**
built using **Java Spring Boot** for the backend.
The project is designed to provide social media features, including user authentication, posts, comments, reels, messaging, and more.
---
## Features
- **User Authentication**
- Sign up and login with JWT-based authentication.
- Secure password encryption with BCrypt.
- **Posts Management**
- Create, update, delete, and view posts.
- Like and save posts.
- **Comments**
- Add comments to posts.
- Like comments.
- **Reels and Stories**
- Add, view, and manage reels and stories.
- **Messaging and Chat**
- Send and receive messages in real-time.
- Manage chatrooms.
- **Follow System**
- Follow and unfollow other users.
---
## Technologies Used
### Backend
- **Java 17**
- **Spring Boot 3.3.6**
- Spring Security
- Spring Data JPA
- Spring Web
- Spring Boot DevTools
- **JWT** for token-based authentication.
- **Lombok** for boilerplate code reduction.
- **MySQL** as the relational database.
### Dependencies
- `spring-boot-starter-web`
- `spring-boot-starter-security`
- `spring-boot-starter-data-jpa`
- `mysql-connector-j`
- `jjwt-api`, `jjwt-impl`, `jjwt-jackson`
- `lombok`
---
## Installation and Setup
### Prerequisites
1. **Java Development Kit (JDK)** version 17 or higher.
2. **MySQL Server** installed and running.
3. **Maven** installed.
### Steps
1. Clone the repository:
```bash
git clone https://github.com/your-username/mazidul-social-media.git
cd mazidul-social-media
```
2. Set up the MySQL database:
- Create a database named `social_media`.
- Update the `application.properties` file with your MySQL credentials:
```properties
spring.datasource.url=jdbc:mysql://localhost:3306/social_media
spring.datasource.username=YOUR_USERNAME
spring.datasource.password=YOUR_PASSWORD
spring.jpa.hibernate.ddl-auto=update
```
3. Build and run the application:
```bash
mvn clean install
mvn spring-boot:run
```
4. The application will run at `http://localhost:8080`.
---
## API Endpoints
### Authentication
- **POST** `/auth/signup` - Register a new user.
- **POST** `/auth/signin` - Login and receive a JWT token.
### User
- **GET** `/api/users` - Fetch all users.
- **GET** `/api/users/{userId}` - Fetch a user by ID.
- **PUT** `/api/users` - Update user details.
- **PUT** `/api/users/follow/{userId}` - Follow a user.
### Posts
- **POST** `/api/posts` - Create a new post.
- **GET** `/api/posts` - Get all posts.
- **GET** `/api/posts/{postId}` - Get a specific post by ID.
- **DELETE** `/api/posts/{postId}` - Delete a post.
- **PUT** `/api/posts/like/{postId}` - Like a post.
### Comments
- **POST** `/api/comments/post/{postId}` - Add a comment to a post.
- **PUT** `/api/comments/like/{commentId}` - Like a comment.
### Chats
- **POST** `/api/chats` - Create a new chat.
- **GET** `/api/chats` - Get all chats for the logged-in user.
### Messages
- **POST** `/api/messages/chat/{chatId}` - Send a message in a chat.
- **GET** `/api/messages/chat/{chatId}` - Get all messages in a chat.
---