How eltonarmelini/tu-cancha works
1. Frontend: A React-based client that handles the user interface and communicates with the backend via REST.
2. Backend: A Spring Boot application, employing Spring Security with JWT for authentication/authorization, and structured with controllers, services, repositories, and data transfer objects (DTOs) to handle business logic (e.g., user management, reservations, and notifications via email).
3. Infrastructure & Deployment: Docker is used in both the frontend and backend (with respective Dockerfiles and docker-compose configurations). Deployment infrastructure utilizes AWS EC2, with Ansible scripts for orchestration, and continuous integration/deployment is automated via GitLab CI/CD.
A. Main Components and Their Relationships:
• Frontend Component:
• Represented as the React application.
• Subcomponents (pages, components, context providers) symbolizing UI elements like Home, Booking, Detail pages plus admin functionality.
• That it interacts with the backend via REST API calls.
• Backend Component:
• Spring Boot application.
• Layered architecture:
▸ Controller Layer: Shows endpoints for authentication (AuthController), reservations, pitches, ratings, etc.
▸ Service Layer: Include key services like UserService, ReservationService, PitchService, etc.
▸ Security & Configuration: Components for JWT validation (JwtTokenValidator, JwtUtils), Spring Security, S3 configuration, and model mapping.
• Database Layer:
• External Services:
• Email Service: Integration with Mailtrap for email notifications.
• AWS S3: For image uploads/storage.
• Infrastructure & CI/CD:
• Docker & Docker-Compose: Emphasize containerization with separate Dockerfiles for frontend and backend.
• Deployment: Show AWS EC2 as the hosting target and Ansible for configuration/deployment management.
• Pipeline: GitLab CI/CD for automated testing, building, and deployment.
B. Architectural Patterns and Design Principles:
• Layered Architecture: Separate controllers, services, repositories, and utility layers.
• Microservice-Inspired Separation (even if monolithic in code organization): Separate frontend and backend services.
• RESTful API communications: Indicate clear interactions between the frontend and backend.
• Secure Authentication: Highlight the use of Spring Security and JWT for secure access.
• Containerization & Orchestration: Use Docker containers and deployment automation.
• Clear Labels: For each component (e.g., “React Frontend”, “Spring Boot API”, “Database”, “Mail Service”, “AWS S3 Storage”, “Docker”, “Ansible Deployment”, “GitLab CI/CD Pipeline”).
• Use another distinct style for external integrations (Mailtrap, AWS S3).
• Technology Annotations: Next to each component, annotate key technologies (e.g., “React”, “Spring Boot”, “JWT”, “Docker”, “Ansible”, “GitLab CI/CD”).
• For a Full-Stack Application like TU Cancha:
• Decoupling between the frontend client and backend API.
• How authentication is managed (JWT tokens exchanged between the frontend and Spring Security).
• A depiction of deployment processes: local development (via docker-compose) versus production deployment (AWS EC2 and Ansible).
• Detail the internal backend structure:
• For Infrastructure, detail how GitLab CI/CD integrates with the Docker build process to deploy containers onto AWS.
• How the Frontend makes REST API calls to the Backend.
• How the Backend accesses the Database.
• How the Backend communicates with Mailtrap and AWS S3 for emails and file storage.