# haolader91/rabina-book-server-2 architecture

> Architecture diagram of the GitHub repository haolader91/rabina-book-server-2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/haolader91/rabina-book-server-2
- Repository: https://github.com/haolader91/rabina-book-server-2

## Overview

This is an Express API for a bookstore. Clients send requests through the server and app into versioned routes, which dispatch catalog operations or Better Auth handling; book and category services use Prisma to access PostgreSQL. The sampled code shows catalog CRUD and soft deletion, plus authentication configuration. The separate registration service is not mounted in the sampled route tree, and the README is empty, so neither is represented as an active workflow.

Main entry points: [`src/routes/index.ts`](https://github.com/haolader91/rabina-book-server-2/blob/main/src/routes/index.ts) (API routes), [`src/lib/prisma.ts`](https://github.com/haolader91/rabina-book-server-2/blob/main/src/lib/prisma.ts) (Prisma client), [`src/server.ts`](https://github.com/haolader91/rabina-book-server-2/blob/main/src/server.ts) (HTTP server), [`src/app.ts`](https://github.com/haolader91/rabina-book-server-2/blob/main/src/app.ts) (Express app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_server["HTTP server<br/>[server.ts]"]
  node_app["Express app<br/>[app.ts]"]
  node_routes["API routes<br/>[index.ts]"]
end

subgraph group_domain["Bookstore domains"]
  node_books["Book service<br/>[books.ts]"]
  node_categories["Category service<br/>[categories.ts]"]
end

subgraph group_storage["Auth and storage"]
  node_auth["Auth handler<br/>[auth.ts]"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_schema["Data schema<br/>[schema.prisma]"]
  node_postgres[("PostgreSQL")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_server
node_server -->|"starts"| node_app
node_app -->|"mounts API"| node_routes
node_routes -->|"dispatches books"| node_books
node_routes -->|"dispatches categories"| node_categories
node_routes -->|"dispatches auth"| node_auth
node_books -->|"queries"| node_prisma
node_categories -->|"queries"| node_prisma
node_auth -->|"uses adapter"| node_prisma
node_prisma -->|"reads and writes"| node_postgres
node_schema -.->|"defines data model"| node_postgres

click node_server "https://github.com/haolader91/rabina-book-server-2/blob/main/src/server.ts"
click node_app "https://github.com/haolader91/rabina-book-server-2/blob/main/src/app.ts"
click node_routes "https://github.com/haolader91/rabina-book-server-2/blob/main/src/routes/index.ts"
click node_books "https://github.com/haolader91/rabina-book-server-2/blob/main/src/services/books.ts"
click node_categories "https://github.com/haolader91/rabina-book-server-2/blob/main/src/services/categories.ts"
click node_auth "https://github.com/haolader91/rabina-book-server-2/blob/main/src/lib/auth.ts"
click node_prisma "https://github.com/haolader91/rabina-book-server-2/blob/main/src/lib/prisma.ts"
click node_schema "https://github.com/haolader91/rabina-book-server-2/blob/main/prisma/schema.prisma"

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_server,node_app,node_routes,node_client toneBlue
class node_books,node_categories toneAmber
class node_auth,node_prisma,node_schema,node_postgres toneMint
```

## Components

### HTTP API

- [HTTP server](https://github.com/haolader91/rabina-book-server-2/blob/main/src/server.ts): `src/server.ts`
- [Express app](https://github.com/haolader91/rabina-book-server-2/blob/main/src/app.ts): `src/app.ts`
- [API routes](https://github.com/haolader91/rabina-book-server-2/blob/main/src/routes/index.ts): `src/routes/index.ts`

### Bookstore domains

- [Book service](https://github.com/haolader91/rabina-book-server-2/blob/main/src/services/books.ts): `src/services/books.ts`
- [Category service](https://github.com/haolader91/rabina-book-server-2/blob/main/src/services/categories.ts): `src/services/categories.ts`

### Auth and storage

- [Auth handler](https://github.com/haolader91/rabina-book-server-2/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Prisma client](https://github.com/haolader91/rabina-book-server-2/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Data schema](https://github.com/haolader91/rabina-book-server-2/blob/main/prisma/schema.prisma): `prisma/schema.prisma`
- **PostgreSQL**

### Other components

- **API client**

## Connections

- API client → HTTP server: sends requests
- HTTP server → Express app: starts
- Express app → API routes: mounts API
- API routes → Book service: dispatches books
- API routes → Category service: dispatches categories
- API routes → Auth handler: dispatches auth
- Book service → Prisma client: queries
- Category service → Prisma client: queries
- Auth handler → Prisma client: uses adapter
- Prisma client → PostgreSQL: reads and writes
- Data schema → PostgreSQL: defines data model
