How aussieguy0/gym-buddy works
Main Components
• Frontend Client: Represent the React-based client application found under the “frontend” directory. It includes components, pages (such as Login, Register, Workouts, etc.), and service modules (Api.ts, Http.ts) for interacting with the backend REST API.
• Backend Service: Represent the Kotlin-based web server located in the “backend” directory. It encapsulates several sub-components:
– Routing & Controllers: Components such as Routes.kt, AuthenticationController.kt, WorkoutController.kt, GraphController.kt, etc. handle various API endpoints (all under the /api/v1 prefix).
– Business Logic & Services: Service classes like AuthenticationService, WorkoutService, GraphService, and supporting utilities and exception handling.
– Database Access Layer: Modules that use direct JDBC interactions, jOOQ generated classes, and migrations (via Flyway and SQL files under resources/db/migration) to manage Postgres persistence.
– Testing: Unit and integration tests in the “backend/src/test” directory.
• Database: A PostgreSQL database acting as the persistent store with information populated from CSV files and maintained through Flyway migrations.
Relationships and Data Flow
• Within the Backend, component interactions should be clearly mapped: Routes invoke Controllers; Controllers use Service classes for business logic; Services interface with the Database Access Layer and helper utilities.
Architectural Patterns or Design Principles
• Separation of Concerns: The clear division between frontend (presentation layer) and backend (API & business logic) is evident.
• RESTful API Design: All endpoints under /api/v1 are a central theme that bridges frontend and backend.
• Database Migration & Versioning: Use of Flyway for DB version control and migration implies a focus on consistent schema evolution.
• Modularization in the code (dividing authentication, workout tracking, graphing, and utilities) ensures maintainability.
Relevant Technologies and Frameworks
• Backend: Kotlin, Javalin, Flyway, jOOQ, and direct Postgres connectivity.
• Build/Deployment: Maven (via Maven Wrapper), Docker (Dockerfile, docker-compose.yml), and CI/CD pipelines (Travis CI, GitHub workflows).
Instructing the Principal Software Engineer
– Top-Level: “User/Browser”
– Next Level: “Frontend Application (React/TypeScript)” with annotations around its key modules (pages, components, services).
– Then: “Backend Service (Kotlin/Javalin)” with subdivided areas for routing, business logic, authentication, database access, and specialized components (like the Graph processing module).
– At the bottom: “Database (PostgreSQL)” as the persistent layer, with a side note for Flyway migrations.
• Labels to denote each critical file or directory group, drawing attention to the separation of modules (authentication, workout management, utilities, etc.).