Prerequisites
Before you begin, ensure you have:- JDK 21 installed and configured
- PostgreSQL running on port 5432
- Maven (or use the included Maven wrapper)
Quick Setup
Configure Environment Variables
Set up the required environment variables:
The
JWT_SECRET must be a Base64-encoded string of at least 256 bits. The JWT_EXPIRATION_MS is in milliseconds (86400000 = 24 hours).Get Your First JWT Token
Now that the service is running, let’s authenticate and get a JWT token.On first run with
spring.jpa.hibernate.ddl-auto=update, the database schema will be created automatically. You may need to insert a test user into the database or use your database initialization script.Login Request
Send a POST request to the login endpoint:cURL
Response
You’ll receive a JWT token in the response:Use the Token
Include the token in subsequent requests:Next Steps
Installation Guide
Detailed setup instructions including database initialization and production configuration
API Reference
Complete API documentation for all endpoints
Authentication
Learn about JWT tokens, roles, and permissions
Architecture
Understand the hexagonal architecture and project structure
Common Issues
Connection refused to PostgreSQL
Connection refused to PostgreSQL
Ensure PostgreSQL is running:Verify your connection settings match your PostgreSQL configuration.
JWT Secret Key Error
JWT Secret Key Error
If you see errors related to JWT secret key strength:
- The key must be Base64-encoded
- Minimum length: 256 bits (32 bytes)
- Generate a secure key:
401 Unauthorized on Login
401 Unauthorized on Login
What’s Happening Under the Hood
When you start the service:- Database Schema Creation: Hibernate creates the required tables based on JPA entities
- Security Configuration: Spring Security filters are initialized with JWT authentication
- API Documentation: Swagger UI is configured at
/swagger-ui.html - Audit System: AOP aspects are registered for automatic activity logging
- Domain: Pure business logic with no framework dependencies
- Application: Use case implementations and DTOs
- Adapters: REST controllers (in) and JPA repositories (out)