# shuganchauhan/ars architecture

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

- Interactive diagram: https://gitdiagram.com/shuganchauhan/ars
- Repository: https://github.com/shuganchauhan/ars

## Overview

Gamers'G is a gaming-platform backend API for players, organizations, teams, tournament organizers, and admins. Clients sign up or log in, then use authenticated APIs for profiles, team rosters, recruitment, social activity, messaging, tournaments, and administration; results are returned over HTTP, with selected updates also emitted in real time. The map follows the documented route-registration and sampled service dependencies. Several domain services and real-time wiring are not excerpted, so their internal relationships are not inferred.

Main entry points: [`src/app.js`](https://github.com/shuganchauhan/ars/blob/main/src/app.js) (Express application), [`src/shared/db/index.js`](https://github.com/shuganchauhan/ars/blob/main/src/shared/db/index.js) (PostgreSQL access), [`src/server.js`](https://github.com/shuganchauhan/ars/blob/main/src/server.js) (HTTP server startup), [`src/modules/social/social.service.js`](https://github.com/shuganchauhan/ars/blob/main/src/modules/social/social.service.js) (Follows and feed)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry"]
  node_app["Express application<br/>[app.js]"]
  node_server["HTTP server startup<br/>[server.js]"]
end

subgraph group_identity["Identity"]
  node_auth["Accounts and login<br/>[auth.service.js]"]
  node_admin["Admin verification<br/>[admin.service.js]"]
end

subgraph group_community["Players and teams"]
  node_players["Player profiles<br/>[players.service.js]"]
  node_orgs["Organizations<br/>[orgs.service.js]"]
  node_teams["Teams and rosters<br/>[teams.service.js]"]
  node_recruitment["Recruitment lifecycle"]
end

subgraph group_engagement["Platform activity"]
  node_discovery["Discovery search"]
  node_social["Follows and feed<br/>[social.service.js]"]
  node_messaging["Direct messaging"]
  node_tournaments["Tournaments"]
end

subgraph group_infra["Shared runtime"]
  node_db[("PostgreSQL access<br/>[index.js]")]
  node_jwt["JWT helpers<br/>[jwt.js]"]
  node_middleware["Authentication middleware<br/>[middleware.js]"]
  node_validation["Request validation<br/>[index.js]"]
  node_errors["Error handling<br/>[index.js]"]
  node_pagination["Cursor pagination<br/>[index.js]"]
  node_redis[("Redis client<br/>[index.js]")]
  node_ratelimit["Rate limiting<br/>[index.js]"]
  node_socket["Realtime events<br/>[index.js]"]
end

node_client(("API clients"))

node_client -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_auth
node_app -->|"mounts routes"| node_players
node_app -->|"mounts routes"| node_orgs
node_app -->|"mounts routes"| node_teams
node_app -->|"mounts routes"| node_recruitment
node_app -->|"mounts routes"| node_discovery
node_app -->|"mounts routes"| node_social
node_app -->|"mounts routes"| node_messaging
node_app -->|"mounts routes"| node_tournaments
node_app -->|"mounts routes"| node_admin
node_app -->|"handles errors"| node_errors
node_auth -->|"queries"| node_db
node_auth -->|"signs tokens"| node_jwt
node_middleware -->|"verifies tokens"| node_jwt
node_middleware -->|"raises auth errors"| node_errors
node_admin -->|"queries"| node_db
node_discovery -->|"queries"| node_db
node_discovery -->|"uses cursors"| node_pagination
node_recruitment -->|"queries"| node_db
node_recruitment -->|"emits updates"| node_socket
node_social -->|"queries"| node_db
node_social -->|"uses cursors"| node_pagination
node_social -->|"emits updates"| node_socket
node_messaging -.->|"queries"| node_db
node_teams -->|"queries"| node_db
node_orgs -.->|"queries"| node_db
node_players -.->|"queries"| node_db
node_tournaments -->|"queries"| node_db
node_server -->|"starts"| node_app
node_server -->|"initializes"| node_socket
node_server -->|"uses"| node_db
node_server -->|"uses"| node_redis
node_ratelimit -->|"stores limits"| node_redis
node_socket -->|"uses adapter"| node_redis

click node_app "https://github.com/shuganchauhan/ars/blob/main/src/app.js"
click node_auth "https://github.com/shuganchauhan/ars/blob/main/src/modules/auth/auth.service.js"
click node_admin "https://github.com/shuganchauhan/ars/blob/main/src/modules/admin/admin.service.js"
click node_players "https://github.com/shuganchauhan/ars/blob/main/src/modules/players/players.service.js"
click node_orgs "https://github.com/shuganchauhan/ars/blob/main/src/modules/orgs/orgs.service.js"
click node_teams "https://github.com/shuganchauhan/ars/blob/main/src/modules/teams/teams.service.js"
click node_recruitment "https://github.com/shuganchauhan/ars/blob/main/src/modules/recruitment/recruitment.service.js"
click node_discovery "https://github.com/shuganchauhan/ars/blob/main/src/modules/discovery/discovery.service.js"
click node_social "https://github.com/shuganchauhan/ars/blob/main/src/modules/social/social.service.js"
click node_messaging "https://github.com/shuganchauhan/ars/blob/main/src/modules/messaging/messaging.service.js"
click node_tournaments "https://github.com/shuganchauhan/ars/blob/main/src/modules/tournaments/tournaments.service.js"
click node_db "https://github.com/shuganchauhan/ars/blob/main/src/shared/db/index.js"
click node_jwt "https://github.com/shuganchauhan/ars/blob/main/src/shared/auth/jwt.js"
click node_middleware "https://github.com/shuganchauhan/ars/blob/main/src/shared/auth/middleware.js"
click node_validation "https://github.com/shuganchauhan/ars/blob/main/src/shared/validation/index.js"
click node_errors "https://github.com/shuganchauhan/ars/blob/main/src/shared/errors/index.js"
click node_pagination "https://github.com/shuganchauhan/ars/blob/main/src/shared/pagination/index.js"
click node_redis "https://github.com/shuganchauhan/ars/blob/main/src/shared/redis/index.js"
click node_ratelimit "https://github.com/shuganchauhan/ars/blob/main/src/shared/ratelimit/index.js"
click node_socket "https://github.com/shuganchauhan/ars/blob/main/src/shared/socket/index.js"
click node_server "https://github.com/shuganchauhan/ars/blob/main/src/server.js"

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_server,node_client toneBlue
class node_auth,node_admin toneAmber
class node_players,node_orgs,node_teams,node_recruitment toneMint
class node_discovery,node_social,node_messaging,node_tournaments toneRose
class node_db,node_jwt,node_middleware,node_validation,node_errors,node_pagination,node_redis,node_ratelimit,node_socket toneIndigo
```

## Components

### API entry

- [Express application](https://github.com/shuganchauhan/ars/blob/main/src/app.js): `src/app.js`
- [HTTP server startup](https://github.com/shuganchauhan/ars/blob/main/src/server.js): `src/server.js`

### Identity

- [Accounts and login](https://github.com/shuganchauhan/ars/blob/main/src/modules/auth/auth.service.js): `src/modules/auth/auth.service.js`
- [Admin verification](https://github.com/shuganchauhan/ars/blob/main/src/modules/admin/admin.service.js): `src/modules/admin/admin.service.js`

### Players and teams

- [Player profiles](https://github.com/shuganchauhan/ars/blob/main/src/modules/players/players.service.js): `src/modules/players/players.service.js`
- [Organizations](https://github.com/shuganchauhan/ars/blob/main/src/modules/orgs/orgs.service.js): `src/modules/orgs/orgs.service.js`
- [Teams and rosters](https://github.com/shuganchauhan/ars/blob/main/src/modules/teams/teams.service.js): `src/modules/teams/teams.service.js`
- [Recruitment lifecycle](https://github.com/shuganchauhan/ars/blob/main/src/modules/recruitment/recruitment.service.js): `src/modules/recruitment/recruitment.service.js`

### Platform activity

- [Discovery search](https://github.com/shuganchauhan/ars/blob/main/src/modules/discovery/discovery.service.js): `src/modules/discovery/discovery.service.js`
- [Follows and feed](https://github.com/shuganchauhan/ars/blob/main/src/modules/social/social.service.js): `src/modules/social/social.service.js`
- [Direct messaging](https://github.com/shuganchauhan/ars/blob/main/src/modules/messaging/messaging.service.js): `src/modules/messaging/messaging.service.js`
- [Tournaments](https://github.com/shuganchauhan/ars/blob/main/src/modules/tournaments/tournaments.service.js): `src/modules/tournaments/tournaments.service.js`

### Shared runtime

- [PostgreSQL access](https://github.com/shuganchauhan/ars/blob/main/src/shared/db/index.js): `src/shared/db/index.js`
- [JWT helpers](https://github.com/shuganchauhan/ars/blob/main/src/shared/auth/jwt.js): `src/shared/auth/jwt.js`
- [Authentication middleware](https://github.com/shuganchauhan/ars/blob/main/src/shared/auth/middleware.js): `src/shared/auth/middleware.js`
- [Request validation](https://github.com/shuganchauhan/ars/blob/main/src/shared/validation/index.js): `src/shared/validation/index.js`
- [Error handling](https://github.com/shuganchauhan/ars/blob/main/src/shared/errors/index.js): `src/shared/errors/index.js`
- [Cursor pagination](https://github.com/shuganchauhan/ars/blob/main/src/shared/pagination/index.js): `src/shared/pagination/index.js`
- [Redis client](https://github.com/shuganchauhan/ars/blob/main/src/shared/redis/index.js): `src/shared/redis/index.js`
- [Rate limiting](https://github.com/shuganchauhan/ars/blob/main/src/shared/ratelimit/index.js): `src/shared/ratelimit/index.js`
- [Realtime events](https://github.com/shuganchauhan/ars/blob/main/src/shared/socket/index.js): `src/shared/socket/index.js`

### Other components

- **API clients**

## Connections

- API clients → Express application: sends requests (evidence: `src/app.js`)
- Express application → Accounts and login: mounts routes (evidence: `src/app.js`)
- Express application → Player profiles: mounts routes (evidence: `src/app.js`)
- Express application → Organizations: mounts routes (evidence: `src/app.js`)
- Express application → Teams and rosters: mounts routes (evidence: `src/app.js`)
- Express application → Recruitment lifecycle: mounts routes (evidence: `src/app.js`)
- Express application → Discovery search: mounts routes (evidence: `src/app.js`)
- Express application → Follows and feed: mounts routes (evidence: `src/app.js`)
- Express application → Direct messaging: mounts routes (evidence: `src/app.js`)
- Express application → Tournaments: mounts routes (evidence: `src/app.js`)
- Express application → Admin verification: mounts routes (evidence: `src/app.js`)
- Express application → Error handling: handles errors (evidence: `src/app.js`)
- Accounts and login → PostgreSQL access: queries (evidence: `src/modules/auth/auth.service.js`)
- Accounts and login → JWT helpers: signs tokens (evidence: `src/modules/auth/auth.service.js`)
- Authentication middleware → JWT helpers: verifies tokens (evidence: `src/shared/auth/middleware.js`)
- Authentication middleware → Error handling: raises auth errors (evidence: `src/shared/auth/middleware.js`)
- Admin verification → PostgreSQL access: queries (evidence: `src/modules/admin/admin.service.js`)
- Discovery search → PostgreSQL access: queries (evidence: `src/modules/discovery/discovery.service.js`)
- Discovery search → Cursor pagination: uses cursors (evidence: `src/modules/discovery/discovery.service.js`)
- Recruitment lifecycle → PostgreSQL access: queries (evidence: `src/modules/recruitment/recruitment.service.js`)
- Recruitment lifecycle → Realtime events: emits updates (evidence: `src/modules/recruitment/recruitment.service.js`)
- Follows and feed → PostgreSQL access: queries (evidence: `src/modules/social/social.service.js`)
- Follows and feed → Cursor pagination: uses cursors (evidence: `src/modules/social/social.service.js`)
- Follows and feed → Realtime events: emits updates (evidence: `src/modules/social/social.service.js`)
- Direct messaging → PostgreSQL access: queries
- Teams and rosters → PostgreSQL access: queries (evidence: `src/modules/teams/teams.service.js`)
- Organizations → PostgreSQL access: queries
- Player profiles → PostgreSQL access: queries
- Tournaments → PostgreSQL access: queries (evidence: `src/modules/tournaments/tournaments.service.js`)
- HTTP server startup → Express application: starts (evidence: `src/server.js`)
- HTTP server startup → Realtime events: initializes (evidence: `src/server.js`)
- HTTP server startup → PostgreSQL access: uses (evidence: `src/server.js`)
- HTTP server startup → Redis client: uses (evidence: `src/server.js`)
- Rate limiting → Redis client: stores limits (evidence: `src/shared/ratelimit/index.js`)
- Realtime events → Redis client: uses adapter (evidence: `src/shared/socket/index.js`)
