Documentation
Architecture Strategy
Directory Structure
Kitwork promotes a highly modular, decoupled application structure. Learn how configuration files, logic endpoints, and template folders fit together.
01
Standard Layout
A typical Kitwork project structure contains the entrypoint logic script, configuration, client views, and static assets.
folder-tree
my-kitwork-app/
├── config.kitwork.yaml # Engine server configuration
├── app.kitwork.js # Application routes & main handlers
├── helper.kitwork.js # Global Javascript helper utils
├── assets/ # Public CSS, JS, images, favicon
│ └── logo.png
└── views/ # Layout templates & view partials
├── _navbar_.kitwork.html
├── _footer_.kitwork.html
├── page.kitwork.html
└── docs/
└── page.kitwork.html
├── config.kitwork.yaml # Engine server configuration
├── app.kitwork.js # Application routes & main handlers
├── helper.kitwork.js # Global Javascript helper utils
├── assets/ # Public CSS, JS, images, favicon
│ └── logo.png
└── views/ # Layout templates & view partials
├── _navbar_.kitwork.html
├── _footer_.kitwork.html
├── page.kitwork.html
└── docs/
└── page.kitwork.html
02
YAML Config Schema
Configure your server settings, hot reload behaviors, simulated domains, and system database connections in config.kitwork.yaml.
config.kitwork.yaml
port: 8080
root: "tenants"
hot_reload: true
hostname: "kitwork.vn"
domains:
- kitwork.vn
- kitwork.io
database:
type: "postgres"
host: "127.0.0.1"
port: 5432
user: "postgres"
password: "secret"
name: "kitdb"
root: "tenants"
hot_reload: true
hostname: "kitwork.vn"
domains:
- kitwork.vn
- kitwork.io
database:
type: "postgres"
host: "127.0.0.1"
port: 5432
user: "postgres"
password: "secret"
name: "kitdb"
03
Serving Static Files
Define explicit routes to map files or entire asset folders to the output stream.
assets.js
// Serve individual static files
router.get("/favicon.ico").file("/assets/favicon.ico");
// Serve directories using wildcard paths
router.get("/assets/*").directory("./assets/*");
router.get("/favicon.ico").file("/assets/favicon.ico");
// Serve directories using wildcard paths
router.get("/assets/*").directory("./assets/*");