Skip to content

chandrakiranbolla1/spring-blog-api

Β 
Β 

Repository files navigation

πŸš€ Spring Blog API

Welcome to Spring Blog API! This is a modern, secure, and scalable RESTful backend service for managing blog posts and user authentication, built with Spring Boot. The project is currently under active development and new features are coming soon.

🌱 Newcomers Welcome! We encourage developers of all experience levels to contribute. Whether you're new to open source or a seasoned pro, your ideas and code are valued here. Check out our CONTRIBUTING.md for easy ways to get started!

πŸ› οΈ Technologies Used

  • Java 24
  • Spring Boot 3.5
  • Spring Security
  • Spring Data JPA
  • Hibernate ORM
  • PostgreSQL
  • JWT (JSON Web Token)
  • Lombok
  • Spring Mail
  • Gradle
  • Docker & Docker Compose
  • JUnit 5
  • PgAdmin
  • Resilience4j (Rate Limiting & Circuit Breaker)

⚑ Getting Started

Prerequisites

  • Java 24
  • Docker (optional, for containerization)
  • Gradle

🚦 Setup

  1. Clone the repository:
    git clone <repository-url>
    cd spring-blog-api
  2. Build the project:
    ./gradlew build
  3. Run Docker:
    docker-compose up
  4. Use the API service on:
    http://localhost:8082/api/v1/
    

βš™οΈ Configuration

Edit src/main/resources/application.yml to configure database and other settings.

πŸ“– API Documentation

Interactive API documentation is available via Swagger UI.
Most requests require an Authorization: Bearer <JWT> header.

http://localhost:8082/api/v1/swagger-ui/index.html#/

Notes

  • Duplicate prevention is enforced by a unique database constraint (user_id, blog_id) and idempotent service logic.
  • The current user is resolved from the JWT claim uid.
  • Error codes:
    • 401 Unauthorized β€” missing/expired token
    • 404 Not Found β€” blog does not exist

πŸ›‘οΈ Rate Limiting & Circuit Breaker

This API implements robust rate limiting and circuit breaker patterns to protect against abuse and service failures:

Rate Limiting

  • Default API endpoints: 20 requests/60 seconds
  • Authentication endpoints: 5 requests/60 seconds

Circuit Breaker

  • Automatic database failure detection
  • Service degradation during outages
  • Graceful error responses (503 Service Unavailable)

Star History

Star History Chart

🀝 Contributing

See CONTRIBUTING.md for guidelines.

πŸ“„ License

This project is licensed under the MIT License.

🚧 Status

This project is in active development and not yet complete. Features and documentation may change.

About

πŸ€“ A simple blog REST API built with Java Spring Boot including features like JWTs, Spring Security, and so on.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 97.7%
  • HTML 2.2%
  • Dockerfile 0.1%