A fully functional Fitness Tracker microservices backend built with Spring Boot 3, Spring Cloud, and Keycloak for secure authentication.
This project demonstrates a modern cloud-ready architecture with service discovery, centralized configuration, gateway routing, and OAuth2 integration.
Dashboard | Add Activity | Keycloak Login | Eureka Dashboard |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Frontend (React + Vite + Tailwind)
β
βΌ
βββββββββββββββββββββββββ
β API Gateway β β JWT validation (Keycloak)
β (Spring Cloud GW) β
ββββββββββββ¬βββββββββββββ
β routes
ββββββββββββ΄βββββββββββββ
β User Service β β manages user profiles (PostgreSQL)
ββββββββββββ¬βββββββββββββ
β
βΌ
ββββββββββββ΄βββββββββββββ
β Activity Service β β tracks workouts, calories, durations
ββββββββββββββββββββββββββ
- π§ Service Discovery β via Eureka Server
- βοΈ Centralized Configuration β via Config Server
- π Authentication & Authorization β integrated Keycloak (OpenID Connect)
- πͺ API Gateway β routing & CORS configuration
- π§ User Service β manages user profiles synchronized with Keycloak
- πͺ Activity Service β tracks user activities and calculates burned calories
- ποΈ PostgreSQL Databases for persistent storage
- βοΈ Spring Cloud Load Balancer β used between microservices
- π§° Reactive WebClient for inter-service communication
Layer | Stack |
---|---|
Backend | Java 21, Spring Boot 3, Spring Cloud, Spring Security |
Auth | Keycloak (OpenID Connect, OAuth2) |
Database | PostgreSQL |
Dev Tools | IntelliJ IDEA, Maven |
Infrastructure | Eureka, Config Server, API Gateway |
- Admin creates users in Keycloak Admin Console.
- User logs in through the React frontend (redirected to Keycloak).
- Gateway validates the JWT token.
- User Service automatically registers the user if not yet in DB.
- Activity Service allows tracking workouts for the authenticated user.
- Realm:
fitness-oath2
- Client:
oath2-pkce-client
- Redirect URI:
http://localhost:5173/*
- Web Origins:
http://localhost:5173
- Auth Flow: Standard + Direct Access Grants (PKCE: S256)
Service | Port |
---|---|
Config Server | 8888 |
Eureka Server | 8761 |
API Gateway | 8080 |
User Service | 8081 |
Activity Service | 8082 |
Keycloak | 8181 |
1οΈβ£ Start Keycloak on port 8181
:
cd C:\keycloak\bin
.\kc.bat start-dev --http-port=8181
2οΈβ£ Start the Spring Boot services in this order:
1. Config Server
2. Eureka Server
3. API Gateway
4. User Service
5. Activity Service
3οΈβ£ Launch the frontend (optional):
npm run dev
Developed by Vlad Bulahov
π GitHub: RaxRot
This project is open-source and free to use for educational or demonstration purposes.