# gsg-g13/balanty architecture

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

- Interactive diagram: https://gitdiagram.com/gsg-g13/balanty
- Repository: https://github.com/gsg-g13/balanty

## Overview

Balanty is a football community app for organizing matches around players and stadiums. Members and stadium owners use the React client to find matches, manage profiles, create or join games, and coordinate in match chat; stadium reviews support the venue side of the workflow. The Express API exposes corresponding domain routes and services, with Sequelize models for persisted users, matches, messages, stadiums, and reviews. The shown source establishes app routing and some server wiring; several domain-page and service connections are documented by the README but not visible in sampled implementation excerpts.

Main entry points: [`client/src/App.tsx`](https://github.com/gsg-g13/balanty/blob/main/client/src/App.tsx) (Client router), [`server/models/index.ts`](https://github.com/gsg-g13/balanty/blob/main/server/models/index.ts) (Domain models), [`server/routes/router.ts`](https://github.com/gsg-g13/balanty/blob/main/server/routes/router.ts) (API routing), [`server/services/auth.ts`](https://github.com/gsg-g13/balanty/blob/main/server/services/auth.ts) (Account services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Client router<br/>[App.tsx]"]
  node_authui["Login and signup<br/>[LoginWrapper.tsx]"]
  node_matchesui["Match browsing<br/>[Match.tsx]"]
  node_createui["Match creation<br/>[CreateMatch.tsx]"]
  node_playersui["Player discovery<br/>[PlayersPage.tsx]"]
  node_stadiumsui["Stadium browsing<br/>[Stadiums.tsx]"]
  node_stadiumprofileui["Stadium profile<br/>[StadiumProfile.tsx]"]
  node_playerprofileui["Player profile<br/>[PlayerProfile.tsx]"]
  node_matchroomui["Match room<br/>[MatchRoomPage.tsx]"]
end

subgraph group_api["API and domain logic"]
  node_server["Express API<br/>[app.ts]"]
  node_routes["API routing<br/>[router.ts]"]
  node_authroute["Account routes<br/>[auth.ts]"]
  node_authcontroller["Auth controller<br/>[auth.ts]"]
  node_authservice["Account services<br/>[auth.ts]"]
  node_matchservice["Match services<br/>[matches.ts]"]
  node_playerservice["Player services<br/>[player.ts]"]
  node_stadiumservice["Stadium services<br/>[stadiums.ts]"]
  node_reviewroute["Review routes<br/>[reviewRouter.ts]"]
  node_reviewservice["Review services<br/>[reviews.ts]"]
  node_chatservice["Match chat service<br/>[matchChat.ts]"]
end

subgraph group_data["Persistence"]
  node_models["Domain models<br/>[index.ts]"]
  node_database[("PostgreSQL<br/>[connection.ts]")]
end

subgraph group_integrations["External services"]
  node_email["Email delivery"]
  node_socket["Socket.IO"]
end

node_member(("Member / owner"))

node_member -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_matchesui
node_app -->|"routes to"| node_stadiumsui
node_app -->|"routes to"| node_playersui
node_app -->|"routes to"| node_stadiumprofileui
node_app -->|"routes to"| node_playerprofileui
node_app -->|"routes to"| node_matchroomui
node_member -.->|"creates matches"| node_createui
node_member -.->|"chats in"| node_matchroomui
node_member -.->|"reviews stadiums"| node_stadiumprofileui
node_server -->|"mounts API"| node_routes
node_routes -->|"mounts account"| node_authroute
node_authroute -->|"dispatches"| node_authcontroller
node_authcontroller -->|"calls"| node_authservice
node_routes -->|"mounts reviews"| node_reviewroute
node_reviewroute -.->|"dispatches"| node_reviewservice
node_authservice -->|"reads and writes"| node_models
node_reviewservice -->|"reads and writes"| node_models
node_matchservice -.->|"uses"| node_models
node_playerservice -.->|"uses"| node_models
node_stadiumservice -.->|"uses"| node_models
node_chatservice -.->|"uses"| node_models
node_models -.->|"persists through"| node_database
node_authservice -->|"sends email"| node_email
node_app -->|"connects"| node_socket

click node_app "https://github.com/gsg-g13/balanty/blob/main/client/src/App.tsx"
click node_authui "https://github.com/gsg-g13/balanty/blob/main/client/src/components/auth/LoginWrapper.tsx"
click node_matchesui "https://github.com/gsg-g13/balanty/blob/main/client/src/pages/Match.tsx"
click node_createui "https://github.com/gsg-g13/balanty/blob/main/client/src/pages/CreateMatch.tsx"
click node_playersui "https://github.com/gsg-g13/balanty/blob/main/client/src/pages/PlayersPage.tsx"
click node_stadiumsui "https://github.com/gsg-g13/balanty/blob/main/client/src/pages/Stadiums.tsx"
click node_stadiumprofileui "https://github.com/gsg-g13/balanty/blob/main/client/src/pages/StadiumProfile.tsx"
click node_playerprofileui "https://github.com/gsg-g13/balanty/blob/main/client/src/pages/PlayerProfile.tsx"
click node_matchroomui "https://github.com/gsg-g13/balanty/blob/main/client/src/pages/MatchRoomPage.tsx"
click node_server "https://github.com/gsg-g13/balanty/blob/main/server/app.ts"
click node_routes "https://github.com/gsg-g13/balanty/blob/main/server/routes/router.ts"
click node_authroute "https://github.com/gsg-g13/balanty/blob/main/server/routes/auth.ts"
click node_authcontroller "https://github.com/gsg-g13/balanty/blob/main/server/controllers/auth.ts"
click node_authservice "https://github.com/gsg-g13/balanty/blob/main/server/services/auth.ts"
click node_matchservice "https://github.com/gsg-g13/balanty/blob/main/server/services/matches.ts"
click node_playerservice "https://github.com/gsg-g13/balanty/blob/main/server/services/player.ts"
click node_stadiumservice "https://github.com/gsg-g13/balanty/blob/main/server/services/stadiums.ts"
click node_reviewroute "https://github.com/gsg-g13/balanty/blob/main/server/routes/reviewRouter.ts"
click node_reviewservice "https://github.com/gsg-g13/balanty/blob/main/server/services/reviews.ts"
click node_chatservice "https://github.com/gsg-g13/balanty/blob/main/server/services/matchChat.ts"
click node_models "https://github.com/gsg-g13/balanty/blob/main/server/models/index.ts"
click node_database "https://github.com/gsg-g13/balanty/blob/main/server/database/config/connection.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_authui,node_matchesui,node_createui,node_playersui,node_stadiumsui,node_stadiumprofileui,node_playerprofileui,node_matchroomui toneBlue
class node_server,node_routes,node_authroute,node_authcontroller,node_authservice,node_matchservice,node_playerservice,node_stadiumservice,node_reviewroute,node_reviewservice,node_chatservice toneAmber
class node_models,node_database toneMint
class node_email,node_socket toneRose
class node_member toneIndigo
```

## Components

### Web client

- [Client router](https://github.com/gsg-g13/balanty/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Login and signup](https://github.com/gsg-g13/balanty/blob/main/client/src/components/auth/LoginWrapper.tsx): `client/src/components/auth/LoginWrapper.tsx`
- [Match browsing](https://github.com/gsg-g13/balanty/blob/main/client/src/pages/Match.tsx): `client/src/pages/Match.tsx`
- [Match creation](https://github.com/gsg-g13/balanty/blob/main/client/src/pages/CreateMatch.tsx): `client/src/pages/CreateMatch.tsx`
- [Player discovery](https://github.com/gsg-g13/balanty/blob/main/client/src/pages/PlayersPage.tsx): `client/src/pages/PlayersPage.tsx`
- [Stadium browsing](https://github.com/gsg-g13/balanty/blob/main/client/src/pages/Stadiums.tsx): `client/src/pages/Stadiums.tsx`
- [Stadium profile](https://github.com/gsg-g13/balanty/blob/main/client/src/pages/StadiumProfile.tsx): `client/src/pages/StadiumProfile.tsx`
- [Player profile](https://github.com/gsg-g13/balanty/blob/main/client/src/pages/PlayerProfile.tsx): `client/src/pages/PlayerProfile.tsx`
- [Match room](https://github.com/gsg-g13/balanty/blob/main/client/src/pages/MatchRoomPage.tsx): `client/src/pages/MatchRoomPage.tsx`

### API and domain logic

- [Express API](https://github.com/gsg-g13/balanty/blob/main/server/app.ts): `server/app.ts`
- [API routing](https://github.com/gsg-g13/balanty/blob/main/server/routes/router.ts): `server/routes/router.ts`
- [Account routes](https://github.com/gsg-g13/balanty/blob/main/server/routes/auth.ts): `server/routes/auth.ts`
- [Auth controller](https://github.com/gsg-g13/balanty/blob/main/server/controllers/auth.ts): `server/controllers/auth.ts`
- [Account services](https://github.com/gsg-g13/balanty/blob/main/server/services/auth.ts): `server/services/auth.ts`
- [Match services](https://github.com/gsg-g13/balanty/blob/main/server/services/matches.ts): `server/services/matches.ts`
- [Player services](https://github.com/gsg-g13/balanty/blob/main/server/services/player.ts): `server/services/player.ts`
- [Stadium services](https://github.com/gsg-g13/balanty/blob/main/server/services/stadiums.ts): `server/services/stadiums.ts`
- [Review routes](https://github.com/gsg-g13/balanty/blob/main/server/routes/reviewRouter.ts): `server/routes/reviewRouter.ts`
- [Review services](https://github.com/gsg-g13/balanty/blob/main/server/services/reviews.ts): `server/services/reviews.ts`
- [Match chat service](https://github.com/gsg-g13/balanty/blob/main/server/services/matchChat.ts): `server/services/matchChat.ts`

### Persistence

- [Domain models](https://github.com/gsg-g13/balanty/blob/main/server/models/index.ts): `server/models/index.ts`
- [PostgreSQL](https://github.com/gsg-g13/balanty/blob/main/server/database/config/connection.ts): `server/database/config/connection.ts`

### External services

- **Email delivery**
- **Socket.IO**

### Other components

- **Member / owner**

## Connections

- Member / owner → Client router: uses
- Client router → Login and signup: routes to (evidence: `client/src/App.tsx`)
- Client router → Match browsing: routes to (evidence: `client/src/App.tsx`)
- Client router → Stadium browsing: routes to (evidence: `client/src/App.tsx`)
- Client router → Player discovery: routes to (evidence: `client/src/App.tsx`)
- Client router → Stadium profile: routes to (evidence: `client/src/App.tsx`)
- Client router → Player profile: routes to (evidence: `client/src/App.tsx`)
- Client router → Match room: routes to (evidence: `client/src/App.tsx`)
- Member / owner → Match creation: creates matches
- Member / owner → Match room: chats in
- Member / owner → Stadium profile: reviews stadiums
- Express API → API routing: mounts API (evidence: `server/app.ts`)
- API routing → Account routes: mounts account (evidence: `server/routes/router.ts`)
- Account routes → Auth controller: dispatches (evidence: `server/routes/auth.ts`)
- Auth controller → Account services: calls (evidence: `server/controllers/auth.ts`)
- API routing → Review routes: mounts reviews (evidence: `server/routes/router.ts`)
- Review routes → Review services: dispatches
- Account services → Domain models: reads and writes (evidence: `server/services/auth.ts`)
- Review services → Domain models: reads and writes (evidence: `server/services/reviews.ts`)
- Match services → Domain models: uses
- Player services → Domain models: uses
- Stadium services → Domain models: uses
- Match chat service → Domain models: uses
- Domain models → PostgreSQL: persists through
- Account services → Email delivery: sends email (evidence: `server/services/auth.ts`)
- Client router → Socket.IO: connects (evidence: `client/src/App.tsx`)
