# tenkamylove/sistem-pencarian-pasal architecture

> Architecture diagram of the GitHub repository tenkamylove/sistem-pencarian-pasal, 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/tenkamylove/sistem-pencarian-pasal
- Repository: https://github.com/tenkamylove/sistem-pencarian-pasal

## Overview

P3H Kemenkum Kalsel is a web application for finding statutory articles and supporting regional-draft harmonization. Users search indexed regulations by text, sector, and jurisdiction, inspect legal-status details and source-document links, and staff manage meeting schedules; administrators also manage accounts. A regulation-ingestion workflow accepts a URL, extracts regulation and article data, and stores it for search. The graph follows the sampled server, search, schedule, authentication, database, crawler, and recrawl code; account-management and ingestion routes are represented from documented capabilities and tree paths where their route implementations were not sampled.

Main entry points: [`src/index.ts`](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/index.ts) (Hono server), [`src/db/index.ts`](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/db/index.ts) (Application database), [`src/routes/search.tsx`](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/search.tsx) (Search routes), [`src/middleware/auth.ts`](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/middleware/auth.ts) (Session and roles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_server["Hono server<br/>[index.ts]"]
  node_layout["Shared layout<br/>[layout.tsx]"]
  node_database[("Application database<br/>[index.ts]")]
end

subgraph group_identity["Identity and access"]
  node_authroutes["Login routes<br/>[auth.tsx]"]
  node_authmw["Session and roles<br/>[auth.ts]"]
  node_adminroutes["Account management<br/>[admin.tsx]"]
end

subgraph group_content["Regulation search"]
  node_searchroutes["Search routes<br/>[search.tsx]"]
  node_searchview["Search interface<br/>[search.tsx]"]
  node_ingestroutes["Add regulation routes"]
  node_ingestview["Regulation entry form"]
  node_crawler["URL crawler<br/>[urlCrawler.ts]"]
  node_recrawl["Link health check<br/>[recrawl.ts]"]
end

subgraph group_operations["Harmonization operations"]
  node_jadwalroutes["Schedule routes<br/>[jadwal.tsx]"]
  node_jadwalview["Schedule interface<br/>[jadwal.tsx]"]
end

node_users(("Public and staff"))
node_legalportals["Legal document portals"]

node_users -->|"send requests"| node_server
node_server -->|"dispatches"| node_authroutes
node_server -->|"dispatches"| node_searchroutes
node_server -->|"dispatches"| node_jadwalroutes
node_server -->|"dispatches"| node_adminroutes
node_server -->|"dispatches"| node_ingestroutes
node_server -->|"runs cron check"| node_recrawl
node_authroutes -->|"reads and sets sessions"| node_authmw
node_authroutes -->|"reads accounts"| node_database
node_adminroutes -->|"checks roles"| node_authmw
node_adminroutes -->|"manages accounts"| node_database
node_searchroutes -->|"allows guests"| node_authmw
node_searchroutes -->|"queries regulations"| node_database
node_searchroutes -->|"renders results"| node_searchview
node_searchview -->|"requests filtered results"| node_searchroutes
node_searchview -->|"uses shell"| node_layout
node_jadwalroutes -->|"requires staff"| node_authmw
node_jadwalroutes -->|"reads and writes schedules"| node_database
node_jadwalroutes -->|"renders schedules"| node_jadwalview
node_jadwalview -->|"uses shell"| node_layout
node_ingestroutes -->|"checks access"| node_authmw
node_ingestroutes -->|"renders form"| node_ingestview
node_ingestview -->|"uses shell"| node_layout
node_ingestroutes -->|"submits URL"| node_crawler
node_crawler -.->|"fetches pages"| node_legalportals
node_crawler -->|"stores regulations and articles"| node_database
node_recrawl -->|"checks and updates links"| node_database

click node_server "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/index.ts"
click node_authroutes "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/auth.tsx"
click node_authmw "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/middleware/auth.ts"
click node_adminroutes "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/admin.tsx"
click node_searchroutes "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/search.tsx"
click node_searchview "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/views/search.tsx"
click node_layout "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/views/layout.tsx"
click node_database "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/db/index.ts"
click node_jadwalroutes "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/jadwal.tsx"
click node_jadwalview "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/views/jadwal.tsx"
click node_ingestroutes "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/tambah-peraturan.tsx"
click node_ingestview "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/views/tambah-peraturan.tsx"
click node_crawler "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/scraper/urlCrawler.ts"
click node_recrawl "https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/scraper/recrawl.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_server,node_layout,node_database toneBlue
class node_authroutes,node_authmw,node_adminroutes toneAmber
class node_searchroutes,node_searchview,node_ingestroutes,node_ingestview,node_crawler,node_recrawl toneMint
class node_jadwalroutes,node_jadwalview toneRose
class node_users,node_legalportals toneIndigo
```

## Components

### Web application

- [Hono server](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/index.ts): `src/index.ts`
- [Shared layout](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/views/layout.tsx): `src/views/layout.tsx`
- [Application database](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/db/index.ts): `src/db/index.ts`

### Identity and access

- [Login routes](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`
- [Session and roles](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/middleware/auth.ts): `src/middleware/auth.ts`
- [Account management](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/admin.tsx): `src/routes/admin.tsx`

### Regulation search

- [Search routes](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/search.tsx): `src/routes/search.tsx`
- [Search interface](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/views/search.tsx): `src/views/search.tsx`
- [Add regulation routes](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/tambah-peraturan.tsx): `src/routes/tambah-peraturan.tsx`
- [Regulation entry form](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/views/tambah-peraturan.tsx): `src/views/tambah-peraturan.tsx`
- [URL crawler](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/scraper/urlCrawler.ts): `src/scraper/urlCrawler.ts`
- [Link health check](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/scraper/recrawl.ts): `src/scraper/recrawl.ts`

### Harmonization operations

- [Schedule routes](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/routes/jadwal.tsx): `src/routes/jadwal.tsx`
- [Schedule interface](https://github.com/tenkamylove/sistem-pencarian-pasal/blob/main/src/views/jadwal.tsx): `src/views/jadwal.tsx`

### Other components

- **Public and staff**
- **Legal document portals**

## Connections

- Public and staff → Hono server: send requests
- Hono server → Login routes: dispatches
- Hono server → Search routes: dispatches
- Hono server → Schedule routes: dispatches
- Hono server → Account management: dispatches
- Hono server → Add regulation routes: dispatches
- Hono server → Link health check: runs cron check
- Login routes → Session and roles: reads and sets sessions
- Login routes → Application database: reads accounts
- Account management → Session and roles: checks roles
- Account management → Application database: manages accounts
- Search routes → Session and roles: allows guests
- Search routes → Application database: queries regulations
- Search routes → Search interface: renders results
- Search interface → Search routes: requests filtered results
- Search interface → Shared layout: uses shell
- Schedule routes → Session and roles: requires staff
- Schedule routes → Application database: reads and writes schedules
- Schedule routes → Schedule interface: renders schedules
- Schedule interface → Shared layout: uses shell
- Add regulation routes → Session and roles: checks access
- Add regulation routes → Regulation entry form: renders form
- Regulation entry form → Shared layout: uses shell
- Add regulation routes → URL crawler: submits URL
- URL crawler → Legal document portals: fetches pages
- URL crawler → Application database: stores regulations and articles
- Link health check → Application database: checks and updates links
