# sirpdboy/luci-theme-kucat architecture

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

- Interactive diagram: https://gitdiagram.com/sirpdboy/luci-theme-kucat
- Repository: https://github.com/sirpdboy/luci-theme-kucat

## Overview

1. **What this repository is**
   - This is an OpenWrt LuCI **theme/package** for the KuCat UI, not a standalone web app.
   - Its job is to provide the look-and-feel, layout templates, menu customization, and a small amount of router-side integration for theme settings.

2. **Primary runtime boundary**
   - The main boundary is between the **browser-facing LuCI UI** and the **router-side LuCI/OpenWrt environment**.
   - Most of the repository is static presentation content served from `/www/luci-static/...`; only a few pieces touch backend services or boot-time configuration.

3. **Static theme asset subsystem**
   - `htdocs/luci-static/kucat/` contains the theme’s front-end assets:
     - `css/` for the core style and dark theme variants
     - `js/` for UI behavior
     - `fonts/`, `img/`, `manifest.json`, and `browserconfig.xml`
     - `background/` documentation and assets related to login/desktop backgrounds
   - This is the bulk of the UI surface rendered in the browser.

4. **LuCI integration and menu behavior**
   - `htdocs/luci-static/resources/menu-kucat.js` is the LuCI-side JavaScript that influences menu presentation/behavior.
   - From the README, the theme supports custom menus and a shortcut toolbar; this file is part of the integration layer that makes the theme interact with LuCI’s navigation model.

5. **Template rendering subsystem**
   - `ucode/template/themes/kucat/header.ut` and `footer.ut` provide **UCode templates** for the LuCI page shell.
   - These are the server-rendered entry/exit points for newer OpenWrt/LuCI branches, shaping the page structure around the static CSS/JS assets.

6. **Backend helper / RPC boundary**
   - `root/usr/libexec/rpcd/luci.kucatget` is a router-side executable used by **rpcd**.
   - This suggests the theme or its companion config app can query theme-related state through LuCI’s RPC mechanism rather than embedding logic directly in the browser.

7. **Permissions / access control**
   - `root/usr/share/rpcd/acl.d/luci-theme-kucat.json` defines the ACLs needed for the rpcd helper.
   - Architecturally, this is the authorization boundary that allows LuCI JS or config pages to call the theme helper safely.

8. **Boot-time defaults and migration hooks**
   - `root/etc/uci-defaults/30_luci-kuacat` and `root/etc/uci-defaults/30_luci-kucat` are initialization scripts run on installation/first boot.
   - These scripts seed or migrate OpenWrt UCI settings so the theme starts with expected defaults.

9. **Version compatibility / multi-branch packaging**
   - The README indicates support for multiple OpenWrt/LuCI generations:
     - **18.06** uses the older LuCI stack
     - **23.05 / latest** uses newer LuCI with UCode support
   - The presence of both `htdocs/luci-static/...` and `ucode/template/...` shows the repo is structured to serve different LuCI runtime paths depending on the OpenWrt branch.

10. **Configuration is split into a companion app**
   - The README explicitly notes that more advanced theme settings live in a separate package, `luci-app-kucat-config`.
   - So this repository is the **theme/runtime base**, while the companion app is the **configuration UI and settings manager**; the theme consumes those settings but doesn’t fully implement that management UI itself.

11. **Build and packaging layer**
   - `Makefile` and `.github/workflows/Build.yml` indicate standard OpenWrt-style packaging and CI release automation.
   - The repo is intended to be built into an installable IPK that OpenWrt’s package system deploys into the LuCI filesystem layout.

12. **Data flow summary**
   - Build/install places files into the router filesystem.
   - LuCI renders headers/footers via UCode templates.
   - The browser loads CSS/JS/fonts/images from `luci-static`.
   - Menu/theme-specific behavior may call rpcd helper `luci.kucatget` through ACL-protected endpoints.
   - UCI-default scripts initialize the theme’s persistent configuration.

