Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ForoHub — Forum REST API 🗂

A complete backend REST API for a forum platform, built with Java and Spring Boot 3. Features stateless authentication, full CRUD operations, and containerized deployment.


🛠 Tech Stack

Java Spring Boot Spring Security MySQL Docker JWT


✨ Features

  • 🔐 Stateless authentication with Spring Security + JWT
  • 📋 Full CRUD for topics, replies, and users
  • 🗄 Relational schema with 5 entities — users, profiles, courses, topics, replies
  • 🔄 Versioned database migrations with Flyway
  • 📦 Containerized with Docker & Docker Compose
  • 📖 API documentation with OpenAPI 3 / Swagger UI

📁 Project Structure

src/
├── main/
│   ├── java/com/forohub/
│   │   ├── controller/      # REST endpoints
│   │   ├── service/         # Business logic
│   │   ├── repository/      # Data access layer
│   │   ├── model/           # Entities
│   │   ├── dto/             # Data Transfer Objects
│   │   └── security/        # JWT & Spring Security config
│   └── resources/
│       ├── db/migration/    # Flyway migrations
│       └── application.properties

⚙️ Getting Started

Prerequisites

  • Java 17+
  • Docker & Docker Compose
  • Maven

Run with Docker (recommended)

# Clone the repository
git clone https://github.com/AbrahamVC-coder/ChallengeForoHub.git
cd ChallengeForoHub

# Start the app and database
docker-compose up --build

The API will be available at http://localhost:8080

Run locally

# Configure your database in application.properties
# then run:
mvn spring-boot:run

🔑 Authentication

All endpoints except /auth/login require a Bearer token.

POST /auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "yourpassword"
}

Response:

{
  "token": "eyJhbGciOiJIUzI1NiJ9..."
}

Use the token in subsequent requests:

Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...

📌 Main Endpoints

Method Endpoint Description
POST /auth/login Authenticate and get JWT token
GET /topicos List all topics
POST /topicos Create a new topic
GET /topicos/{id} Get topic by ID
PUT /topicos/{id} Update a topic
DELETE /topicos/{id} Delete a topic
POST /respuestas Reply to a topic

📖 API Documentation

Once the app is running, access the interactive Swagger UI at:

http://localhost:8080/swagger-ui.html

👤 Author

Abraham Velázquez Carmona
LinkedIn · GitHub

Releases

Packages

Contributors

Languages