How protrainingunaj/protraining-back works
ProTraining is a .NET microservice backend for athlete identity, organization, training, wellness tracking, and AI-assisted planning. The documented user entry is the gateway; a representative workflow is an athlete or coach using training routines and records, with check-ins and performance data supporting follow-up. Assistant capabilities include routine suggestions, plan drafts, preventive alerts, and resilient AI fallback. The README documents service-owned PostgreSQL databases; sampled handlers show selected repository and cross-service calls. Other service internals and most gateway routing are not sampled, so those relationships are omitted.
Main entry points: API/Controllers Wellness API · API/Controllers Assistant API · Program.cs API gateway · ResilientAiService.cs AI fallback chain
Components 29
Entry gateway
- API gateway
gateway/Program.cs - Perimeter security
gateway/Middleware/PerimeterSecurityMiddleware.cs - Session validation
gateway/Services/SessionValidationClient.cs
Identity and structure
- Identity API
services/identidad/API/Controllers - Accounts
services/identidad/Domain/Entities - Identity database
services/identidad - Athlete organization
services/estructura/API/Controllers/AthletesController.cs - Structure database
services/estructura
Training service
- Training API
services/entrenamiento/API/Controllers - Exercise catalog
services/entrenamiento/Application/UseCases/Exercise/ListExercises/ListExercisesQueryHandler.cs - Exercise model
services/entrenamiento/Domain/Entities/Exercise.cs - Plans and records
services/entrenamiento/Application/Interfaces/Persistence/ITrainingPlanRepository.cs - Today's routine
services/entrenamiento/Application/UseCases/Routines/GetTodayRoutine/GetTodayRoutineQueryHandler.cs - Training database
services/entrenamiento
Wellness tracking
- Wellness API
services/seguimiento/API/Controllers - Check-ins and injuries
services/seguimiento/Application/UseCases/CheckIns/ListAthleteCheckIns/ListAthleteCheckInsQueryHandler.cs - Athlete evolution
services/seguimiento/Application/UseCases/Evolution/GetAthleteEvolution/GetAthleteEvolutionQueryHandler.cs - Field tests
services/seguimiento/API/Controllers/FieldTests/FieldTestSessionsController.cs - Wellness database
services/seguimiento
AI assistance
- Assistant API
services/asistente/API/Controllers - Routine suggestions
services/asistente/Application/UseCases/Ai/SuggestRoutine/SuggestRoutineUseCase.cs - Plan drafts
services/asistente/Application/UseCases/PlanDrafts - Preventive alerts
services/asistente/Application/UseCases/Alerts - AI fallback chain
services/asistente/Infrastructure/Services/Ai/ResilientAiService.cs - Assistant database
services/asistente
Other components
- Frontend
- Ollama
- Google Gemini
- Local rule engine
services/asistente/Infrastructure/Services/Ai/Rules/DeterministicRuleEngine.cs
Connections 26
- Frontend → API gateway: sends requests
- API gateway → Athlete organization: routes requests
- API gateway → Perimeter security
gateway/Program.cs - API gateway → Session validation
gateway/Program.cs - Identity API → Accounts: manages accounts
- Identity API → Identity database: persists data
services/identidad/API/Controllers/UsersController.cs - Athlete organization → Structure database: persists data
services/estructura/API/Controllers/AthletesController.cs - Training API → Plans and records: handles training
- Training API → Today's routine: serves routines
- Exercise catalog → Exercise model: maps exercises
services/entrenamiento/Application/UseCases/Exercise/ListExercises/ListExercisesQueryHandler.cs - Today's routine → Training database: reads training data
services/entrenamiento/Application/UseCases/Routines/GetTodayRoutine/GetTodayRoutineQueryHandler.cs - Training API → Training database: persists data
- Wellness API → Check-ins and injuries: serves check-ins
- Wellness API → Athlete evolution: serves evolution
- Wellness API → Field tests: serves tests
- Check-ins and injuries → Wellness database: reads check-ins
services/seguimiento/Application/UseCases/CheckIns/ListAthleteCheckIns/ListAthleteCheckInsQueryHandler.cs - Athlete evolution → Wellness database: reads tracking data
services/seguimiento/Application/UseCases/Evolution/GetAthleteEvolution/GetAthleteEvolutionQueryHandler.cs - Wellness API → Wellness database: persists data
services/seguimiento/API/Controllers/Categories/CategoriesAveragesController.cs - Assistant API → Routine suggestions: handles suggestions
services/asistente/API/Controllers/AssistantController.cs - Assistant API → Plan drafts: handles drafts
- Assistant API → Preventive alerts: handles alerts
- Assistant API → Assistant database: persists data
services/asistente/API/Controllers/AssistantController.cs - Routine suggestions → AI fallback chain: requests generation
- AI fallback chain → Ollama: tries local model
- AI fallback chain → Google Gemini: falls back
- AI fallback chain → Local rule engine: uses rules