Main entry points: [`Makefile`](https://github.com/sirpdboy/luci-theme-kucat/tree/master/Makefile) (Makefile), [`root/usr/libexec/rpcd/luci.kucatget`](https://github.com/sirpdboy/luci-theme-kucat/blob/master/root/usr/libexec/rpcd/luci.kucatget) (RPC helper), [`htdocs/luci-static/kucat/css/style.css`](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/css/style.css) (Style CSS), [`ucode/template/themes/kucat/header.ut`](https://github.com/sirpdboy/luci-theme-kucat/blob/master/ucode/template/themes/kucat/header.ut) (Header template)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_build["Build & packaging"]
  node_node_makefile["Makefile<br/>packaging"]
  node_node_ci["Build CI<br/>workflow<br/>[Build.yml]"]
  node_node_readme["Docs<br/>[README.md]"]
  node_node_readme_cn["中文文档<br/>docs<br/>[README_CN.md]"]
end

subgraph group_group_browser["Browser theme assets"]
  node_node_style_css["Style CSS<br/>theme css<br/>[style.css]"]
  node_node_dark_css["Dark CSS<br/>theme css<br/>[dark.css]"]
  node_node_style_js["Style JS<br/>ui script<br/>[style.js]"]
  node_node_footend_js["Footer JS<br/>ui script<br/>[footend.js]"]
  node_node_fonts[("Fonts<br/>asset pack<br/>[kucat.eot]")]
  node_node_images[("Images<br/>asset pack")]
  node_node_manifest["Manifest<br/>pwa metadata<br/>[manifest.json]"]
  node_node_browserconfig["Browser config<br/>browser metadata<br/>[browserconfig.xml]"]
  node_node_background_docs["Background docs<br/>asset docs<br/>[README.md]"]
end

subgraph group_group_luci["LuCI integration"]
  node_node_menu_js["Menu hook<br/>luci js<br/>[menu-kucat.js]"]
  node_node_header_ut["Header template<br/>ucode template<br/>[header.ut]"]
  node_node_footer_ut["Footer template<br/>ucode template<br/>[footer.ut]"]
end

subgraph group_group_router["Router backend"]
  node_node_uci_defaults_a["Defaults 1<br/>uci defaults"]
  node_node_uci_defaults_b["Defaults 2<br/>uci defaults"]
  node_node_rpc_helper["RPC helper<br/>rpcd exec<br/>[luci.kucatget]"]
  node_node_acl["RPC ACL<br/>rpcd acl"]
end

node_node_makefile -->|"packages"| node_node_header_ut
node_node_makefile -->|"packages"| node_node_style_css
node_node_makefile -->|"packages"| node_node_style_js
node_node_makefile -->|"packages"| node_node_menu_js
node_node_makefile -->|"packages"| node_node_rpc_helper
node_node_makefile -->|"packages"| node_node_acl
node_node_ci -->|"builds"| node_node_makefile
node_node_readme -.->|"describes"| node_node_menu_js
node_node_readme -.->|"describes"| node_node_rpc_helper
node_node_header_ut -->|"loads"| node_node_style_css
node_node_header_ut -->|"references"| node_node_manifest
node_node_header_ut -->|"references"| node_node_browserconfig
node_node_footer_ut -->|"loads"| node_node_style_js
node_node_footer_ut -->|"loads"| node_node_footend_js
node_node_style_js -->|"coordinates"| node_node_menu_js
node_node_menu_js -->|"calls"| node_node_rpc_helper
node_node_rpc_helper -->|"governed by"| node_node_acl
node_node_uci_defaults_a -->|"initializes"| node_node_rpc_helper
node_node_uci_defaults_b -->|"initializes"| node_node_rpc_helper
node_node_background_docs -.->|"documents"| node_node_images
node_node_style_css -->|"uses"| node_node_images
node_node_style_css -->|"uses"| node_node_fonts
node_node_dark_css -->|"extends"| node_node_style_css

click node_node_makefile "https://github.com/sirpdboy/luci-theme-kucat/tree/master/Makefile"
click node_node_ci "https://github.com/sirpdboy/luci-theme-kucat/blob/master/.github/workflows/Build.yml"
click node_node_readme "https://github.com/sirpdboy/luci-theme-kucat/blob/master/README.md"
click node_node_readme_cn "https://github.com/sirpdboy/luci-theme-kucat/blob/master/README_CN.md"
click node_node_style_css "https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/css/style.css"
click node_node_dark_css "https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/css/dark.css"
click node_node_style_js "https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/js/style.js"
click node_node_footend_js "https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/js/footend.js"
click node_node_fonts "https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/fonts/kucat.eot"
click node_node_images "https://github.com/sirpdboy/luci-theme-kucat/tree/master/htdocs/luci-static/kucat/img"
click node_node_manifest "https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/manifest.json"
click node_node_browserconfig "https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/browserconfig.xml"
click node_node_background_docs "https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/background/README.md"
click node_node_menu_js "https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/resources/menu-kucat.js"
click node_node_header_ut "https://github.com/sirpdboy/luci-theme-kucat/blob/master/ucode/template/themes/kucat/header.ut"
click node_node_footer_ut "https://github.com/sirpdboy/luci-theme-kucat/blob/master/ucode/template/themes/kucat/footer.ut"
click node_node_uci_defaults_a "https://github.com/sirpdboy/luci-theme-kucat/tree/master/root/etc/uci-defaults/30_luci-kuacat"
click node_node_uci_defaults_b "https://github.com/sirpdboy/luci-theme-kucat/tree/master/root/etc/uci-defaults/30_luci-kucat"
click node_node_rpc_helper "https://github.com/sirpdboy/luci-theme-kucat/blob/master/root/usr/libexec/rpcd/luci.kucatget"
click node_node_acl "https://github.com/sirpdboy/luci-theme-kucat/blob/master/root/usr/share/rpcd/acl.d/luci-theme-kucat.json"

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_node_makefile,node_node_ci,node_node_readme,node_node_readme_cn toneBlue
class node_node_style_css,node_node_dark_css,node_node_style_js,node_node_footend_js,node_node_fonts,node_node_images,node_node_manifest,node_node_browserconfig,node_node_background_docs toneAmber
class node_node_menu_js,node_node_header_ut,node_node_footer_ut toneMint
class node_node_uci_defaults_a,node_node_uci_defaults_b,node_node_rpc_helper,node_node_acl toneRose
```

## Components

### Build & packaging

OpenWrt packaging and CI automation for producing the theme IPK.

- [Makefile](https://github.com/sirpdboy/luci-theme-kucat/tree/master/Makefile): packaging · OpenWrt package definition and install layout. · `Makefile`
- [Build CI](https://github.com/sirpdboy/luci-theme-kucat/blob/master/.github/workflows/Build.yml): workflow · GitHub Actions workflow for automated builds. · `.github/workflows/Build.yml`
- [Docs](https://github.com/sirpdboy/luci-theme-kucat/blob/master/README.md): docs · Repository documentation and usage notes. · `README.md`
- [中文文档](https://github.com/sirpdboy/luci-theme-kucat/blob/master/README_CN.md): docs · Chinese-language repository documentation. · `README_CN.md`

### Browser theme assets

Static files served to the LuCI browser UI.

- [Style CSS](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/css/style.css): theme css · Core theme styling for layout and visuals. · `htdocs/luci-static/kucat/css/style.css`
- [Dark CSS](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/css/dark.css): theme css · Dark-mode or alternate visual styling. · `htdocs/luci-static/kucat/css/dark.css`
- [Style JS](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/js/style.js): ui script · Browser-side behavior for the theme. · `htdocs/luci-static/kucat/js/style.js`
- [Footer JS](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/js/footend.js): ui script · Additional browser-side behavior loaded near the page end. · `htdocs/luci-static/kucat/js/footend.js`
- [Fonts](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/fonts/kucat.eot): asset pack · Theme font assets. · `htdocs/luci-static/kucat/fonts/kucat.eot`
- [Images](https://github.com/sirpdboy/luci-theme-kucat/tree/master/htdocs/luci-static/kucat/img): asset pack · Theme image assets used by the UI. · `htdocs/luci-static/kucat/img`
- [Manifest](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/manifest.json): pwa metadata · Browser install metadata for the theme. · `htdocs/luci-static/kucat/manifest.json`
- [Browser config](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/browserconfig.xml): browser metadata · Windows/legacy browser configuration metadata. · `htdocs/luci-static/kucat/browserconfig.xml`
- [Background docs](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/kucat/background/README.md): asset docs · Documentation for login/desktop background assets. · `htdocs/luci-static/kucat/background/README.md`

### LuCI integration

Theme hooks that shape menus and page structure inside LuCI.

- [Menu hook](https://github.com/sirpdboy/luci-theme-kucat/blob/master/htdocs/luci-static/resources/menu-kucat.js): luci js · LuCI-side menu customization and shortcut behavior. · `htdocs/luci-static/resources/menu-kucat.js`
- [Header template](https://github.com/sirpdboy/luci-theme-kucat/blob/master/ucode/template/themes/kucat/header.ut): ucode template · Server-rendered page shell entry point. · `ucode/template/themes/kucat/header.ut`
- [Footer template](https://github.com/sirpdboy/luci-theme-kucat/blob/master/ucode/template/themes/kucat/footer.ut): ucode template · Server-rendered page shell exit point. · `ucode/template/themes/kucat/footer.ut`

### Router backend

Router-side RPC and boot-time configuration hooks.

- [Defaults 1](https://github.com/sirpdboy/luci-theme-kucat/tree/master/root/etc/uci-defaults/30_luci-kuacat): uci defaults · First-boot or install-time configuration seed/migration script. · `root/etc/uci-defaults/30_luci-kuacat`
- [Defaults 2](https://github.com/sirpdboy/luci-theme-kucat/tree/master/root/etc/uci-defaults/30_luci-kucat): uci defaults · First-boot or install-time configuration seed/migration script. · `root/etc/uci-defaults/30_luci-kucat`
- [RPC helper](https://github.com/sirpdboy/luci-theme-kucat/blob/master/root/usr/libexec/rpcd/luci.kucatget): rpcd exec · Router-side helper invoked through rpcd for theme-related state. · `root/usr/libexec/rpcd/luci.kucatget`
- [RPC ACL](https://github.com/sirpdboy/luci-theme-kucat/blob/master/root/usr/share/rpcd/acl.d/luci-theme-kucat.json): rpcd acl · Authorization rules for the theme RPC helper. · `root/usr/share/rpcd/acl.d/luci-theme-kucat.json`

## Connections

- Makefile → Header template: packages · Installs the LuCI template files into the image.
- Makefile → Style CSS: packages · Deploys core theme CSS into luci-static.
- Makefile → Style JS: packages · Deploys browser-side theme scripts.
- Makefile → Menu hook: packages · Deploys LuCI navigation customization code.
- Makefile → RPC helper: packages · Installs the rpcd helper into the router filesystem.
- Makefile → RPC ACL: packages · Installs ACL rules for the helper.
- Build CI → Makefile: builds · Automates packaging and release builds.
- Docs → Menu hook: describes · Documents menu and shortcut behavior.
- Docs → RPC helper: describes · Explains router-side integration and settings flow.
- Header template → Style CSS: loads · Brings CSS into the LuCI page shell.
- Header template → Manifest: references · Can surface browser metadata for the theme.
- Header template → Browser config: references · Provides browser-specific metadata.
- Footer template → Style JS: loads · Adds browser behavior at the end of the page.
- Footer template → Footer JS: loads · Includes end-of-page behavior hooks.
- Style JS → Menu hook: coordinates · Shares the LuCI menu behavior layer.
- Menu hook → RPC helper: calls · Queries router-side theme state through rpcd.
- RPC helper → RPC ACL: governed by · Access is constrained by rpcd ACL rules.
- Defaults 1 → RPC helper: initializes · Seeds theme state used by helper-backed features.
- Defaults 2 → RPC helper: initializes · Seeds or migrates theme state on install.
- Background docs → Images: documents · Explains background asset usage.
- Style CSS → Images: uses · References image assets for the theme.
- Style CSS → Fonts: uses · References bundled fonts.
- Dark CSS → Style CSS: extends · Alternative styling variant builds on the core CSS.
