# larabatista04/bolao-2026 architecture

> Architecture diagram of the GitHub repository larabatista04/bolao-2026, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/larabatista04/bolao-2026
- Repository: https://github.com/larabatista04/bolao-2026

## Overview

Bolão is a football-prediction application: users authenticate, browse synchronized World Cup games, submit score predictions, and view personal or league rankings. The frontend routes authenticated users to dashboard, games, leagues, and ranking pages; its API client communicates with the Express backend. Backend controllers handle domain operations and persist through Prisma, while a football-data integration synchronizes match results and recalculates prediction points. The supplied excerpts and SOURCE INDEX support the internal calls shown; the frontend-to-backend HTTP connection is inferred and marked unverified.

Main entry points: [`frontend/src/App.tsx`](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/App.tsx) (App routes), [`frontend/src/services/api.ts`](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/services/api.ts) (API client), [`backend/src/prisma/index.ts`](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/prisma/index.ts) (Prisma client), [`backend/src/app.ts`](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/app.ts) (Express API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["App routes<br/>[App.tsx]"]
  node_auth_pages["Login and registration<br/>[Login.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_games_page["Games page<br/>[Games.tsx]"]
  node_leagues_page["Leagues page<br/>[Leagues.tsx]"]
  node_ranking_page["Ranking page<br/>[Ranking.tsx]"]
  node_auth_store["Auth state<br/>[auth.store.ts]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_http_api["Express API<br/>[app.ts]"]
  node_auth_routes["Auth routes<br/>[auth.routes.ts]"]
  node_game_routes["Game routes<br/>[game.routes.ts]"]
  node_prediction_routes["Prediction routes"]
  node_ranking_routes["Ranking routes<br/>[ranking.routes.ts]"]
  node_league_routes["League routes<br/>[league.routes.ts]"]
  node_auth_middleware["JWT middleware<br/>[auth.middleware.ts]"]
  node_prisma_client["Prisma client<br/>[index.ts]"]
  node_database[("Application database<br/>[schema.prisma]")]
end

subgraph group_domain["Prediction features"]
  node_auth_controller["Authentication<br/>[auth.controller.ts]"]
  node_game_controller["Game operations<br/>[game.controller.ts]"]
  node_prediction_controller["Predictions"]
  node_ranking_controller["Global ranking"]
  node_league_controller["Leagues and ranking"]
end

subgraph group_sync["Football synchronization"]
  node_sync_job["Sync job<br/>[sync.job.ts]"]
  node_football_service["Match sync and scoring"]
end

node_user(("Player"))
node_football_data{{"Football-data.org"}}

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_auth_pages
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_games_page
node_app -->|"routes to"| node_leagues_page
node_app -->|"routes to"| node_ranking_page
node_app -->|"checks auth"| node_auth_store
node_auth_pages -->|"calls"| node_api_client
node_auth_pages -->|"updates"| node_auth_store
node_dashboard -->|"calls"| node_api_client
node_games_page -->|"calls"| node_api_client
node_games_page -->|"reads"| node_auth_store
node_leagues_page -->|"calls"| node_api_client
node_leagues_page -->|"reads"| node_auth_store
node_ranking_page -->|"calls"| node_api_client
node_auth_store -->|"checks session"| node_api_client
node_api_client -.->|"HTTP requests"| node_http_api
node_http_api -->|"mounts"| node_auth_routes
node_http_api -->|"mounts"| node_game_routes
node_http_api -->|"mounts"| node_prediction_routes
node_http_api -->|"mounts"| node_ranking_routes
node_http_api -->|"mounts"| node_league_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_game_routes -->|"dispatches"| node_game_controller
node_prediction_routes -->|"dispatches"| node_prediction_controller
node_ranking_routes -->|"dispatches"| node_ranking_controller
node_league_routes -->|"dispatches"| node_league_controller
node_auth_routes -->|"applies"| node_auth_middleware
node_game_routes -->|"applies"| node_auth_middleware
node_prediction_routes -->|"applies"| node_auth_middleware
node_ranking_routes -->|"applies"| node_auth_middleware
node_league_routes -->|"applies"| node_auth_middleware
node_auth_controller -->|"queries"| node_prisma_client
node_game_controller -->|"queries"| node_prisma_client
node_game_controller -->|"invokes sync"| node_football_service
node_prediction_controller -->|"queries"| node_prisma_client
node_ranking_controller -->|"queries"| node_prisma_client
node_league_controller -->|"queries"| node_prisma_client
node_prisma_client -->|"accesses"| node_database
node_sync_job -->|"runs sync"| node_football_service
node_football_service -->|"fetches matches"| node_football_data
node_football_service -->|"updates games and scores"| node_prisma_client

click node_app "https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/App.tsx"
click node_auth_pages "https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Login.tsx"
click node_dashboard "https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Dashboard.tsx"
click node_games_page "https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Games.tsx"
click node_leagues_page "https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Leagues.tsx"
click node_ranking_page "https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Ranking.tsx"
click node_auth_store "https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/stores/auth.store.ts"
click node_api_client "https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/services/api.ts"
click node_http_api "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/app.ts"
click node_auth_routes "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/auth.routes.ts"
click node_game_routes "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/game.routes.ts"
click node_prediction_routes "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/prediction.routes.ts"
click node_ranking_routes "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/ranking.routes.ts"
click node_league_routes "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/league.routes.ts"
click node_auth_middleware "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/middlewares/auth.middleware.ts"
click node_auth_controller "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/auth.controller.ts"
click node_game_controller "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/game.controller.ts"
click node_prediction_controller "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/prediction.controller.ts"
click node_ranking_controller "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/ranking.controller.ts"
click node_league_controller "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/league.controller.ts"
click node_prisma_client "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/prisma/index.ts"
click node_database "https://github.com/larabatista04/bolao-2026/blob/main/backend/prisma/schema.prisma"
click node_sync_job "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/jobs/sync.job.ts"
click node_football_service "https://github.com/larabatista04/bolao-2026/blob/main/backend/src/services/football.service.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_auth_pages,node_dashboard,node_games_page,node_leagues_page,node_ranking_page,node_auth_store,node_api_client toneBlue
class node_http_api,node_auth_routes,node_game_routes,node_prediction_routes,node_ranking_routes,node_league_routes,node_auth_middleware,node_prisma_client,node_database toneAmber
class node_auth_controller,node_game_controller,node_prediction_controller,node_ranking_controller,node_league_controller toneMint
class node_sync_job,node_football_service toneRose
class node_user,node_football_data toneIndigo
```

## Components

### Web application

- [App routes](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login and registration](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Login.tsx): `frontend/src/pages/Login.tsx`
- [Dashboard](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Games page](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Games.tsx): `frontend/src/pages/Games.tsx`
- [Leagues page](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Leagues.tsx): `frontend/src/pages/Leagues.tsx`
- [Ranking page](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/pages/Ranking.tsx): `frontend/src/pages/Ranking.tsx`
- [Auth state](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/stores/auth.store.ts): `frontend/src/stores/auth.store.ts`
- [API client](https://github.com/larabatista04/bolao-2026/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Backend API

- [Express API](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Auth routes](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/auth.routes.ts): `backend/src/routes/auth.routes.ts`
- [Game routes](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/game.routes.ts): `backend/src/routes/game.routes.ts`
- [Prediction routes](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/prediction.routes.ts): `backend/src/routes/prediction.routes.ts`
- [Ranking routes](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/ranking.routes.ts): `backend/src/routes/ranking.routes.ts`
- [League routes](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/routes/league.routes.ts): `backend/src/routes/league.routes.ts`
- [JWT middleware](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/middlewares/auth.middleware.ts): `backend/src/middlewares/auth.middleware.ts`
- [Prisma client](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/prisma/index.ts): `backend/src/prisma/index.ts`
- [Application database](https://github.com/larabatista04/bolao-2026/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`

### Prediction features

- [Authentication](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/auth.controller.ts): `backend/src/controllers/auth.controller.ts`
- [Game operations](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/game.controller.ts): `backend/src/controllers/game.controller.ts`
- [Predictions](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/prediction.controller.ts): `backend/src/controllers/prediction.controller.ts`
- [Global ranking](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/ranking.controller.ts): `backend/src/controllers/ranking.controller.ts`
- [Leagues and ranking](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/controllers/league.controller.ts): `backend/src/controllers/league.controller.ts`

### Football synchronization

- [Sync job](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/jobs/sync.job.ts): `backend/src/jobs/sync.job.ts`
- [Match sync and scoring](https://github.com/larabatista04/bolao-2026/blob/main/backend/src/services/football.service.ts): `backend/src/services/football.service.ts`

### Other components

- **Player**
- **Football-data.org**

## Connections

- Player → App routes: uses (evidence: `frontend/src/App.tsx`)
- App routes → Login and registration: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Games page: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Leagues page: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Ranking page: routes to (evidence: `frontend/src/App.tsx`)
- App routes → Auth state: checks auth (evidence: `frontend/src/App.tsx`)
- Login and registration → API client: calls (evidence: `frontend/src/pages/Login.tsx`)
- Login and registration → Auth state: updates (evidence: `frontend/src/pages/Login.tsx`)
- Dashboard → API client: calls (evidence: `frontend/src/pages/Dashboard.tsx`)
- Games page → API client: calls (evidence: `frontend/src/pages/Games.tsx`)
- Games page → Auth state: reads (evidence: `frontend/src/pages/Games.tsx`)
- Leagues page → API client: calls (evidence: `frontend/src/pages/Leagues.tsx`)
- Leagues page → Auth state: reads (evidence: `frontend/src/pages/Leagues.tsx`)
- Ranking page → API client: calls (evidence: `frontend/src/pages/Ranking.tsx`)
- Auth state → API client: checks session (evidence: `frontend/src/stores/auth.store.ts`)
- API client → Express API: HTTP requests
- Express API → Auth routes: mounts (evidence: `backend/src/app.ts`)
- Express API → Game routes: mounts (evidence: `backend/src/app.ts`)
- Express API → Prediction routes: mounts (evidence: `backend/src/app.ts`)
- Express API → Ranking routes: mounts (evidence: `backend/src/app.ts`)
- Express API → League routes: mounts (evidence: `backend/src/app.ts`)
- Auth routes → Authentication: dispatches (evidence: `backend/src/routes/auth.routes.ts`)
- Game routes → Game operations: dispatches (evidence: `backend/src/routes/game.routes.ts`)
- Prediction routes → Predictions: dispatches (evidence: `backend/src/routes/prediction.routes.ts`)
- Ranking routes → Global ranking: dispatches (evidence: `backend/src/routes/ranking.routes.ts`)
- League routes → Leagues and ranking: dispatches (evidence: `backend/src/routes/league.routes.ts`)
- Auth routes → JWT middleware: applies (evidence: `backend/src/routes/auth.routes.ts`)
- Game routes → JWT middleware: applies (evidence: `backend/src/routes/game.routes.ts`)
- Prediction routes → JWT middleware: applies (evidence: `backend/src/routes/prediction.routes.ts`)
- Ranking routes → JWT middleware: applies (evidence: `backend/src/routes/ranking.routes.ts`)
- League routes → JWT middleware: applies (evidence: `backend/src/routes/league.routes.ts`)
- Authentication → Prisma client: queries (evidence: `backend/src/controllers/auth.controller.ts`)
- Game operations → Prisma client: queries (evidence: `backend/src/controllers/game.controller.ts`)
- Game operations → Match sync and scoring: invokes sync (evidence: `backend/src/controllers/game.controller.ts`)
- Predictions → Prisma client: queries (evidence: `backend/src/controllers/prediction.controller.ts`)
- Global ranking → Prisma client: queries (evidence: `backend/src/controllers/ranking.controller.ts`)
- Leagues and ranking → Prisma client: queries (evidence: `backend/src/controllers/league.controller.ts`)
- Prisma client → Application database: accesses (evidence: `backend/src/prisma/index.ts`)
- Sync job → Match sync and scoring: runs sync (evidence: `backend/src/jobs/sync.job.ts`)
- Match sync and scoring → Football-data.org: fetches matches (evidence: `backend/src/services/football.service.ts`)
- Match sync and scoring → Prisma client: updates games and scores (evidence: `backend/src/services/football.service.ts`)
