Your TailorCraft API now includes comprehensive Swagger/OpenAPI 3.0 documentation. This professional API documentation will be perfect for your job applications and makes it easy for developers to understand and test your API.
http://localhost:4000/api-docs
https://your-app-name.onrender.com/api-docs
Your Swagger documentation includes:
- Test all endpoints directly from the browser
- No need for Postman or cURL
- Real-time request/response examples
- ✅ 9 Tagged Sections: Authentication, Profile, Bookings, Payments, Designs, Guides, Reviews, Admin, Health
- ✅ 40+ Endpoints: All fully documented with:
- Request parameters
- Request body schemas
- Response schemas
- Error responses
- Authentication requirements
- Data Models: User, Booking, Payment, Design, Guide, Review
- Request DTOs: CreateBookingRequest, UpdateProfileRequest, etc.
- Response Types: AuthResponse, PaymentStats, AdminStats
- Error Schemas: Detailed error responses with status codes
- JWT Bearer token authentication
- Clear instructions on how to authenticate
- Role-based access control documentation
- JSON request/response examples for every endpoint
- Sample data values
- Multiple error scenario examples
- Navigate to
/api-docs - Click on "POST /auth/login" or "POST /auth/register"
- Click "Try it out"
- Enter your credentials
- Click "Execute"
- Copy the
accessTokenfrom the response
- Click the "Authorize" button at the top of the page
- Enter:
Bearer <your-access-token> - Click "Authorize"
- Click "Close"
Now you can test all protected endpoints!
- Select any endpoint
- Click "Try it out"
- Fill in the required parameters
- Click "Execute"
- View the response below
POST /auth/register- Register new userPOST /auth/verify-otp- Verify OTPPOST /auth/login- User loginPOST /auth/refresh-token- Refresh JWT tokenPOST /auth/forgot-password- Request password resetPOST /auth/reset-password- Reset password with OTPPOST /auth/logout- User logout
GET /profile- Get user profilePATCH /profile- Update profilePOST /profile/upload- Upload profile image
POST /booking- Create bookingGET /booking- Get user bookingsGET /booking/{id}- Get booking by IDPATCH /booking/{id}/status- Update status (Admin)GET /booking/admin/all- Get all bookings (Admin)
POST /payment/{id}- Initialize paymentGET /payment/verify- Verify paymentPOST /payment/webhook- Paystack webhookGET /payment/history- Payment historyGET /payment/all-payment- All payments (Admin)GET /payment/stats- Payment statistics (Admin)GET /payment/{paymentId}- Get payment details
GET /design- Get all designsPOST /design- Create design (Admin)GET /design/{id}- Get design by IDPATCH /design/{id}- Update design (Admin)DELETE /design/{id}- Delete design (Admin)
GET /guide- Get all guidesPOST /guide- Create guide (Admin)GET /guide/{id}- Get guide by IDPATCH /guide/{id}- Update guide (Admin)DELETE /guide/{id}- Delete guide (Admin)
POST /review/{id}- Create reviewGET /review- Get all reviewsGET /review/admin- Admin reviews (Admin)
GET /client- Get all clients (Admin)GET /client/stats- Admin statistics (Admin)GET /client/{id}- Get client by ID (Admin)DELETE /client/{id}- Delete client (Admin)
GET /health- Health check
-
Professional API Design
- RESTful architecture
- Consistent naming conventions
- Proper HTTP status codes
- Comprehensive error handling
-
OpenAPI 3.0 Standard
- Industry-standard documentation
- Machine-readable API specification
- Easy integration with API tools
-
Security Best Practices
- JWT authentication
- Role-based access control (RBAC)
- Rate limiting
- Helmet security headers
-
Scalable Architecture
- Modular code structure
- Service-oriented design
- Separation of concerns
- TypeScript for type safety
-
Third-Party Integrations
- Paystack payment gateway
- Cloudinary image storage
- Email services (Resend)
- Redis caching
-
Automated Services
- Cron jobs for cleanup
- Email notifications
- Payment webhooks
- Delivery reminders
Your Swagger documentation is automatically available when you deploy:
No additional environment variables needed! The Swagger docs work out of the box.
If you have a custom domain, update the servers in src/config/swagger.config.ts:
servers: [
{
url: 'https://api.yourcompany.com/api/v1',
description: 'Production Server',
},
],You can export the OpenAPI specification for use in other tools:
Visit: http://localhost:4000/api-docs.json (automatically available)
- Postman: Import the OpenAPI spec
- Insomnia: Import the OpenAPI spec
- API Client Generators: Generate client SDKs
- Testing Tools: Automated API testing
Edit src/app.ts:
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec, {
customCss: '.swagger-ui .topbar { display: none }',
customSiteTitle: 'Your Custom Title',
customfavIcon: '/your-icon.ico',
}));Edit src/swagger/paths.yaml to add more examples, descriptions, or endpoints.
Edit src/config/swagger.config.ts to modify data models and schemas.
Take screenshots of:
- Welcome Page -
http://localhost:4000/ - Swagger UI Overview - Full API documentation page
- Authentication Section - Login/Register endpoints
- Schema Definitions - Show the data models
- Try It Out - Demonstrate the interactive testing
- Response Examples - Show successful API calls
- API Documentation:
/api-docs - Health Check:
/api/v1/health - Main Endpoint:
/
- Keep Documentation Updated: Update the YAML files when you add new endpoints
- Add Examples: Real-world examples make documentation more valuable
- Test Everything: Use the "Try it out" feature to verify all endpoints work
- Version Control: The OpenAPI spec serves as API version documentation
Your API is now production-ready with professional documentation! 🎉
Perfect for:
- Job applications
- Portfolio projects
- Client presentations
- Team collaboration
- API consumers