# ranggawaridat/bukuin-digital-bookstore architecture

> Architecture diagram of the GitHub repository ranggawaridat/bukuin-digital-bookstore, 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/ranggawaridat/bukuin-digital-bookstore
- Repository: https://github.com/ranggawaridat/bukuin-digital-bookstore

## Overview

Bukuin is a Go/SQLite digital bookstore. Shoppers browse and search ebooks, register or sign in, manage a cart, check out through Midtrans, then review orders and access purchased titles in their library. Admins manage the catalog and orders and view sales statistics and analytics. The sampled entry point shows route wiring and the order repository shows checkout and payment calls; several other handlers and admin implementations were not sampled, so those links are limited to documented capabilities and visible route registration.

Main entry points: [`cmd/api/main.go`](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/cmd/api/main.go) (HTTP application), [`web/static`](https://github.com/ranggawaridat/bukuin-digital-bookstore/tree/main/web/static) (Bookstore pages), [`internal/order/repository.go`](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/order/repository.go) (Order and payment data), [`web/static/login.js`](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/login.js) (Sign-in pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_api["HTTP application<br/>[main.go]"]
  node_frontend["Bookstore pages"]
  node_authui["Sign-in pages<br/>[login.js]"]
  node_bookui["Catalog pages<br/>[books.js]"]
  node_cartui["Cart page<br/>[cart.js]"]
  node_orderui["Order pages<br/>[orders.js]"]
  node_libraryui["Library page<br/>[library.js]"]
  node_adminui["Admin dashboard<br/>[admin.js]"]
end

subgraph group_identity["Identity and catalog"]
  node_auth["Authentication<br/>[handler.go]"]
  node_authrepo["User sessions<br/>[repository.go]"]
  node_books["Book catalog<br/>[handler.go]"]
  node_bookadmin["Catalog management<br/>[admin_handler.go]"]
end

subgraph group_commerce["Shopping and fulfillment"]
  node_cart["Shopping cart<br/>[handler.go]"]
  node_cartrepo["Cart operations<br/>[repository.go]"]
  node_orders["Orders and library<br/>[handler.go]"]
  node_orderrepo["Order and payment data<br/>[repository.go]"]
end

subgraph group_admin["Administration"]
  node_admin["Admin reporting<br/>[admin.go]"]
  node_adminorders["Order management<br/>[orders.go]"]
end

subgraph group_data["Persistence and payments"]
  node_database["SQLite connection<br/>[database.go]"]
  node_store[("SQLite database")]
  node_midtrans["Midtrans Sandbox"]
end

node_shopper(("Shopper"))
node_adminuser(("Administrator"))

node_shopper -->|"HTTP requests"| node_api
node_adminuser -->|"HTTP requests"| node_api
node_api -->|"serves pages"| node_frontend
node_frontend -->|"loads scripts"| node_authui
node_frontend -->|"loads scripts"| node_bookui
node_frontend -->|"loads scripts"| node_cartui
node_frontend -->|"loads scripts"| node_orderui
node_frontend -->|"loads scripts"| node_libraryui
node_frontend -->|"loads scripts"| node_adminui
node_authui -->|"calls auth API"| node_api
node_bookui -->|"calls catalog API"| node_api
node_cartui -->|"calls cart API"| node_api
node_orderui -->|"calls order API"| node_api
node_libraryui -->|"calls library API"| node_api
node_adminui -->|"calls admin API"| node_api
node_api -->|"routes auth"| node_auth
node_api -->|"routes catalog"| node_books
node_api -->|"routes admin books"| node_bookadmin
node_api -->|"routes cart"| node_cart
node_api -->|"routes orders"| node_orders
node_api -->|"routes reporting"| node_admin
node_api -->|"routes order admin"| node_adminorders
node_auth -->|"reads and writes"| node_authrepo
node_books -->|"catalog queries"| node_store
node_bookadmin -->|"book changes"| node_store
node_cart -->|"cart operations"| node_cartrepo
node_cartrepo -->|"reads and writes"| node_store
node_orders -->|"order operations"| node_orderrepo
node_orderrepo -->|"reads and writes"| node_store
node_orderrepo -.->|"creates transaction"| node_midtrans
node_midtrans -.->|"payment notification"| node_api
node_api -->|"connects and migrates"| node_database
node_database -->|"opens connection"| node_store

click node_api "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/cmd/api/main.go"
click node_frontend "https://github.com/ranggawaridat/bukuin-digital-bookstore/tree/main/web/static"
click node_authui "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/login.js"
click node_bookui "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/books.js"
click node_cartui "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/cart.js"
click node_orderui "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/orders.js"
click node_libraryui "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/library.js"
click node_adminui "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/admin.js"
click node_auth "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/auth/handler.go"
click node_authrepo "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/auth/repository.go"
click node_books "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/book/handler.go"
click node_bookadmin "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/book/admin_handler.go"
click node_cart "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/cart/handler.go"
click node_cartrepo "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/cart/repository.go"
click node_orders "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/order/handler.go"
click node_orderrepo "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/order/repository.go"
click node_admin "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/admin/admin.go"
click node_adminorders "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/admin/orders.go"
click node_database "https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/database/database.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_api,node_frontend,node_authui,node_bookui,node_cartui,node_orderui,node_libraryui,node_adminui toneBlue
class node_auth,node_authrepo,node_books,node_bookadmin toneAmber
class node_cart,node_cartrepo,node_orders,node_orderrepo toneMint
class node_admin,node_adminorders toneRose
class node_database,node_store,node_midtrans,node_shopper,node_adminuser toneIndigo
```

## Components

### Web interface

- [HTTP application](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/cmd/api/main.go): `cmd/api/main.go`
- [Bookstore pages](https://github.com/ranggawaridat/bukuin-digital-bookstore/tree/main/web/static): `web/static`
- [Sign-in pages](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/login.js): `web/static/login.js`
- [Catalog pages](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/books.js): `web/static/books.js`
- [Cart page](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/cart.js): `web/static/cart.js`
- [Order pages](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/orders.js): `web/static/orders.js`
- [Library page](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/library.js): `web/static/library.js`
- [Admin dashboard](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/web/static/admin.js): `web/static/admin.js`

### Identity and catalog

- [Authentication](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/auth/handler.go): `internal/auth/handler.go`
- [User sessions](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/auth/repository.go): `internal/auth/repository.go`
- [Book catalog](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/book/handler.go): `internal/book/handler.go`
- [Catalog management](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/book/admin_handler.go): `internal/book/admin_handler.go`

### Shopping and fulfillment

- [Shopping cart](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/cart/handler.go): `internal/cart/handler.go`
- [Cart operations](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/cart/repository.go): `internal/cart/repository.go`
- [Orders and library](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/order/handler.go): `internal/order/handler.go`
- [Order and payment data](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/order/repository.go): `internal/order/repository.go`

### Administration

- [Admin reporting](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/admin/admin.go): `internal/admin/admin.go`
- [Order management](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/admin/orders.go): `internal/admin/orders.go`

### Persistence and payments

- [SQLite connection](https://github.com/ranggawaridat/bukuin-digital-bookstore/blob/main/internal/database/database.go): `internal/database/database.go`
- **SQLite database**
- **Midtrans Sandbox**

### Other components

- **Shopper**
- **Administrator**

## Connections

- Shopper → HTTP application: HTTP requests
- Administrator → HTTP application: HTTP requests
- HTTP application → Bookstore pages: serves pages
- Bookstore pages → Sign-in pages: loads scripts
- Bookstore pages → Catalog pages: loads scripts
- Bookstore pages → Cart page: loads scripts
- Bookstore pages → Order pages: loads scripts
- Bookstore pages → Library page: loads scripts
- Bookstore pages → Admin dashboard: loads scripts
- Sign-in pages → HTTP application: calls auth API
- Catalog pages → HTTP application: calls catalog API
- Cart page → HTTP application: calls cart API
- Order pages → HTTP application: calls order API
- Library page → HTTP application: calls library API
- Admin dashboard → HTTP application: calls admin API
- HTTP application → Authentication: routes auth
- HTTP application → Book catalog: routes catalog
- HTTP application → Catalog management: routes admin books
- HTTP application → Shopping cart: routes cart
- HTTP application → Orders and library: routes orders
- HTTP application → Admin reporting: routes reporting
- HTTP application → Order management: routes order admin
- Authentication → User sessions: reads and writes
- Book catalog → SQLite database: catalog queries
- Catalog management → SQLite database: book changes
- Shopping cart → Cart operations: cart operations
- Cart operations → SQLite database: reads and writes
- Orders and library → Order and payment data: order operations
- Order and payment data → SQLite database: reads and writes
- Order and payment data → Midtrans Sandbox: creates transaction
- Midtrans Sandbox → HTTP application: payment notification
- HTTP application → SQLite connection: connects and migrates
- SQLite connection → SQLite database: opens connection
