How kentze/templegym works
TempleGym is a student gym-workout app: students authenticate, plan or start a workout, log exercises and sets, and receive points that contribute to weekly competition. The mobile client also supports workout history and details, personal stats, profile settings, exercise selection, and a weekly leaderboard. The server handles OTP/JWT authentication, workout validation and scoring, gym GPS verification, profile and history queries, and leaderboard ranking; PostgreSQL stores the product data. Connections among unsampled screens and the weekly reset job are included only where the README documents the capability or relationship.
Main entry points: api.ts API client · app.ts Express routes · workouts.routes.ts Workout routes · HomeScreen.tsx Workout home
Components 30
Mobile app
- App entry
apps/mobile/src/navigation/RootNavigator.tsx - OTP login
apps/mobile/src/screens/auth/LoginScreen.tsx - API client
apps/mobile/src/services/api.ts - Auth state
apps/mobile/src/store/auth.store.ts - Workout home
apps/mobile/src/screens/home/HomeScreen.tsx - Routine editor
apps/mobile/src/screens/routine/AddRoutineScreen.tsx - Exercise picker
apps/mobile/src/screens/routine/ExercisePickerScreen.tsx - Routine state
apps/mobile/src/store/routines.store.ts - Session logging
apps/mobile/src/screens/workout/SessionLoggingScreen.tsx - Workout state
apps/mobile/src/store/workout.store.ts - Workout history
apps/mobile/src/screens/history/HistoryScreen.tsx - Session details
apps/mobile/src/screens/history/SessionDetailScreen.tsx - Personal stats
apps/mobile/src/screens/stats/StatsScreen.tsx - Profile settings
apps/mobile/src/screens/settings/SettingsScreen.tsx - Leaderboard view
apps/mobile/src/screens/leaderboard/LeaderboardScreen.tsx
Backend API
- Express routes
apps/server/src/app.ts - Auth routes
apps/server/src/routes/auth.routes.ts - JWT authentication
apps/server/src/middleware/auth.middleware.ts - Workout routes
apps/server/src/routes/workouts.routes.ts - Exercise catalogue
apps/server/src/routes/exercises.routes.ts - User and stats routes
apps/server/src/routes/me.routes.ts - Leaderboard route
apps/server/src/routes/leaderboard.routes.ts - Gym verification
apps/server/src/services/gps.service.ts
Points and competition
- Workout scoring
apps/server/src/services/points.service.ts - Weekly rankings
apps/server/src/services/leaderboard.service.ts - Weekly reset
apps/server/src/jobs/leaderboard-reset.job.ts
Persistence and integrations
- PostgreSQL
- AWS SES
Shared types
- Shared contracts
packages/types/src/workout.ts
Other components
- Student
Connections 36
- Student → App entry: uses
- App entry → OTP login: routes to
apps/mobile/src/navigation/RootNavigator.tsx - App entry → Workout home: routes to
apps/mobile/src/navigation/RootNavigator.tsx - OTP login → API client: requests OTP
apps/mobile/src/screens/auth/LoginScreen.tsx - OTP login → Auth state: stores session
apps/mobile/src/screens/auth/LoginScreen.tsx - API client → Auth state: reads token
apps/mobile/src/services/api.ts - Workout home → Routine state: loads routines
apps/mobile/src/screens/home/HomeScreen.tsx - Workout home → Session logging: starts workout
- Routine editor → Exercise picker: selects exercises
- Workout home → Routine editor: opens editor
apps/mobile/src/screens/home/HomeScreen.tsx - Session logging → Workout state: records session
- Workout state → API client: submits workout
apps/mobile/src/store/workout.store.ts - Workout history → API client: fetches sessions
- Session details → Workout history: shows selection
- Personal stats → API client: fetches stats
- Profile settings → API client: updates profile
apps/mobile/src/screens/settings/SettingsScreen.tsx - Leaderboard view → API client: fetches rankings
apps/mobile/src/screens/leaderboard/LeaderboardScreen.tsx - API client → Express routes: calls API
- Express routes → Auth routes: mounts
apps/server/src/app.ts - Express routes → Workout routes: mounts
apps/server/src/app.ts - Express routes → Exercise catalogue: mounts
apps/server/src/app.ts - Express routes → User and stats routes: mounts
apps/server/src/app.ts - Express routes → Leaderboard route: mounts
apps/server/src/app.ts - Auth routes → PostgreSQL: reads and writes
apps/server/src/routes/auth.routes.ts - Auth routes → AWS SES: sends OTP email
apps/server/src/routes/auth.routes.ts - JWT authentication → PostgreSQL: looks up user
apps/server/src/middleware/auth.middleware.ts - Workout routes → JWT authentication: requires auth
apps/server/src/routes/workouts.routes.ts - Workout routes → Gym verification: verifies location
apps/server/src/routes/workouts.routes.ts - Workout routes → Workout scoring: computes points
apps/server/src/routes/workouts.routes.ts - Workout routes → PostgreSQL: stores session and points
apps/server/src/routes/workouts.routes.ts - Exercise catalogue → PostgreSQL: reads catalogue
apps/server/src/routes/exercises.routes.ts - User and stats routes → PostgreSQL: reads and updates
apps/server/src/routes/me.routes.ts - Leaderboard route → Weekly rankings: gets rankings
apps/server/src/routes/leaderboard.routes.ts - Weekly rankings → PostgreSQL: queries scores
apps/server/src/services/leaderboard.service.ts - Weekly reset → PostgreSQL: resets weekly scores
- Workout routes → Shared contracts: uses workout contract