# henriquegpb/rodada architecture

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

- Interactive diagram: https://gitdiagram.com/henriquegpb/rodada
- Repository: https://github.com/henriquegpb/rodada

## Overview

Rodada is a Portuguese daily-games platform: players open a shared daily challenge, submit guesses, and see feedback and a result. The README describes the gameplay contract, browser-side engine validation, saved plays, and the social layer of accounts, groups, rankings, streaks, and achievements. The graph includes the documented game families and the principal backend branches. Most API and service source was not excerpted, so those relationships are included only where the README documents them; no unsampled implementation details are assumed.

Main entry points: [`app/api`](https://github.com/henriquegpb/rodada/tree/main/app/api) (HTTP API routes), [`games/engines.ts`](https://github.com/henriquegpb/rodada/blob/main/games/engines.ts) (Engine registry), [`server/db/schema.ts`](https://github.com/henriquegpb/rodada/blob/main/server/db/schema.ts) (Postgres data), [`lib/plays/service.ts`](https://github.com/henriquegpb/rodada/blob/main/lib/plays/service.ts) (Play service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Daily play"]
  node_game_page["Game route<br/>[page.tsx]"]
  node_game_screen["Game screen<br/>[game-screen.tsx]"]
  node_play_service["Play service<br/>[service.ts]"]
  node_play_store[("Browser play storage<br/>[store.ts]")]
  node_play_stats["Results and stats<br/>[stats.ts]"]
end

subgraph group_game_engines["Game engines"]
  node_daily_seed["Daily challenge selection<br/>[seed.ts]"]
  node_game_registry["Engine registry<br/>[engines.ts]"]
  node_geo_games["Geography games<br/>[engine.ts]"]
  node_multiword_games["Multiword modes<br/>[engine.ts]"]
  node_word_engine["Palavra engine<br/>[engine.ts]"]
  node_capital_engine["Capital engine<br/>[engine.ts]"]
  node_escala_engine["Escala engine<br/>[create-engine.ts]"]
  node_incomum_engine["Incomum engine<br/>[engine.ts]"]
  node_incomum_match["Word matching<br/>[match.ts]"]
  node_incomum_tiers["Difficulty tiers<br/>[tiers.ts]"]
  node_ordem_engine["Ordem engine<br/>[engine.ts]"]
  node_ordem_rules["Ordem rules<br/>[rules.ts]"]
  node_sentido_engine["Sentido engine<br/>[engine.ts]"]
  node_trilha_solver["Trilha solver<br/>[solver.ts]"]
  node_rainhas_engine["Rainhas engine<br/>[create-engine.ts]"]
end

subgraph group_social["Social features"]
  node_ranking_ui["Ranking interface<br/>[ranking-screen.tsx]"]
  node_groups_ui["Groups interface<br/>[groups-screen.tsx]"]
  node_profile_ui["Profile interface<br/>[profile-screen.tsx]"]
  node_achievements["Achievements<br/>[achievements.ts]"]
end

subgraph group_backend["Backend"]
  node_api_routes["HTTP API routes"]
  node_server_plays["Play validation<br/>[plays.ts]"]
  node_server_accounts["Accounts and auth<br/>[accounts.ts]"]
  node_server_groups["Groups<br/>[groups.ts]"]
  node_server_rankings["Rankings<br/>[rankings.ts]"]
  node_server_profiles["Profiles<br/>[profiles.ts]"]
  node_database[("Postgres data<br/>[schema.ts]")]
end

node_player(("Player"))

node_player -->|"opens challenge"| node_game_page
node_game_page -->|"shows game"| node_game_screen
node_game_screen -->|"submits guesses"| node_play_service
node_play_service -->|"calls engine"| node_game_registry
node_game_registry -->|"dispatches"| node_geo_games
node_game_registry -->|"dispatches"| node_multiword_games
node_game_registry -->|"dispatches"| node_word_engine
node_game_registry -->|"dispatches"| node_capital_engine
node_geo_games -->|"selects daily"| node_daily_seed
node_multiword_games -->|"selects daily"| node_daily_seed
node_word_engine -->|"selects daily"| node_daily_seed
node_capital_engine -->|"selects daily"| node_daily_seed
node_play_service -->|"saves locally"| node_play_store
node_play_service -->|"scores results"| node_play_stats
node_player -->|"views rankings"| node_ranking_ui
node_player -->|"manages groups"| node_groups_ui
node_player -->|"views profile"| node_profile_ui
node_play_stats -.->|"tracks achievements"| node_achievements
node_game_screen -->|"syncs completed play"| node_api_routes
node_api_routes -.->|"routes play requests"| node_server_plays
node_server_plays -->|"rechecks guesses"| node_game_registry
node_api_routes -.->|"routes account requests"| node_server_accounts
node_api_routes -.->|"routes group requests"| node_server_groups
node_api_routes -.->|"routes ranking requests"| node_server_rankings
node_api_routes -.->|"routes profile requests"| node_server_profiles
node_server_plays -.->|"stores plays"| node_database
node_server_accounts -.->|"stores accounts"| node_database
node_server_groups -.->|"stores groups"| node_database
node_server_rankings -.->|"reads ranking data"| node_database
node_server_profiles -.->|"reads profile data"| node_database

click node_game_page "https://github.com/henriquegpb/rodada/blob/main/app/%5Bgame%5D/page.tsx"
click node_game_screen "https://github.com/henriquegpb/rodada/blob/main/components/game/game-screen.tsx"
click node_play_service "https://github.com/henriquegpb/rodada/blob/main/lib/plays/service.ts"
click node_play_store "https://github.com/henriquegpb/rodada/blob/main/lib/plays/store.ts"
click node_play_stats "https://github.com/henriquegpb/rodada/blob/main/lib/stats.ts"
click node_daily_seed "https://github.com/henriquegpb/rodada/blob/main/lib/daily/seed.ts"
click node_game_registry "https://github.com/henriquegpb/rodada/blob/main/games/engines.ts"
click node_geo_games "https://github.com/henriquegpb/rodada/blob/main/games/_shared/geo/engine.ts"
click node_multiword_games "https://github.com/henriquegpb/rodada/blob/main/games/_shared/multiword/engine.ts"
click node_word_engine "https://github.com/henriquegpb/rodada/blob/main/games/palavra/engine.ts"
click node_capital_engine "https://github.com/henriquegpb/rodada/blob/main/games/capital/engine.ts"
click node_escala_engine "https://github.com/henriquegpb/rodada/blob/main/games/escala/create-engine.ts"
click node_incomum_engine "https://github.com/henriquegpb/rodada/blob/main/games/incomum/engine.ts"
click node_incomum_match "https://github.com/henriquegpb/rodada/blob/main/games/incomum/match.ts"
click node_incomum_tiers "https://github.com/henriquegpb/rodada/blob/main/games/incomum/tiers.ts"
click node_ordem_engine "https://github.com/henriquegpb/rodada/blob/main/games/ordem/engine.ts"
click node_ordem_rules "https://github.com/henriquegpb/rodada/blob/main/games/ordem/rules.ts"
click node_sentido_engine "https://github.com/henriquegpb/rodada/blob/main/games/sentido/engine.ts"
click node_trilha_solver "https://github.com/henriquegpb/rodada/blob/main/games/trilha/solver.ts"
click node_rainhas_engine "https://github.com/henriquegpb/rodada/blob/main/games/rainhas/create-engine.ts"
click node_ranking_ui "https://github.com/henriquegpb/rodada/blob/main/components/ranking/ranking-screen.tsx"
click node_groups_ui "https://github.com/henriquegpb/rodada/blob/main/components/ranking/groups-screen.tsx"
click node_profile_ui "https://github.com/henriquegpb/rodada/blob/main/components/profile/profile-screen.tsx"
click node_achievements "https://github.com/henriquegpb/rodada/blob/main/lib/achievements.ts"
click node_api_routes "https://github.com/henriquegpb/rodada/tree/main/app/api"
click node_server_plays "https://github.com/henriquegpb/rodada/blob/main/server/plays.ts"
click node_server_accounts "https://github.com/henriquegpb/rodada/blob/main/server/accounts.ts"
click node_server_groups "https://github.com/henriquegpb/rodada/blob/main/server/groups.ts"
click node_server_rankings "https://github.com/henriquegpb/rodada/blob/main/server/rankings.ts"
click node_server_profiles "https://github.com/henriquegpb/rodada/blob/main/server/profiles.ts"
click node_database "https://github.com/henriquegpb/rodada/blob/main/server/db/schema.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_game_page,node_game_screen,node_play_service,node_play_store,node_play_stats toneBlue
class node_daily_seed,node_game_registry,node_geo_games,node_multiword_games,node_word_engine,node_capital_engine,node_escala_engine,node_incomum_engine,node_incomum_match,node_incomum_tiers,node_ordem_engine,node_ordem_rules,node_sentido_engine,node_trilha_solver,node_rainhas_engine toneAmber
class node_ranking_ui,node_groups_ui,node_profile_ui,node_achievements toneMint
class node_api_routes,node_server_plays,node_server_accounts,node_server_groups,node_server_rankings,node_server_profiles,node_database toneRose
class node_player toneIndigo
```

## Components

### Daily play

- [Game route](https://github.com/henriquegpb/rodada/blob/main/app/%5Bgame%5D/page.tsx): `app/[game]/page.tsx`
- [Game screen](https://github.com/henriquegpb/rodada/blob/main/components/game/game-screen.tsx): `components/game/game-screen.tsx`
- [Play service](https://github.com/henriquegpb/rodada/blob/main/lib/plays/service.ts): `lib/plays/service.ts`
- [Browser play storage](https://github.com/henriquegpb/rodada/blob/main/lib/plays/store.ts): `lib/plays/store.ts`
- [Results and stats](https://github.com/henriquegpb/rodada/blob/main/lib/stats.ts): `lib/stats.ts`

### Game engines

- [Daily challenge selection](https://github.com/henriquegpb/rodada/blob/main/lib/daily/seed.ts): `lib/daily/seed.ts`
- [Engine registry](https://github.com/henriquegpb/rodada/blob/main/games/engines.ts): `games/engines.ts`
- [Geography games](https://github.com/henriquegpb/rodada/blob/main/games/_shared/geo/engine.ts): `games/_shared/geo/engine.ts`
- [Multiword modes](https://github.com/henriquegpb/rodada/blob/main/games/_shared/multiword/engine.ts): `games/_shared/multiword/engine.ts`
- [Palavra engine](https://github.com/henriquegpb/rodada/blob/main/games/palavra/engine.ts): `games/palavra/engine.ts`
- [Capital engine](https://github.com/henriquegpb/rodada/blob/main/games/capital/engine.ts): `games/capital/engine.ts`
- [Escala engine](https://github.com/henriquegpb/rodada/blob/main/games/escala/create-engine.ts): `games/escala/create-engine.ts`
- [Incomum engine](https://github.com/henriquegpb/rodada/blob/main/games/incomum/engine.ts): `games/incomum/engine.ts`
- [Word matching](https://github.com/henriquegpb/rodada/blob/main/games/incomum/match.ts): `games/incomum/match.ts`
- [Difficulty tiers](https://github.com/henriquegpb/rodada/blob/main/games/incomum/tiers.ts): `games/incomum/tiers.ts`
- [Ordem engine](https://github.com/henriquegpb/rodada/blob/main/games/ordem/engine.ts): `games/ordem/engine.ts`
- [Ordem rules](https://github.com/henriquegpb/rodada/blob/main/games/ordem/rules.ts): `games/ordem/rules.ts`
- [Sentido engine](https://github.com/henriquegpb/rodada/blob/main/games/sentido/engine.ts): `games/sentido/engine.ts`
- [Trilha solver](https://github.com/henriquegpb/rodada/blob/main/games/trilha/solver.ts): `games/trilha/solver.ts`
- [Rainhas engine](https://github.com/henriquegpb/rodada/blob/main/games/rainhas/create-engine.ts): `games/rainhas/create-engine.ts`

### Social features

- [Ranking interface](https://github.com/henriquegpb/rodada/blob/main/components/ranking/ranking-screen.tsx): `components/ranking/ranking-screen.tsx`
- [Groups interface](https://github.com/henriquegpb/rodada/blob/main/components/ranking/groups-screen.tsx): `components/ranking/groups-screen.tsx`
- [Profile interface](https://github.com/henriquegpb/rodada/blob/main/components/profile/profile-screen.tsx): `components/profile/profile-screen.tsx`
- [Achievements](https://github.com/henriquegpb/rodada/blob/main/lib/achievements.ts): `lib/achievements.ts`

### Backend

- [HTTP API routes](https://github.com/henriquegpb/rodada/tree/main/app/api): `app/api`
- [Play validation](https://github.com/henriquegpb/rodada/blob/main/server/plays.ts): `server/plays.ts`
- [Accounts and auth](https://github.com/henriquegpb/rodada/blob/main/server/accounts.ts): `server/accounts.ts`
- [Groups](https://github.com/henriquegpb/rodada/blob/main/server/groups.ts): `server/groups.ts`
- [Rankings](https://github.com/henriquegpb/rodada/blob/main/server/rankings.ts): `server/rankings.ts`
- [Profiles](https://github.com/henriquegpb/rodada/blob/main/server/profiles.ts): `server/profiles.ts`
- [Postgres data](https://github.com/henriquegpb/rodada/blob/main/server/db/schema.ts): `server/db/schema.ts`

### Other components

- **Player**

## Connections

- Player → Game route: opens challenge
- Game route → Game screen: shows game
- Game screen → Play service: submits guesses
- Play service → Engine registry: calls engine
- Engine registry → Geography games: dispatches (evidence: `games/engines.ts`)
- Engine registry → Multiword modes: dispatches (evidence: `games/engines.ts`)
- Engine registry → Palavra engine: dispatches (evidence: `games/engines.ts`)
- Engine registry → Capital engine: dispatches (evidence: `games/engines.ts`)
- Geography games → Daily challenge selection: selects daily (evidence: `games/_shared/geo/engine.ts`)
- Multiword modes → Daily challenge selection: selects daily (evidence: `games/_shared/multiword/engine.ts`)
- Palavra engine → Daily challenge selection: selects daily (evidence: `games/palavra/engine.ts`)
- Capital engine → Daily challenge selection: selects daily (evidence: `games/capital/engine.ts`)
- Play service → Browser play storage: saves locally
- Play service → Results and stats: scores results
- Player → Ranking interface: views rankings
- Player → Groups interface: manages groups
- Player → Profile interface: views profile
- Results and stats → Achievements: tracks achievements
- Game screen → HTTP API routes: syncs completed play
- HTTP API routes → Play validation: routes play requests
- Play validation → Engine registry: rechecks guesses
- HTTP API routes → Accounts and auth: routes account requests
- HTTP API routes → Groups: routes group requests
- HTTP API routes → Rankings: routes ranking requests
- HTTP API routes → Profiles: routes profile requests
- Play validation → Postgres data: stores plays
- Accounts and auth → Postgres data: stores accounts
- Groups → Postgres data: stores groups
- Rankings → Postgres data: reads ranking data
- Profiles → Postgres data: reads profile data
