A scalable microservices-based fitness tracking and AI recommendation platform built with Java (Spring Boot), React, RabbitMQ, Docker, and more.
- System Overview
- Architecture Diagram
- Microservices & Responsibilities
- API Endpoints
- Data Flow & Working
- Setup & Running Locally
- Docker & Deployment
- Environment Variables
- Development & Testing
- Troubleshooting
- Contributing
- License
This platform allows users to:
- Track fitness activities (CRUD)
- Get AI-powered recommendations for activities
- Manage authentication and user profiles
- View dashboards and insights
Tech Stack:
- Java (Spring Boot) for backend microservices
- React for frontend
- RabbitMQ for messaging
- Eureka for service discovery
- Spring Cloud Config for centralized configuration
- Docker for containerization
- activity_service/: Manages user activities (CRUD operations, metrics, etc.).
- ai_service/: Provides AI-powered recommendations and analysis for activities.
- auth_service/: Handles user authentication, registration, and JWT token management.
- user_service/: Manages user profiles and related data.
- gateway/: API Gateway for routing, load balancing, and authentication filtering.
- common-security/: Shared security logic (JWT, filters).
- config_server/: Centralized configuration management for all services.
- eureka/: Service discovery using Netflix Eureka.
- frontend/: React-based user interface.
- docker-compose.yml: Container orchestration for local development.
POST /api/v1/activities/create- Create activityGET /api/v1/activities- List activities (paginated)GET /api/v1/activities/{id}- Get activity by IDPUT /api/v1/activities/update/{id}- Update activityDELETE /api/v1/activities/delete/{id}- Delete activityGET /api/v1/activities/my-activities- List user’s activitiesGET /api/v1/activities/recent- Recent activitiesGET /api/v1/activities/top-calories- Top calorie activities
GET /api/v1/recommendations- List recommendations (paginated)GET /api/v1/recommendations/{id}- Get recommendation by IDPOST /api/v1/recommendations- Create recommendationPUT /api/v1/recommendations/{id}- Update recommendationDELETE /api/v1/recommendations/{id}- Delete recommendation
POST /api/v1/auth/register- Register userPOST /api/v1/auth/login- Login
GET /api/v1/users/{id}- Get user profilePUT /api/v1/users/{id}- Update user profile
- Routes all requests to appropriate microservices
- User creates/updates/deletes an activity via frontend.
- Activity Service processes the request and sends an event to RabbitMQ.
- AI Service listens to RabbitMQ, processes the activity, and generates recommendations using AI (Gemini API or similar).
- Recommendations are stored and can be fetched by the frontend.
- All services register with Eureka for service discovery.
- Gateway routes requests and applies security via common-security.
- Java 17+
- Node.js 18+
- Docker & Docker Compose
git clone <repo-url>
cd java_proectdocker-compose up --build./start-all.shcd frontend
npm install
npm run dev- Frontend: http://localhost:3000
- Eureka dashboard: http://localhost:8761
- RabbitMQ dashboard: http://localhost:15672 (default user/pass: guest/guest)
- All services are containerized.
- Use
docker-compose.ymlto orchestrate services. - For production, configure environment variables/secrets in Docker or your cloud provider.
Each service uses its own application.yml for configuration. Key variables:
rabbitmq.exchange.namerabbitmq.queue.namerabbitmq.routing.keyrabbitmq.update.queue.namerabbitmq.update.routing.keyrabbitmq.delete.queue.namerabbitmq.delete.routing.keyspring.datasource.*(for DB config)jwt.secret(for auth) Set these in yourapplication.ymlor as environment variables.
- Backend: Use
./mvnw spring-boot:runin each service folder. - Frontend: Use
npm run dev. - Testing: Use JUnit for backend, React Testing Library/Jest for frontend.
- Linting: Use ESLint for frontend, Checkstyle for backend.
- RabbitMQ exchange type error: Ensure exchange type matches in config and RabbitMQ.
- Missing environment variables: Check
application.ymlin each service. - Service not registering: Check Eureka and service logs.
- Frontend API errors: Check gateway and backend logs.
- Fork the repo
- Create a feature branch
- Commit your changes
- Open a pull request