# alenma3apps/tastymeal architecture

> Architecture diagram of the GitHub repository alenma3apps/tastymeal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alenma3apps/tastymeal
- Repository: https://github.com/alenma3apps/tastymeal

## Overview

##### Project type and purpose
- TastyMeal is a full-stack, cross‐platform recipe management application.
- It comprises three main modules:
- BackEnd-SpringBoot: a RESTful API and business-logic layer.
- FrontEnd-Desktop: an Electron/React desktop client.
- FrontEnd-Mobile: a React Native mobile client.

##### File structure
- Top‐level directories:
- BackEnd-SpringBoot (Maven/Spring Boot project)
- FrontEnd-Desktop (Electron + React + Webpack)
- FrontEnd-Mobile (Expo/React Native with Next.js-style routing)
- Backend follows a classic layered architecture:
– controllers (HTTP endpoints)
– services (business logic)
– repositories (JPA interfaces)
– models/DTOs
– security (JWT filter, config)
- Desktop and Mobile: component-based UI, “services” or “api” layers to call the backend, context/hooks on mobile, CSS/modules/styles on desktop.
- Configuration: application.properties, tailwind/webpack/babel configs, package.json, pom.xml.

##### Key insights from README
- Uses Spring Boot + MySQL for persistence.
- JWT-based auth with secure endpoints.
- React Native for iOS/Android, Electron for Windows/macOS/Linux.
- Features: user auth, recipe CRUD, rating/filtering, profile management.

##### Main components & their relationships
a. Components
1. Desktop Client (Electron + React)
2. Mobile Client (React Native + AuthContext)
3. API Gateway / Spring Boot Backend
4. MySQL Database
5. External services: (none in current scope)
b. Interactions
- Desktop & Mobile → REST calls (HTTPS) → Spring Boot controllers
- Controllers → Services → Repositories → MySQL
- Security layer (JwtAuthFilter, JwtService) sits in front of protected endpoints
- DataInitializer loads initial JSON data on startup
c. Architectural patterns
– Client–Server (REST)
– Layered backend (Controller → Service → Repository)
– JWT authentication filter chain (WebSecurityConfig)
– Component-based UIs with service wrappers on clients
d. Technologies to call out
- Spring Boot, Maven, JPA/Hibernate, JWT, MySQL
- Electron, Webpack, React, CSS modules (desktop)
- React Native, Context API, Tailwind (mobile)

##### Detailed elements to capture
- Client: mention key client modules (e.g., “AuthContext” on mobile, “services/” folder on desktop).
- Backend security: show JwtAuthFilter and SecurityConfig intercepting calls.
- Data flow: user login → /api/auth → JwtService → token issued → subsequent calls include Authorization header.
- DataInitializer loads recetas.json and eventos.json at startup.
- Repositories map to models (User, Recipe, Comment, Event, Report).

## Diagram (Mermaid)

