# thematrix2/bookstore-info-system architecture

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

- Interactive diagram: https://gitdiagram.com/thematrix2/bookstore-info-system
- Repository: https://github.com/thematrix2/bookstore-info-system

## Overview

This is a bookstore information system with a React storefront and employee admin panel backed by a Go HTTP API. Shoppers browse books and catalog metadata, authenticate, manage a cart, and place and track orders; employees manage catalog records, users, and order, payment, and delivery statuses. The frontend routes requests through a shared API client; the backend routes them through handlers, services, and repositories to the database. The route and wiring map is visible in the application entry point; several feature implementations are unsampled, so their internal calls are not expanded.

Main entry points: [`frontend/src/apps/client/pages`](https://github.com/thematrix2/bookstore-info-system/tree/master/frontend/src/apps/client/pages) (Storefront), [`frontend/src/apps/admin/pages`](https://github.com/thematrix2/bookstore-info-system/tree/master/frontend/src/apps/admin/pages) (Admin panel), [`frontend/src/App.tsx`](https://github.com/thematrix2/bookstore-info-system/blob/master/frontend/src/App.tsx) (Route selection), [`backend/internal/services`](https://github.com/thematrix2/bookstore-info-system/tree/master/backend/internal/services) (Domain services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web applications"]
  node_client["Storefront"]
  node_admin["Admin panel"]
  node_app["Route selection<br/>[App.tsx]"]
end

subgraph group_webcore["Frontend core"]
  node_authstate["Auth state<br/>[authStore.tsx]"]
  node_apiclient["API client<br/>[api.tsx]"]
  node_mappers["API mappers"]
end

subgraph group_api["HTTP API"]
  node_handlers["HTTP handlers"]
  node_middleware["Auth middleware"]
end

subgraph group_domain["Backend domain"]
  node_services["Domain services"]
  node_jwt["Token service<br/>[jwt.go]"]
end

subgraph group_data["Persistence"]
  node_repos["Repositories"]
  node_db["Database connection<br/>[db.go]"]
end

node_browser(("Shopper or employee"))
node_postgres[("PostgreSQL")]

node_browser -->|"uses"| node_app
node_app -->|"routes to"| node_client
node_app -->|"routes to"| node_admin
node_app -->|"checks roles"| node_authstate
node_client -->|"fetches data"| node_apiclient
node_admin -->|"fetches data"| node_apiclient
node_client -->|"uses"| node_authstate
node_admin -->|"uses"| node_authstate
node_client -->|"maps responses"| node_mappers
node_admin -->|"maps responses"| node_mappers
node_apiclient -->|"sends requests"| node_handlers
node_handlers -->|"calls"| node_services
node_middleware -->|"validates tokens"| node_jwt
node_services -->|"delegates data access"| node_repos
node_services -->|"issues tokens"| node_jwt
node_repos -->|"uses connection"| node_db
node_db -.->|"connects"| node_postgres

click node_client "https://github.com/thematrix2/bookstore-info-system/tree/master/frontend/src/apps/client/pages"
click node_admin "https://github.com/thematrix2/bookstore-info-system/tree/master/frontend/src/apps/admin/pages"
click node_app "https://github.com/thematrix2/bookstore-info-system/blob/master/frontend/src/App.tsx"
click node_authstate "https://github.com/thematrix2/bookstore-info-system/blob/master/frontend/src/shared/authStore.tsx"
click node_apiclient "https://github.com/thematrix2/bookstore-info-system/blob/master/frontend/src/shared/api.tsx"
click node_mappers "https://github.com/thematrix2/bookstore-info-system/tree/master/frontend/src/mappers"
click node_handlers "https://github.com/thematrix2/bookstore-info-system/tree/master/backend/handlers"
click node_middleware "https://github.com/thematrix2/bookstore-info-system/tree/master/backend/middleware"
click node_services "https://github.com/thematrix2/bookstore-info-system/tree/master/backend/internal/services"
click node_jwt "https://github.com/thematrix2/bookstore-info-system/blob/master/backend/internal/services/jwt.go"
click node_repos "https://github.com/thematrix2/bookstore-info-system/tree/master/backend/repository"
click node_db "https://github.com/thematrix2/bookstore-info-system/blob/master/backend/internal/db/db.go"

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_client,node_admin,node_app toneBlue
class node_authstate,node_apiclient,node_mappers,node_postgres toneAmber
class node_handlers,node_middleware toneMint
class node_services,node_jwt toneRose
class node_repos,node_db,node_browser toneIndigo
```

## Components

### Web applications

- [Storefront](https://github.com/thematrix2/bookstore-info-system/tree/master/frontend/src/apps/client/pages): `frontend/src/apps/client/pages`
- [Admin panel](https://github.com/thematrix2/bookstore-info-system/tree/master/frontend/src/apps/admin/pages): `frontend/src/apps/admin/pages`
- [Route selection](https://github.com/thematrix2/bookstore-info-system/blob/master/frontend/src/App.tsx): `frontend/src/App.tsx`

### Frontend core

- [Auth state](https://github.com/thematrix2/bookstore-info-system/blob/master/frontend/src/shared/authStore.tsx): `frontend/src/shared/authStore.tsx`
- [API client](https://github.com/thematrix2/bookstore-info-system/blob/master/frontend/src/shared/api.tsx): `frontend/src/shared/api.tsx`
- [API mappers](https://github.com/thematrix2/bookstore-info-system/tree/master/frontend/src/mappers): `frontend/src/mappers`

### HTTP API

- [HTTP handlers](https://github.com/thematrix2/bookstore-info-system/tree/master/backend/handlers): `backend/handlers`
- [Auth middleware](https://github.com/thematrix2/bookstore-info-system/tree/master/backend/middleware): `backend/middleware`

### Backend domain

- [Domain services](https://github.com/thematrix2/bookstore-info-system/tree/master/backend/internal/services): `backend/internal/services`
- [Token service](https://github.com/thematrix2/bookstore-info-system/blob/master/backend/internal/services/jwt.go): `backend/internal/services/jwt.go`

### Persistence

- [Repositories](https://github.com/thematrix2/bookstore-info-system/tree/master/backend/repository): `backend/repository`
- [Database connection](https://github.com/thematrix2/bookstore-info-system/blob/master/backend/internal/db/db.go): `backend/internal/db/db.go`

### Other components

- **Shopper or employee**
- **PostgreSQL**

## Connections

- Shopper or employee → Route selection: uses
- Route selection → Storefront: routes to (evidence: `frontend/src/App.tsx`)
- Route selection → Admin panel: routes to (evidence: `frontend/src/App.tsx`)
- Route selection → Auth state: checks roles (evidence: `frontend/src/App.tsx`)
- Storefront → API client: fetches data (evidence: `frontend/src/apps/client/pages/CartPage.tsx`)
- Admin panel → API client: fetches data (evidence: `frontend/src/apps/admin/pages/AuthorsAdminPage.tsx`)
- Storefront → Auth state: uses (evidence: `frontend/src/apps/client/pages/CartPage.tsx`)
- Admin panel → Auth state: uses (evidence: `frontend/src/apps/admin/pages/AuthorsAdminPage.tsx`)
- Storefront → API mappers: maps responses (evidence: `frontend/src/apps/client/pages/OrdersPage.tsx`)
- Admin panel → API mappers: maps responses (evidence: `frontend/src/apps/admin/pages/AuthorsAdminPage.tsx`)
- API client → HTTP handlers: sends requests (evidence: `frontend/src/shared/api.tsx`)
- HTTP handlers → Domain services: calls (evidence: `backend/handlers/author.go`)
- Auth middleware → Token service: validates tokens (evidence: `backend/middleware/auth.go`)
- Domain services → Repositories: delegates data access (evidence: `backend/cmd/app/main.go`)
- Domain services → Token service: issues tokens (evidence: `backend/internal/services/auth.go`)
- Repositories → Database connection: uses connection
- Database connection → PostgreSQL: connects (evidence: `README.md`)
