"Great APIs are not just functional—they're intuitive, consistent, and a pleasure to use."
Welcome to the API Design documentation hub for CleanArchitecture.ApiTemplate. This guide serves as your starting point to understand how this project implements RESTful API best practices, versioning strategies, and comprehensive API documentation.
?? What You'll Find Here:
- Complete RESTful API design principles
- API versioning and backward compatibility strategies
- Request/response contract examples
- Error handling patterns
- Performance optimization techniques
- Security best practices for APIs
- OpenAPI/Swagger documentation
- What is RESTful API Design?
- Why This Implementation Matters
- API Status
- Documentation Structure
- Getting Started
- Quick Reference
- API Design Principles
- Related Documentation
- Contact & Support
RESTful API Design provides:
- ? Resource-based architecture - URLs represent resources, not actions
- ? HTTP method semantics - GET, POST, PUT, DELETE, PATCH
- ? Stateless communication - Each request contains all necessary information
- ? Standard status codes - 200 OK, 201 Created, 400 Bad Request, etc.
- ? Consistent response formats - JSON with predictable structure
API Versioning ensures:
- ? Backward compatibility - Old clients continue to work
- ? Graceful evolution - New features without breaking changes
- ? Clear deprecation path - Phased retirement of old versions
This project demonstrates production-ready API design with .NET 8 and ASP.NET Core.
This implementation demonstrates:
| Challenge | Solution in This Project |
|---|---|
| "How do I design consistent APIs?" | Complete REST principles with resource naming conventions |
| "How do I version my API?" | URL-based versioning (v1, v2) with backward compatibility |
| "How do I document my API?" | Swagger/OpenAPI with comprehensive examples |
| "How do I handle errors consistently?" | Standardized error responses with ProblemDetails |
| "How do I optimize API performance?" | Caching strategies, async patterns, compression |
- ?? Production-Ready - RESTful design with versioning and documentation
- ??? Maintainable - Clear patterns make extending APIs straightforward
- ?? Testable - Well-defined contracts enable comprehensive testing
- ?? Self-Documenting - Swagger UI provides interactive documentation
- ?? Scalable - Caching and async patterns support high traffic
CleanArchitecture.ApiTemplate API v1 (100% Complete)
??? Authentication/ [? 3 endpoints - Login, Logout, Token]
??? Sample Data/ [? 4 endpoints - CRUD operations]
??? Token Blacklist Admin/ [? 3 endpoints - Status, Stats, Health]
??? Versioning/ [? URL-based (v1)]
??? OpenAPI/Swagger/ [? Interactive documentation]
??? Error Handling/ [? ProblemDetails standard]
| Component | Status | Key Features |
|---|---|---|
| REST Principles | ? 100% | Resource-based URLs, HTTP method semantics, stateless |
| Versioning | ? 100% | URL-based v1, backward compatibility, deprecation strategy |
| Documentation | ? 100% | Swagger/OpenAPI, interactive UI, code examples |
| Error Handling | ? 100% | ProblemDetails, consistent structure, HTTP status codes |
| Security | ? 100% | JWT authentication, rate limiting, CORS, security headers |
| Performance | ? 100% | Caching, async/await, compression, pagination ready |
| Testing | ? 100% | Complete test coverage, Swagger testing, Postman examples |
1. API_DESIGN_GUIDE.md - ?? START HERE - Complete API Design Guide
Your comprehensive reference for API design principles and implementation.
What's Inside:
- ? RESTful API design principles
- ? HTTP methods and status codes
- ? Resource naming conventions
- ? URL structure and query parameters
- ? API versioning strategy (URL-based v1)
- ? Request/response formats (JSON)
- ? Error handling with ProblemDetails
- ? Pagination patterns (ready for implementation)
- ? Caching strategies (Memory + Distributed)
- ? Performance optimization techniques
- ? Security best practices
- ? CORS configuration
- ? Rate limiting setup
- ? Swagger/OpenAPI integration
When to Read: Start here to understand complete API design philosophy and implementation.
File Size: 48 KB - Comprehensive guide
2. API_CONTRACTS_EXAMPLES.md - Request/Response Examples
Real-world examples of all API endpoints with complete request/response contracts.
What's Inside:
- ? Authentication endpoints (Login, Logout, Token generation)
- ? Sample data endpoints (GET, POST, PUT, DELETE)
- ? Token blacklist admin endpoints
- ? Request body examples (JSON)
- ? Response body examples (Success & Error)
- ? HTTP status codes for each scenario
- ? Header examples (Authorization, Content-Type)
- ? Query parameter examples
- ? Error response formats
- ? cURL command examples
When to Read: After understanding principles, use this as a reference for specific endpoint contracts.
File Size: 21 KB - Practical examples
Day 1: Understand API Design
- ?? Read this README (you're here!)
- ?? Read API_DESIGN_GUIDE.md - Complete principles
- ?? Review REST principles and HTTP semantics
Day 2: Explore Endpoints
- ?? Read API_CONTRACTS_EXAMPLES.md - All endpoints
- ?? Run the application:
dotnet run - ?? Open Swagger:
https://localhost:7178/swagger - ? Test endpoints interactively
Day 3: Test APIs
- ?? Review API Testing Guide
- ?? Test authentication flow (login, protected endpoints, logout)
- ?? Try all CRUD operations
- ?? Test error scenarios
Quick Assessment Path:
- ? API_DESIGN_GUIDE.md - Design principles and patterns
- ? API_CONTRACTS_EXAMPLES.md - Endpoint contracts
- ? API Testing Guide - Testing approach
- ? Swagger UI - Interactive documentation
Focus Areas:
- RESTful resource design (URLs, HTTP methods)
- Versioning strategy (URL-based v1)
- Error handling (ProblemDetails standard)
- Performance optimization (caching, async)
- Security patterns (JWT, rate limiting)
Evaluation Checklist:
- ?? API_DESIGN_GUIDE.md - API maturity and standards
- ?? API_CONTRACTS_EXAMPLES.md - Contract completeness
- ?? API Testing Guide - Test coverage
- ?? API Security Guide - Security posture
Team Onboarding:
- Use API_DESIGN_GUIDE for design standards
- Use API_CONTRACTS_EXAMPLES as reference for new endpoints
- Use Swagger UI for interactive exploration
- Review testing guide for quality assurance
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/api/v1/auth/login |
POST | ? No | User login with CQRS |
/api/v1/auth/token |
GET | ? No | Quick token generation |
/api/v1/auth/logout |
POST | ? Yes | Secure logout with blacklisting |
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/api/v1/sample |
GET | ? Yes | Get all sample data |
/api/v1/sample/{id} |
GET | ? Yes | Get specific item |
/api/v1/sample |
POST | ? Yes (Admin) | Create new item |
/api/v1/sample/admin |
GET | ? Yes (Admin) | Admin-only endpoint |
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/api/v1/token-blacklist/status |
GET | ? Yes | Check token status |
/api/v1/token-blacklist/stats |
GET | ? Yes (Admin) | System statistics |
/api/v1/token-blacklist/health |
GET | ? No | Health check |
Total: 10 documented endpoints
| Code | Meaning | When Used |
|---|---|---|
| 200 OK | Success | Successful GET, PUT |
| 201 Created | Resource created | Successful POST |
| 204 No Content | Success, no body | Successful DELETE |
| 400 Bad Request | Client error | Invalid input, validation errors |
| 401 Unauthorized | Not authenticated | Missing/invalid token |
| 403 Forbidden | Not authorized | Insufficient permissions |
| 404 Not Found | Resource missing | Invalid ID, endpoint not found |
| 429 Too Many Requests | Rate limited | Exceeded request limit |
| 500 Internal Server Error | Server error | Unexpected server error |
Current: v1 (URL-based)
/api/v1/auth/login/api/v1/sample
Future: v2 (when needed)
/api/v2/auth/login/api/v2/sample
Benefits:
- ? Clear version in URL
- ? Easy to test multiple versions
- ? Clients explicitly choose version
- ? No breaking changes to existing clients
? Good: /api/v1/users
? Bad: /api/v1/getUsers
? Good: /api/v1/users/{id}
? Bad: /api/v1/getUserById
? Good: /api/v1/auth/login
? Bad: /api/v1/doLogin
GET /api/v1/users ? List all users
GET /api/v1/users/{id} ? Get specific user
POST /api/v1/users ? Create new user
PUT /api/v1/users/{id} ? Update entire user
PATCH /api/v1/users/{id} ? Update partial user
DELETE /api/v1/users/{id} ? Delete user
/api/v1/users?page=1&pageSize=20 ? Pagination
/api/v1/users?sortBy=name&order=asc ? Sorting
/api/v1/users?status=active ? Filtering
/api/v1/users?search=john ? Search
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "Bad Request",
"status": 400,
"detail": "Username is required",
"instance": "/api/v1/auth/login",
"errors": {
"Username": ["The Username field is required."]
}
}- ? Resources represented by nouns (not verbs)
- ? HTTP methods express actions
- ? Stateless requests
- ? Hierarchical URL structure
- ? HATEOAS (ready for implementation)
- ? Predictable URL patterns
- ? Standard HTTP status codes
- ? Uniform error responses
- ? Consistent naming conventions
- ? Same authentication mechanism across all endpoints
- ? JWT Bearer authentication
- ? Role-based authorization (User, Admin)
- ? Rate limiting (60 req/min per IP)
- ? CORS configuration
- ? Security headers (XSS, Clickjacking protection)
- ? Caching strategies (Memory + Distributed)
- ? Async/await throughout
- ? Compression enabled
- ? Pagination ready
- ? Response time logging
- ? Swagger/OpenAPI integration
- ? Interactive testing UI
- ? Request/response examples
- ? Authentication flow documented
- ? Error scenarios covered
- API Testing Guide - Complete endpoint testing
- Testing Index - All testing documentation
- Authentication Testing - Security testing
- Authentication & Authorization Hub - Complete security documentation
- API Security Guide - Security implementation
- JWT CQRS Architecture - Auth architecture
- Clean Architecture Hub - Complete architecture documentation
- Application Layer Guide - CQRS implementation
- Presentation Layer Guide - API controllers
- Deployment README - All deployment options
- Azure App Service Guide - Cloud deployment
- Docker Deployment - Containerization
- ? Use nouns for resources, not verbs
- ? Keep URLs simple and predictable
- ? Use HTTP methods correctly
- ? Return appropriate status codes
- ? Version your API from day one
- ? Implement caching for read-heavy endpoints
- ? Use async/await for I/O operations
- ? Enable response compression
- ? Implement pagination for large datasets
- ? Monitor and log response times
- ? Always use HTTPS in production
- ? Validate all input
- ? Implement rate limiting
- ? Use proper authentication/authorization
- ? Keep dependencies updated
- ? Document all endpoints
- ? Provide request/response examples
- ? Include error scenarios
- ? Keep Swagger UI updated
- ? Document breaking changes clearly
CleanArchitecture.ApiTemplate demonstrates production-ready API design with:
? RESTful architecture - Resource-based URLs, HTTP method semantics
? API versioning - URL-based v1 with backward compatibility
? Comprehensive documentation - Swagger/OpenAPI with interactive UI
? Standardized error handling - ProblemDetails with consistent structure
? Security - JWT authentication, rate limiting, CORS
? Performance - Caching, async patterns, compression
? Testing - Complete test coverage with Swagger and Postman examples
? Best practices - Following ASP.NET Core and REST conventions
This is not a tutorial project—it's a production implementation showcasing API design excellence in action.
We're here to support you! Whether you have questions, found an issue, or need assistance with API implementation, here's how to reach us:
| Contact Method | Details |
|---|---|
| softevolutionsl@gmail.com | |
| GitHub | @dariemcarlosdev |
| Project Repository | CleanArchitecture.ApiTemplate |
| Issues & Bug Reports | GitHub Issues |
- ? Check API_DESIGN_GUIDE.md - Comprehensive principles
- ? Review API_CONTRACTS_EXAMPLES.md - Real examples
- ? Test with Swagger UI:
https://localhost:7178/swagger - ? Search existing GitHub Issues
- ? Open a new issue with specific questions
- ? Review code examples in this documentation
- ? Check related guides (Testing, Security, Architecture)
- ? See actual implementation:
Presentation/Controllers/v1/ - ? Check similar implementations in other endpoints
- ? Contact via email for detailed assistance
- ?? Verify the issue with latest code
- ?? Check if already reported in GitHub Issues
- ?? Include: Steps to reproduce, expected vs actual behavior, environment details
- ?? Provide relevant logs or error messages
- ?? Submit via GitHub Issues
- ?? Check roadmap and existing feature requests
- ?? Describe the use case and expected behavior
- ?? Explain how it benefits the API design
- ?? Submit via GitHub Issues with "Feature Request" label
Found something unclear or missing in the documentation?
- Typos or errors: Open a GitHub Issue or submit a Pull Request
- Missing examples: Let us know what examples would be helpful
- Improvement suggestions: We welcome all feedback to make docs better
- New topics: Suggest additional topics you'd like to see covered
Interested in contributing to CleanArchitecture.ApiTemplate?
- ? Star the repository
- ?? Fork the project
- ?? Make your changes
- ? Ensure all tests pass
- ?? Update documentation if needed
- ?? Submit a Pull Request
Contribution Guidelines:
- Follow existing code style and conventions
- Write clear commit messages
- Update relevant documentation
- Add tests for new features
- Ensure backwards compatibility
| Need | Resource |
|---|---|
| Quick Start | Getting Started |
| API Reference | Quick Reference |
| Testing Help | API Testing Guide |
| Security Help | API Security Guide |
| Architecture Help | Clean Architecture Hub |
| Deployment Help | Deployment README |
| Report Issue | GitHub Issues |
- Discussions: Use GitHub Discussions for general questions and community interaction
- Best Practices: Share your API design patterns and learnings
- Showcase: Share projects built using CleanArchitecture.ApiTemplate patterns
- Feedback: Help us improve by sharing your experience
- Watch the repository for updates and new releases
- Star to show support and stay informed
- Follow @dariemcarlosdev for project updates
| Type | Expected Response |
|---|---|
| Critical Bugs | Within 24-48 hours |
| General Questions | Within 2-3 business days |
| Feature Requests | Within 1 week for initial feedback |
| Documentation Issues | Within 1-2 business days |
Note: This is an open-source project maintained by volunteers. Response times may vary.
This project is open source. Please review the license terms before using in production.
Contact for:
- Commercial support inquiries
- Custom implementation assistance
- Training and workshops
- Enterprise consulting
?? Email: softevolutionsl@gmail.com
Last Updated: January 2025
Maintainer: Dariemcarlos
Project: CleanArchitecture.ApiTemplate
Status: ? Production-Ready
Version: 1.0.0 - Complete API Design Hub
Happy API Designing! ??