```mermaid
flowchart TB
  %% Clients Layer
  subgraph "Clients Layer"
    DC["Desktop Client\n(Electron + React)"]:::frontend
    DE["Desktop Entry Points\n(main.js, preload.js)"]:::frontend
    DCMP["Desktop UI Components"]:::frontend
    DP["Desktop Pages/Views"]:::frontend
    DSERV["Desktop Services (API wrappers)"]:::frontend
    DSTY["Desktop Styles & CSS modules"]:::frontend
    DCFG["Desktop App Shell & Config"]:::frontend

    MC["Mobile Client\n(React Native)"]:::frontend
    MR["Mobile Routing & Screens"]:::frontend
    MAPI["Mobile API Layer"]:::frontend
    MCTX["Mobile Context Providers"]:::frontend
    MUIC["Mobile UI Components"]:::frontend
    MH["Mobile Hooks & Theming"]:::frontend
  end

  %% Backend Layer
  subgraph "Backend - Spring Boot" 
    BB["API Gateway / Spring Boot Backend"]:::backend

    subgraph "Security Layer"
      JWTF["JwtAuthFilter & JwtService"]:::security
      SEC["WebSecurityConfig"]:::security
    end

    subgraph "Controllers"
      CTRL["Controllers"]:::controllers
    end

    subgraph "Services"
      SV["Services"]:::services
    end

    subgraph "Repositories"
      REP["Repositories"]:::repositories
    end

    subgraph "Models & DTOs"
      MDL["Models (Entities)"]:::models
      DTO["DTOs"]:::dto
    end

    DI["DataInitializer"]:::tools
    AP["application.properties\n+ recetas.json/eventos.json"]:::tools
  end

  %% Database Layer
  DB["MySQL Database"]:::database

  %% Connections
  DC -->|HTTPS/JSON| CTRL
  MC -->|HTTPS/JSON| CTRL

  JWTF -->|intercepts| CTRL
  SEC -->|configures| JWTF

  CTRL -->|"call"| SV
  SV -->|"call"| REP
  REP -->|"read/write"| DB

  DI -.->|load initial data| DB
  AP -->|config| BB

  %% Click Events
  click BB "https://github.com/alenma3apps/tastymeal/blob/main/BackEnd-SpringBoot/pom.xml"
  click CTRL "https://github.com/alenma3apps/tastymeal/tree/main/BackEnd-SpringBoot/src/main/java/com/alenma3apps/backendTastyMeal/controllers"
  click SV "https://github.com/alenma3apps/tastymeal/tree/main/BackEnd-SpringBoot/src/main/java/com/alenma3apps/backendTastyMeal/services"
  click REP "https://github.com/alenma3apps/tastymeal/tree/main/BackEnd-SpringBoot/src/main/java/com/alenma3apps/backendTastyMeal/repositories"
  click MDL "https://github.com/alenma3apps/tastymeal/tree/main/BackEnd-SpringBoot/src/main/java/com/alenma3apps/backendTastyMeal/models"
  click DTO "https://github.com/alenma3apps/tastymeal/tree/main/BackEnd-SpringBoot/src/main/java/com/alenma3apps/backendTastyMeal/dto"
  click JWTF "https://github.com/alenma3apps/tastymeal/tree/main/BackEnd-SpringBoot/src/main/java/com/alenma3apps/backendTastyMeal/security"
  click DI "https://github.com/alenma3apps/tastymeal/blob/main/BackEnd-SpringBoot/src/main/java/com/alenma3apps/backendTastyMeal/tools/DataInitializer.java"
  click AP "https://github.com/alenma3apps/tastymeal/blob/main/BackEnd-SpringBoot/src/main/resources/application.properties"

  click DC "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Desktop/package.json"
  click DE "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Desktop/main.js"
  click DE "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Desktop/preload.js"
  click DCMP "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Desktop/src/components"
  click DP "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Desktop/src/pages"
  click DSERV "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Desktop/src/services"
  click DSTY "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Desktop/src/css"
  click DSTY "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Desktop/src/styles"
  click DCFG "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Desktop/webpack.config.js"
  click DCFG "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Desktop/babel.config.js"
  click DCFG "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Desktop/tailwind.config.js"

  click MC "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Mobile/app.json"
  click MC "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Mobile/package.json"
  click MR "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Mobile/app/(auth)"
  click MR "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Mobile/app/(main)"
  click MR "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Mobile/app/(tabs)"
  click MAPI "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Mobile/api/api.js"
  click MCTX "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Mobile/context/AuthContext.js"
  click MCTX "https://github.com/alenma3apps/tastymeal/blob/main/FrontEnd-Mobile/context/UserContext.js"
  click MUIC "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Mobile/components"
  click MH "https://github.com/alenma3apps/tastymeal/tree/main/FrontEnd-Mobile/hooks"

  %% Styles
  classDef frontend fill:#D0E8FF,stroke:#0288D1,stroke-width:1px
  classDef backend fill:#E8F5E9,stroke:#2E7D32,stroke-width:1px
  classDef security fill:#FFF3E0,stroke:#EF6C00,stroke-width:1px
  classDef controllers fill:#C8E6C9,stroke:#388E3C,stroke-width:1px
  classDef services fill:#C8E6C9,stroke:#388E3C,stroke-width:1px
  classDef repositories fill:#C8E6C9,stroke:#388E3C,stroke-width:1px
  classDef models fill:#E8F5E9,stroke:#66BB6A,stroke-width:1px
  classDef dto fill:#E8F5E9,stroke:#66BB6A,stroke-width:1px
  classDef tools fill:#F3E5F5,stroke:#8E24AA,stroke-width:1px
  classDef database fill:#FFE0B2,stroke:#FB8C00,stroke-width:1px
```
