# tres7/afristay architecture

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

- Interactive diagram: https://gitdiagram.com/tres7/afristay
- Repository: https://github.com/tres7/afristay

## Overview

AfriStay is an accommodation-booking platform for Africa, with Mobile Money support documented in the README. The user-facing product spans account access, accommodation discovery, hosting, reservations, and messaging; the tree also includes favorites and profile areas. Sampled backend code confirms authentication/profile handling and a layered messaging workflow. Reservation, payment, accommodation, and favorites implementations are present in the tree but were not sampled, so their internal relationships are not inferred. The graph preserves those product areas without claiming unverified frontend-to-backend wiring.

Main entry points: [`server/apps/messaging/application/service/MessagingService.py`](https://github.com/tres7/afristay/blob/main/server/apps/messaging/application/service/MessagingService.py) (Messaging service), [`server/apps/users/application/service/UserService.py`](https://github.com/tres7/afristay/blob/main/server/apps/users/application/service/UserService.py) (User service), [`client/src/app/(main)/reservation`](https://github.com/tres7/afristay/tree/main/client/src/app/(main)/reservation) (Reservation pages), [`server/apps/users/infrastructure/persistence/DjangoUserRepository.py`](https://github.com/tres7/afristay/blob/main/server/apps/users/infrastructure/persistence/DjangoUserRepository.py) (User repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web experience"]
  node_auth_pages["Account pages"]
  node_stay_pages["Discovery and stays"]
  node_host_pages["Host workspace"]
  node_reservation_pages["Reservation pages"]
  node_profile_pages["Profile and favorites"]
  node_message_pages["Message pages"]
end

subgraph group_accounts["Accounts"]
  node_auth_controller["Auth endpoints<br/>[AuthController.py]"]
  node_user_controller["Profile endpoint<br/>[UserController.py]"]
  node_user_service["User service<br/>[UserService.py]"]
  node_user_repository["User repository"]
  node_user_store[("User records<br/>[models.py]")]
end

subgraph group_marketplace["Stay marketplace"]
  node_stay_backend["Accommodation API"]
  node_favorites_backend["Favorites API"]
end

subgraph group_booking["Reservations and payment"]
  node_reservation_backend["Reservation API"]
  node_mobile_money["Mobile Money"]
end

subgraph group_messaging["Messaging"]
  node_conversation_controller["Conversation API"]
  node_messaging_service["Messaging service"]
  node_messaging_domain["Conversation and messages"]
  node_messaging_repositories["Messaging repositories"]
  node_messaging_store[("Messaging records and outbox<br/>[models.py]")]
end

node_traveler(("Traveler / host"))

node_traveler -->|"opens account"| node_auth_pages
node_traveler -->|"discovers stays"| node_stay_pages
node_traveler -->|"manages listings"| node_host_pages
node_traveler -->|"books stays"| node_reservation_pages
node_traveler -->|"manages profile"| node_profile_pages
node_traveler -->|"uses messaging"| node_message_pages
node_auth_controller -->|"invokes"| node_user_service
node_user_controller -->|"invokes"| node_user_service
node_user_service -->|"reads and writes"| node_user_repository
node_user_repository -->|"persists users"| node_user_store
node_conversation_controller -->|"dispatches requests"| node_messaging_service
node_messaging_service -->|"creates and checks"| node_messaging_domain
node_messaging_service -->|"loads and saves"| node_messaging_repositories
node_messaging_repositories -.->|"persists messages"| node_messaging_store
node_messaging_service -.->|"looks up stays"| node_stay_backend
node_reservation_pages -.->|"pays with"| node_mobile_money

click node_auth_pages "https://github.com/tres7/afristay/tree/main/client/src/app/(auth)"
click node_stay_pages "https://github.com/tres7/afristay/tree/main/client/src/app/(main)"
click node_host_pages "https://github.com/tres7/afristay/tree/main/client/src/app/(main)/hote"
click node_reservation_pages "https://github.com/tres7/afristay/tree/main/client/src/app/(main)/reservation"
click node_profile_pages "https://github.com/tres7/afristay/tree/main/client/src/app/(main)/profil"
click node_message_pages "https://github.com/tres7/afristay/tree/main/client/src/app/(main)/messages"
click node_auth_controller "https://github.com/tres7/afristay/blob/main/server/apps/users/infrastructure/http/controllers/AuthController.py"
click node_user_controller "https://github.com/tres7/afristay/blob/main/server/apps/users/infrastructure/http/controllers/UserController.py"
click node_user_service "https://github.com/tres7/afristay/blob/main/server/apps/users/application/service/UserService.py"
click node_user_repository "https://github.com/tres7/afristay/blob/main/server/apps/users/infrastructure/persistence/DjangoUserRepository.py"
click node_user_store "https://github.com/tres7/afristay/blob/main/server/apps/users/infrastructure/persistence/models.py"
click node_stay_backend "https://github.com/tres7/afristay/tree/main/server/apps/hebergements"
click node_favorites_backend "https://github.com/tres7/afristay/tree/main/server/apps/favoris"
click node_reservation_backend "https://github.com/tres7/afristay/tree/main/server/apps/reservations"
click node_conversation_controller "https://github.com/tres7/afristay/blob/main/server/apps/messaging/infrastructure/http/controllers/ConversationController.py"
click node_messaging_service "https://github.com/tres7/afristay/blob/main/server/apps/messaging/application/service/MessagingService.py"
click node_messaging_domain "https://github.com/tres7/afristay/tree/main/server/apps/messaging/domain/entities"
click node_messaging_repositories "https://github.com/tres7/afristay/tree/main/server/apps/messaging/infrastructure/persistence"
click node_messaging_store "https://github.com/tres7/afristay/blob/main/server/apps/messaging/infrastructure/persistence/models.py"

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_auth_pages,node_stay_pages,node_host_pages,node_reservation_pages,node_profile_pages,node_message_pages toneBlue
class node_auth_controller,node_user_controller,node_user_service,node_user_repository,node_user_store toneAmber
class node_stay_backend,node_favorites_backend toneMint
class node_reservation_backend,node_mobile_money toneRose
class node_conversation_controller,node_messaging_service,node_messaging_domain,node_messaging_repositories,node_messaging_store,node_traveler toneIndigo
```

## Components

### Web experience

- [Account pages](https://github.com/tres7/afristay/tree/main/client/src/app/(auth)): `client/src/app/(auth)`
- [Discovery and stays](https://github.com/tres7/afristay/tree/main/client/src/app/(main)): `client/src/app/(main)`
- [Host workspace](https://github.com/tres7/afristay/tree/main/client/src/app/(main)/hote): `client/src/app/(main)/hote`
- [Reservation pages](https://github.com/tres7/afristay/tree/main/client/src/app/(main)/reservation): `client/src/app/(main)/reservation`
- [Profile and favorites](https://github.com/tres7/afristay/tree/main/client/src/app/(main)/profil): `client/src/app/(main)/profil`
- [Message pages](https://github.com/tres7/afristay/tree/main/client/src/app/(main)/messages): `client/src/app/(main)/messages`

### Accounts

- [Auth endpoints](https://github.com/tres7/afristay/blob/main/server/apps/users/infrastructure/http/controllers/AuthController.py): `server/apps/users/infrastructure/http/controllers/AuthController.py`
- [Profile endpoint](https://github.com/tres7/afristay/blob/main/server/apps/users/infrastructure/http/controllers/UserController.py): `server/apps/users/infrastructure/http/controllers/UserController.py`
- [User service](https://github.com/tres7/afristay/blob/main/server/apps/users/application/service/UserService.py): `server/apps/users/application/service/UserService.py`
- [User repository](https://github.com/tres7/afristay/blob/main/server/apps/users/infrastructure/persistence/DjangoUserRepository.py): `server/apps/users/infrastructure/persistence/DjangoUserRepository.py`
- [User records](https://github.com/tres7/afristay/blob/main/server/apps/users/infrastructure/persistence/models.py): `server/apps/users/infrastructure/persistence/models.py`

### Stay marketplace

- [Accommodation API](https://github.com/tres7/afristay/tree/main/server/apps/hebergements): `server/apps/hebergements`
- [Favorites API](https://github.com/tres7/afristay/tree/main/server/apps/favoris): `server/apps/favoris`

### Reservations and payment

- [Reservation API](https://github.com/tres7/afristay/tree/main/server/apps/reservations): `server/apps/reservations`
- **Mobile Money**

### Messaging

- [Conversation API](https://github.com/tres7/afristay/blob/main/server/apps/messaging/infrastructure/http/controllers/ConversationController.py): `server/apps/messaging/infrastructure/http/controllers/ConversationController.py`
- [Messaging service](https://github.com/tres7/afristay/blob/main/server/apps/messaging/application/service/MessagingService.py): `server/apps/messaging/application/service/MessagingService.py`
- [Conversation and messages](https://github.com/tres7/afristay/tree/main/server/apps/messaging/domain/entities): `server/apps/messaging/domain/entities`
- [Messaging repositories](https://github.com/tres7/afristay/tree/main/server/apps/messaging/infrastructure/persistence): `server/apps/messaging/infrastructure/persistence`
- [Messaging records and outbox](https://github.com/tres7/afristay/blob/main/server/apps/messaging/infrastructure/persistence/models.py): `server/apps/messaging/infrastructure/persistence/models.py`

### Other components

- **Traveler / host**

## Connections

- Traveler / host → Account pages: opens account
- Traveler / host → Discovery and stays: discovers stays
- Traveler / host → Host workspace: manages listings
- Traveler / host → Reservation pages: books stays
- Traveler / host → Profile and favorites: manages profile
- Traveler / host → Message pages: uses messaging
- Auth endpoints → User service: invokes (evidence: `server/apps/users/infrastructure/http/controllers/AuthController.py`)
- Profile endpoint → User service: invokes (evidence: `server/apps/users/infrastructure/http/controllers/UserController.py`)
- User service → User repository: reads and writes (evidence: `server/apps/users/application/service/UserService.py`)
- User repository → User records: persists users (evidence: `server/apps/users/infrastructure/persistence/DjangoUserRepository.py`)
- Conversation API → Messaging service: dispatches requests (evidence: `server/apps/messaging/infrastructure/http/controllers/ConversationController.py`)
- Messaging service → Conversation and messages: creates and checks (evidence: `server/apps/messaging/application/service/MessagingService.py`)
- Messaging service → Messaging repositories: loads and saves (evidence: `server/apps/messaging/application/service/MessagingService.py`)
- Messaging repositories → Messaging records and outbox: persists messages
- Messaging service → Accommodation API: looks up stays
- Reservation pages → Mobile Money: pays with
