spring-boot-rest-api-standards

Solid

Provides REST API design standards and best practices for Spring Boot projects. Use when creating or reviewing REST endpoints, DTOs, error handling, pagination, security headers, HATEOAS and architecture patterns.

API & Backend 278 stars 32 forks Updated 5 days ago MIT

Install

View on GitHub

Quality Score: 91/100

Stars 20%
81
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Spring Boot REST API Standards ## Overview REST API design standards for Spring Boot covering URL design, HTTP methods, status codes, DTOs, validation, error handling, pagination, and security headers. ## When to Use - Creating REST endpoints and API routes - Designing DTOs and API contracts - Implementing error handling and validation - Setting up pagination and filtering - Configuring security headers and CORS - Reviewing REST API architecture ## Instructions ### To Build RESTful API Endpoints Follow these steps to create well-designed REST API endpoints: 1. **Design Resource-Based URLs** - Use plural nouns for resource names - Follow REST conventions: GET /users, POST /users, PUT /users/{id} - Avoid action-based URLs like /getUserList 2. **Implement Proper HTTP Methods** - GET: Retrieve resources (safe, idempotent) - POST: Create resources (not idempotent) - PUT: Replace entire resources (idempotent) - PATCH: Partial updates (not idempotent) - DELETE: Remove resources (idempotent) 3. **Use Appropriate Status Codes** - 200 OK: Successful GET/PUT/PATCH - 201 Created: Successful POST with Location header - 204 No Content: Successful DELETE - 400 Bad Request: Invalid request data - 404 Not Found: Resource doesn't exist - 409 Conflict: Duplicate resource - 500 Internal Server Error: Unexpected errors 4. **Create Request/Response DTOs** - Separate API contracts from domain entities - Use Java records or Lombok `@Dat...

Details

Author
giuseppe-trisciuoglio
Repository
giuseppe-trisciuoglio/developer-kit
Created
7 months ago
Last Updated
5 days ago
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category