An open API service indexing awesome lists of open source software.

https://github.com/akshayjadhav4/thread

Spring Boot REST API's for thread social media application
https://github.com/akshayjadhav4/thread

rest-api spring-boot

Last synced: 2 months ago
JSON representation

Spring Boot REST API's for thread social media application

Awesome Lists containing this project

README

          

# Thread Clone API

A Spring Boot-based REST API that implements core functionality similar to Threads (by Meta) application.

## Technologies Used

- Java 17
- Spring Boot 3.3.5
- PostgreSQL
- Redis
- Apache Kafka
- JWT Authentication
- Maven

## Features

- User authentication and authorization
- Thread creation and management
- Like/Unlike functionality with Redis caching
- Follower/Following system
- Hashtag support
- Pagination support

## Prerequisites

- Java 17 or higher
- Maven
- PostgreSQL
- Redis Server
- Kafka Server

## Configuration

The application can be configured through `application.properties`. Key configurations include:

```properties
# Database Configuration
spring.datasource.url=your_database_url
spring.datasource.username=your_username
spring.datasource.password=your_password

# JWT Configuration
auth.token.expirationInMils=
auth.token.jwtSecret=

# Kafka Configuration
spring.kafka.bootstrap-servers=
spring.kafka.consumer.group-id=

# Redis Configuration
spring.redis.host=
spring.redis.port=

# API Configuration
api.prefix=/api/v1
```

## Project Structure

- `config/` - Configuration classes for Spring Security, Redis, Kafka, etc.
- `controller/` - REST endpoints
- `model/` - Entity classes
- `service/` - Business logic
- `repository/` - Data access layer
- `security/` - Security configurations and JWT implementation
- `dto/` - Data Transfer Objects
- `mapper/` - Object mapping configurations

## API Endpoints

### Authentication
- `POST /api/v1/auth/register` - Register new user
- `POST /api/v1/auth/login` - Login user

### Threads
- `POST /api/v1/thread/` - Create new thread
- `GET /api/v1/thread/{threadId}` - Get thread by ID
- `GET /api/v1/thread/all` - Get all threads (paginated)
- `GET /api/v1/thread/user/{userId}` - Get user's threads
- `GET /api/v1/thread/hashtag/{hashtag}` - Get threads by hashtag
- `PUT /api/v1/thread/{threadId}` - Update thread
- `DELETE /api/v1/thread/{threadId}` - Delete thread

## Building and Running

1. Clone the repository
2. Configure application.properties with your database credentials
3. Start Redis server
4. Start Kafka server
5. Run the application:

```bash:Readme.md
./mvnw spring-boot:run
```