This guide walks you through running Auth Service on your local machine from a clean clone to an authenticated API call. By the end you will have PostgreSQL, MailHog, and Redpanda running in Docker, the service itself running on port 8080, and a valid JWT access token you can use to call protected endpoints. The whole flow takes under 5 minutes assuming Docker is already running.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ricardomb-tech/auth-service/llms.txt
Use this file to discover all available pages before exploring further.
Install prerequisites
Make sure the following tools are available on your machine before continuing:
Verify your Java version:
| Tool | Minimum version | Notes |
|---|---|---|
| Java | 21 | The Maven wrapper (./mvnw) downloads Maven automatically |
| Maven | 3.9+ | Only needed if you prefer your own Maven installation over ./mvnw |
| Docker + Docker Compose | Any recent version | Required for PostgreSQL, MailHog, and Redpanda |
Clone and configure environment variables
Clone the repository and copy the example environment file:Open
.env and set at minimum JWT_SECRET_CURRENT to a random 256-bit (32-byte) secret. All other values have working dev defaults:Start dependencies with Docker Compose
Start PostgreSQL 15, MailHog, and Redpanda in the background:This brings up three services defined in
Verify that all containers are healthy:
docker-compose.yml:| Service | Port | Purpose |
|---|---|---|
postgres | 5432 | Primary database; Flyway runs migrations on first startup |
mailhog | 1025 (SMTP), 8025 (Web UI) | Captures outgoing emails in dev so you can read verification tokens |
redpanda | 9092 | Kafka-compatible broker; staged for the transactional outbox (Epic 6) |
Open http://localhost:8025 in your browser to access the MailHog web UI. Every verification email sent by Auth Service will appear here — there is no real email delivery in dev mode.
Run the service
Start Auth Service using the Flyway automatically applies all pending migrations (The REST API is now available at
dev Spring profile, which picks up the application-dev.properties defaults and connects to the Docker Compose services:V1 through V4) on first startup. Watch for this line in the logs to confirm the service is ready:http://localhost:8080.Register, verify, and log in
Follow this three-request workflow to obtain a JWT access token.1. Register a new accountThe response is intentionally generic regardless of whether the email already exists (anti-enumeration):2. Retrieve the verification token from MailHogOpen http://localhost:8025 in your browser. You will see an email from Auth Service containing a verification token. Copy the token value from the email body.3. Verify your accountA successful response confirms the account is now 4. Log in and obtain tokensAuth Service returns an access token (JWT, 15-minute TTL) and an opaque refresh token (7-day TTL):5. Call a protected endpointPass the The response returns your account profile:
ACTIVE:accessToken in the Authorization header to call any protected route:Access tokens expire after 900 seconds (15 minutes). Use
POST /auth/refresh with your refreshToken to rotate it and receive a new access token without logging in again. If you present a refresh token that has already been used, Auth Service will revoke the entire token family — you will need to log in again.Next steps
- Read the Architecture overview to understand the Clean Architecture layers, JWT design decisions, and refresh token family rotation.
-
Configure Google and GitHub OAuth2 credentials in
.envand try the social login flow at/oauth2/authorization/googleor/oauth2/authorization/github. -
Run the full test suite (unit, integration, and ArchUnit architecture tests) with:
Integration tests that use Testcontainers require Docker to be running and are skipped automatically when Docker is unavailable.