# boulderproblem/boulder-problem-api architecture

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

- Interactive diagram: https://gitdiagram.com/boulderproblem/boulder-problem-api
- Repository: https://github.com/boulderproblem/boulder-problem-api

## Overview

BoulderProblem is an Adonis-based backend API for a bouldering app. Clients call registered HTTP routes, which dispatch to controllers for authentication, climbing locations and routes, contests, social content, and messaging; those handlers operate on Lucid models backed by PostgreSQL. The README confirms the Adonis/PostgreSQL stack. Controller and model links are included only where the supplied excerpts or SOURCE INDEX support them; unsampled controller internals are not inferred.

Main entry points: [`start/routes.ts`](https://github.com/boulderproblem/boulder-problem-api/blob/master/start/routes.ts) (HTTP routes), [`app/controllers/messages_controller.ts`](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/messages_controller.ts) (Direct messaging), [`app/controllers/auth_controller.ts`](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/auth_controller.ts) (Authentication), [`app/controllers/users_controller.ts`](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/users_controller.ts) (User profiles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry"]
  node_routes["HTTP routes<br/>[routes.ts]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_identity["Identity"]
  node_auth["Authentication<br/>[auth_controller.ts]"]
  node_users["User profiles"]
  node_user_model["User records<br/>[user.ts]"]
  node_crypto["Key encryption<br/>[crypto.ts]"]
end

subgraph group_climbing["Climbing domain"]
  node_places["Climbing places"]
  node_zones["Climbing zones"]
  node_ways["Climbing routes<br/>[ways_controller.ts]"]
  node_way_model["Route records<br/>[way.ts]"]
  node_stats["Climbing statistics"]
  node_walls["Climbing walls"]
end

subgraph group_social["Social features"]
  node_posts["Posts and comments"]
  node_post_model["Post records<br/>[post.ts]"]
  node_feed["Activity feed<br/>[feed_controller.ts]"]
end

subgraph group_community["Community features"]
  node_contests["Competitions"]
  node_contest_model["Contest records<br/>[contest.ts]"]
  node_messages["Direct messaging"]
  node_conversation_model["Conversation records<br/>[conversation.ts]"]
  node_message_model["Message records<br/>[messages.ts]"]
end

node_client(("App client"))

node_client -->|"calls API"| node_routes
node_routes -->|"dispatches auth"| node_auth
node_routes -->|"dispatches users"| node_users
node_routes -->|"dispatches posts"| node_posts
node_routes -->|"dispatches feed"| node_feed
node_routes -->|"dispatches places"| node_places
node_routes -->|"dispatches zones"| node_zones
node_routes -->|"dispatches routes"| node_ways
node_routes -->|"dispatches contests"| node_contests
node_routes -->|"dispatches messages"| node_messages
node_routes -->|"dispatches stats"| node_stats
node_routes -->|"dispatches walls"| node_walls
node_auth -->|"queries users"| node_user_model
node_auth -->|"encrypts keys"| node_crypto
node_users -->|"queries users"| node_user_model
node_posts -->|"queries posts"| node_post_model
node_posts -.->|"persists content"| node_postgres
node_users -.->|"persists profiles"| node_postgres
node_places -.->|"stores place data"| node_postgres
node_zones -.->|"stores zone data"| node_postgres
node_ways -->|"uses route model"| node_way_model
node_ways -.->|"stores route data"| node_postgres
node_contests -->|"queries contests"| node_contest_model
node_messages -->|"queries conversations"| node_conversation_model
node_messages -->|"queries messages"| node_message_model
node_messages -->|"encrypts group keys"| node_crypto
node_contests -.->|"stores contest data"| node_postgres
node_messages -.->|"stores conversations"| node_postgres
node_feed -.->|"reads activity"| node_postgres
node_stats -.->|"reads statistics"| node_postgres

click node_routes "https://github.com/boulderproblem/boulder-problem-api/blob/master/start/routes.ts"
click node_auth "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/auth_controller.ts"
click node_users "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/users_controller.ts"
click node_user_model "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/user.ts"
click node_crypto "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/services/crypto.ts"
click node_places "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/places_controller.ts"
click node_zones "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/zones_controller.ts"
click node_ways "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/ways_controller.ts"
click node_way_model "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/way.ts"
click node_contests "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/contests_controller.ts"
click node_contest_model "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/contest.ts"
click node_messages "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/messages_controller.ts"
click node_conversation_model "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/conversation.ts"
click node_message_model "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/messages.ts"
click node_posts "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/posts_controller.ts"
click node_post_model "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/post.ts"
click node_feed "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/feed_controller.ts"
click node_stats "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/stats_controller.ts"
click node_walls "https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/walls_controller.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_routes,node_postgres,node_client toneBlue
class node_auth,node_users,node_user_model,node_crypto toneAmber
class node_places,node_zones,node_ways,node_way_model,node_stats,node_walls toneMint
class node_posts,node_post_model,node_feed toneRose
class node_contests,node_contest_model,node_messages,node_conversation_model,node_message_model toneIndigo
```

## Components

### API entry

- [HTTP routes](https://github.com/boulderproblem/boulder-problem-api/blob/master/start/routes.ts): `start/routes.ts`
- **PostgreSQL**

### Identity

- [Authentication](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/auth_controller.ts): `app/controllers/auth_controller.ts`
- [User profiles](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/users_controller.ts): `app/controllers/users_controller.ts`
- [User records](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/user.ts): `app/models/user.ts`
- [Key encryption](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/services/crypto.ts): `app/services/crypto.ts`

### Climbing domain

- [Climbing places](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/places_controller.ts): `app/controllers/places_controller.ts`
- [Climbing zones](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/zones_controller.ts): `app/controllers/zones_controller.ts`
- [Climbing routes](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/ways_controller.ts): `app/controllers/ways_controller.ts`
- [Route records](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/way.ts): `app/models/way.ts`
- [Climbing statistics](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/stats_controller.ts): `app/controllers/stats_controller.ts`
- [Climbing walls](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/walls_controller.ts): `app/controllers/walls_controller.ts`

### Social features

- [Posts and comments](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/posts_controller.ts): `app/controllers/posts_controller.ts`
- [Post records](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/post.ts): `app/models/post.ts`
- [Activity feed](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/feed_controller.ts): `app/controllers/feed_controller.ts`

### Community features

- [Competitions](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/contests_controller.ts): `app/controllers/contests_controller.ts`
- [Contest records](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/contest.ts): `app/models/contest.ts`
- [Direct messaging](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/controllers/messages_controller.ts): `app/controllers/messages_controller.ts`
- [Conversation records](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/conversation.ts): `app/models/conversation.ts`
- [Message records](https://github.com/boulderproblem/boulder-problem-api/blob/master/app/models/messages.ts): `app/models/messages.ts`

### Other components

- **App client**

## Connections

- App client → HTTP routes: calls API (evidence: `start/routes.ts`)
- HTTP routes → Authentication: dispatches auth (evidence: `start/routes.ts`)
- HTTP routes → User profiles: dispatches users (evidence: `start/routes.ts`)
- HTTP routes → Posts and comments: dispatches posts (evidence: `start/routes.ts`)
- HTTP routes → Activity feed: dispatches feed (evidence: `start/routes.ts`)
- HTTP routes → Climbing places: dispatches places (evidence: `start/routes.ts`)
- HTTP routes → Climbing zones: dispatches zones (evidence: `start/routes.ts`)
- HTTP routes → Climbing routes: dispatches routes (evidence: `start/routes.ts`)
- HTTP routes → Competitions: dispatches contests (evidence: `start/routes.ts`)
- HTTP routes → Direct messaging: dispatches messages (evidence: `start/routes.ts`)
- HTTP routes → Climbing statistics: dispatches stats (evidence: `start/routes.ts`)
- HTTP routes → Climbing walls: dispatches walls (evidence: `start/routes.ts`)
- Authentication → User records: queries users (evidence: `app/controllers/auth_controller.ts`)
- Authentication → Key encryption: encrypts keys (evidence: `app/controllers/auth_controller.ts`)
- User profiles → User records: queries users (evidence: `app/controllers/users_controller.ts`)
- Posts and comments → Post records: queries posts (evidence: `app/controllers/posts_controller.ts`)
- Posts and comments → PostgreSQL: persists content
- User profiles → PostgreSQL: persists profiles
- Climbing places → PostgreSQL: stores place data
- Climbing zones → PostgreSQL: stores zone data
- Climbing routes → Route records: uses route model (evidence: `app/controllers/ways_controller.ts`)
- Climbing routes → PostgreSQL: stores route data
- Competitions → Contest records: queries contests (evidence: `app/controllers/contests_controller.ts`)
- Direct messaging → Conversation records: queries conversations (evidence: `app/controllers/messages_controller.ts`)
- Direct messaging → Message records: queries messages (evidence: `app/controllers/messages_controller.ts`)
- Direct messaging → Key encryption: encrypts group keys (evidence: `app/controllers/messages_controller.ts`)
- Competitions → PostgreSQL: stores contest data
- Direct messaging → PostgreSQL: stores conversations
- Activity feed → PostgreSQL: reads activity
- Climbing statistics → PostgreSQL: reads statistics
