# leandro8279/barbearia architecture

> Architecture diagram of the GitHub repository leandro8279/barbearia, 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/leandro8279/barbearia
- Repository: https://github.com/leandro8279/barbearia

## Overview

This repository contains a barbershop booking web app and an Express backend. The principal workflow is selecting public services, progressing through booking details and availability, then reviewing and confirming a reservation; account and admin screens provide separate product areas. The sampled frontend shows service-catalog loading and booking-state updates, while backend excerpts show user-module wiring and persistence. Many listed admin, account, and booking capabilities are unsampled, so their internal links are omitted rather than inferred.

Main entry points: [`frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts`](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts) (Review and confirm), [`frontend/src/modules/site/hooks/use-public-service-catalog.ts`](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/site/hooks/use-public-service-catalog.ts) (Service catalog), [`backend/src/modules/users/users.module.ts`](https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/users.module.ts) (User module wiring), [`backend/src/modules/users/infra/database/typeorm/repositories/TypeOrmUserRepository.ts`](https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/infra/database/typeorm/repositories/TypeOrmUserRepository.ts) (User repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public site"]
  node_home["Home and services<br/>[home-page.tsx]"]
  node_service_catalog["Service catalog"]
  node_services_api["Catalog API client<br/>[services.ts]"]
end

subgraph group_booking["Booking and account"]
  node_booking_services["Choose services"]
  node_booking_barber["Choose barber"]
  node_booking_slot["Choose time"]
  node_booking_customer["Customer details"]
  node_booking_review["Review and confirm"]
  node_booking_data["Booking queries"]
  node_booking_api["Booking API client<br/>[booking.ts]"]
  node_booking_draft["Booking draft state"]
  node_account["Customer account"]
end

subgraph group_admin["Admin operations"]
  node_admin_agenda["Appointment agenda"]
  node_admin_dashboard["Admin dashboard"]
  node_admin_day["My day"]
end

subgraph group_backend["Backend services"]
  node_backend_app["HTTP application<br/>[app.ts]"]
  node_user_module["User module wiring<br/>[users.module.ts]"]
  node_create_user["Create user"]
  node_user_repository["User repository"]
  node_user_store[("User records<br/>[UserEntity.ts]")]
  node_user_mapper["User mapper<br/>[UserMapper.ts]"]
end

node_visitor(("Customer"))

node_visitor -.->|"browses"| node_home
node_home -.->|"loads catalog"| node_service_catalog
node_service_catalog -->|"fetches catalog"| node_services_api
node_booking_services -->|"reads services"| node_service_catalog
node_booking_services -->|"updates selection"| node_booking_draft
node_booking_review -->|"loads booking data"| node_booking_data
node_booking_review -->|"reads services"| node_service_catalog
node_booking_review -->|"reads reservation"| node_booking_draft
node_booking_review -->|"releases hold"| node_booking_api
node_booking_review -->|"submits booking"| node_booking_data
node_backend_app -->|"registers modules"| node_user_module
node_user_module -->|"constructs use case"| node_create_user
node_user_module -->|"constructs repository"| node_user_repository
node_user_repository -->|"reads and writes"| node_user_store
node_user_repository -->|"maps records"| node_user_mapper

click node_home "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/site/pages/home-page.tsx"
click node_service_catalog "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/site/hooks/use-public-service-catalog.ts"
click node_services_api "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/site/api/services.ts"
click node_booking_services "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/services-step-page/useBookingServicesPage.ts"
click node_booking_barber "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/barber-step-page/useBookingBarberPage.ts"
click node_booking_slot "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/slot-step-page/useBookingSlotPage.ts"
click node_booking_customer "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/customer-details-step-page/useBookingCustomerDetailsPage.ts"
click node_booking_review "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts"
click node_booking_data "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/hooks/use-booking-data.ts"
click node_booking_api "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/api/booking.ts"
click node_booking_draft "https://github.com/leandro8279/barbearia/blob/main/frontend/src/shared/stores/booking-draft-store.tsx"
click node_account "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/account/pages/account-overview-page.tsx"
click node_admin_agenda "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/admin/agenda/pages/admin-agenda-page.tsx"
click node_admin_dashboard "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/admin/dashboard/pages/admin-dashboard-page.tsx"
click node_admin_day "https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/admin/dashboard/pages/admin-my-day-page.tsx"
click node_backend_app "https://github.com/leandro8279/barbearia/blob/main/backend/src/app.ts"
click node_user_module "https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/users.module.ts"
click node_create_user "https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/application/use-cases/CreateUserUseCase.ts"
click node_user_repository "https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/infra/database/typeorm/repositories/TypeOrmUserRepository.ts"
click node_user_store "https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/infra/database/typeorm/entities/UserEntity.ts"
click node_user_mapper "https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/infra/database/typeorm/mappers/UserMapper.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_home,node_service_catalog,node_services_api toneBlue
class node_booking_services,node_booking_barber,node_booking_slot,node_booking_customer,node_booking_review,node_booking_data,node_booking_api,node_booking_draft,node_account toneAmber
class node_admin_agenda,node_admin_dashboard,node_admin_day toneMint
class node_backend_app,node_user_module,node_create_user,node_user_repository,node_user_store,node_user_mapper toneRose
class node_visitor toneIndigo
```

## Components

### Public site

- [Home and services](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/site/pages/home-page.tsx): `frontend/src/modules/site/pages/home-page.tsx`
- [Service catalog](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/site/hooks/use-public-service-catalog.ts): `frontend/src/modules/site/hooks/use-public-service-catalog.ts`
- [Catalog API client](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/site/api/services.ts): `frontend/src/modules/site/api/services.ts`

### Booking and account

- [Choose services](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/services-step-page/useBookingServicesPage.ts): `frontend/src/modules/booking/pages/services-step-page/useBookingServicesPage.ts`
- [Choose barber](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/barber-step-page/useBookingBarberPage.ts): `frontend/src/modules/booking/pages/barber-step-page/useBookingBarberPage.ts`
- [Choose time](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/slot-step-page/useBookingSlotPage.ts): `frontend/src/modules/booking/pages/slot-step-page/useBookingSlotPage.ts`
- [Customer details](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/customer-details-step-page/useBookingCustomerDetailsPage.ts): `frontend/src/modules/booking/pages/customer-details-step-page/useBookingCustomerDetailsPage.ts`
- [Review and confirm](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts): `frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts`
- [Booking queries](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/hooks/use-booking-data.ts): `frontend/src/modules/booking/hooks/use-booking-data.ts`
- [Booking API client](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/booking/api/booking.ts): `frontend/src/modules/booking/api/booking.ts`
- [Booking draft state](https://github.com/leandro8279/barbearia/blob/main/frontend/src/shared/stores/booking-draft-store.tsx): `frontend/src/shared/stores/booking-draft-store.tsx`
- [Customer account](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/account/pages/account-overview-page.tsx): `frontend/src/modules/account/pages/account-overview-page.tsx`

### Admin operations

- [Appointment agenda](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/admin/agenda/pages/admin-agenda-page.tsx): `frontend/src/modules/admin/agenda/pages/admin-agenda-page.tsx`
- [Admin dashboard](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/admin/dashboard/pages/admin-dashboard-page.tsx): `frontend/src/modules/admin/dashboard/pages/admin-dashboard-page.tsx`
- [My day](https://github.com/leandro8279/barbearia/blob/main/frontend/src/modules/admin/dashboard/pages/admin-my-day-page.tsx): `frontend/src/modules/admin/dashboard/pages/admin-my-day-page.tsx`

### Backend services

- [HTTP application](https://github.com/leandro8279/barbearia/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [User module wiring](https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/users.module.ts): `backend/src/modules/users/users.module.ts`
- [Create user](https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/application/use-cases/CreateUserUseCase.ts): `backend/src/modules/users/application/use-cases/CreateUserUseCase.ts`
- [User repository](https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/infra/database/typeorm/repositories/TypeOrmUserRepository.ts): `backend/src/modules/users/infra/database/typeorm/repositories/TypeOrmUserRepository.ts`
- [User records](https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/infra/database/typeorm/entities/UserEntity.ts): `backend/src/modules/users/infra/database/typeorm/entities/UserEntity.ts`
- [User mapper](https://github.com/leandro8279/barbearia/blob/main/backend/src/modules/users/infra/database/typeorm/mappers/UserMapper.ts): `backend/src/modules/users/infra/database/typeorm/mappers/UserMapper.ts`

### Other components

- **Customer**

## Connections

- Customer → Home and services: browses
- Home and services → Service catalog: loads catalog
- Service catalog → Catalog API client: fetches catalog (evidence: `frontend/src/modules/site/hooks/use-public-service-catalog.ts`)
- Choose services → Service catalog: reads services (evidence: `frontend/src/modules/booking/pages/services-step-page/useBookingServicesPage.ts`)
- Choose services → Booking draft state: updates selection (evidence: `frontend/src/modules/booking/pages/services-step-page/useBookingServicesPage.ts`)
- Review and confirm → Booking queries: loads booking data (evidence: `frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts`)
- Review and confirm → Service catalog: reads services (evidence: `frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts`)
- Review and confirm → Booking draft state: reads reservation (evidence: `frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts`)
- Review and confirm → Booking API client: releases hold (evidence: `frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts`)
- Review and confirm → Booking queries: submits booking (evidence: `frontend/src/modules/booking/pages/review-payment-step-page/useBookingReviewPaymentPage.ts`)
- HTTP application → User module wiring: registers modules (evidence: `backend/src/app.ts`)
- User module wiring → Create user: constructs use case (evidence: `backend/src/modules/users/users.module.ts`)
- User module wiring → User repository: constructs repository (evidence: `backend/src/modules/users/users.module.ts`)
- User repository → User records: reads and writes (evidence: `backend/src/modules/users/infra/database/typeorm/repositories/TypeOrmUserRepository.ts`)
- User repository → User mapper: maps records (evidence: `backend/src/modules/users/infra/database/typeorm/repositories/TypeOrmUserRepository.ts`)
