@cubocicloide/stack-frappe 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/LICENSE +33 -0
  2. package/README.md +37 -0
  3. package/dist/commands/lint/checks/APP/001.d.ts +13 -0
  4. package/dist/commands/lint/checks/APP/001.js +73 -0
  5. package/dist/commands/lint/checks/APP/001.js.map +1 -0
  6. package/dist/commands/lint/checks/APP/002.d.ts +12 -0
  7. package/dist/commands/lint/checks/APP/002.js +94 -0
  8. package/dist/commands/lint/checks/APP/002.js.map +1 -0
  9. package/dist/commands/lint/checks/APP/003.d.ts +12 -0
  10. package/dist/commands/lint/checks/APP/003.js +94 -0
  11. package/dist/commands/lint/checks/APP/003.js.map +1 -0
  12. package/dist/commands/lint/checks/APP/004.d.ts +12 -0
  13. package/dist/commands/lint/checks/APP/004.js +117 -0
  14. package/dist/commands/lint/checks/APP/004.js.map +1 -0
  15. package/dist/commands/lint/checks/DT/001.d.ts +11 -0
  16. package/dist/commands/lint/checks/DT/001.js +57 -0
  17. package/dist/commands/lint/checks/DT/001.js.map +1 -0
  18. package/dist/commands/lint/checks/DT/002.d.ts +12 -0
  19. package/dist/commands/lint/checks/DT/002.js +74 -0
  20. package/dist/commands/lint/checks/DT/002.js.map +1 -0
  21. package/dist/commands/lint/checks/DT/003.d.ts +13 -0
  22. package/dist/commands/lint/checks/DT/003.js +96 -0
  23. package/dist/commands/lint/checks/DT/003.js.map +1 -0
  24. package/dist/commands/lint/checks/DT/004.d.ts +12 -0
  25. package/dist/commands/lint/checks/DT/004.js +101 -0
  26. package/dist/commands/lint/checks/DT/004.js.map +1 -0
  27. package/dist/commands/lint/checks/PY/001.d.ts +12 -0
  28. package/dist/commands/lint/checks/PY/001.js +87 -0
  29. package/dist/commands/lint/checks/PY/001.js.map +1 -0
  30. package/dist/commands/lint/checks/PY/002.d.ts +12 -0
  31. package/dist/commands/lint/checks/PY/002.js +80 -0
  32. package/dist/commands/lint/checks/PY/002.js.map +1 -0
  33. package/dist/commands/lint/checks/PY/003.d.ts +11 -0
  34. package/dist/commands/lint/checks/PY/003.js +56 -0
  35. package/dist/commands/lint/checks/PY/003.js.map +1 -0
  36. package/dist/index.d.ts +5 -0
  37. package/dist/index.js +1987 -0
  38. package/dist/index.js.map +1 -0
  39. package/dude.stack.json +12 -0
  40. package/package.json +41 -0
  41. package/templates/aws-ecs/_dockerignore +11 -0
  42. package/templates/aws-ecs/docker/Dockerfile.prod.hbs +80 -0
  43. package/templates/aws-ecs/docker/nginx-entrypoint.sh +17 -0
  44. package/templates/aws-ecs/docker/nginx-template.conf +95 -0
  45. package/templates/aws-ecs/docs/docs/deploy.md.hbs +53 -0
  46. package/templates/aws-ecs/iac/README.md.hbs +113 -0
  47. package/templates/aws-ecs/iac/_gitignore +14 -0
  48. package/templates/aws-ecs/iac/runner/Dockerfile +35 -0
  49. package/templates/aws-ecs/iac/terraform/bootstrap/main.tf.hbs +93 -0
  50. package/templates/aws-ecs/iac/terraform/bootstrap/outputs.tf +14 -0
  51. package/templates/aws-ecs/iac/terraform/bootstrap/variables.tf.hbs +17 -0
  52. package/templates/aws-ecs/iac/terraform/environments/dev/backend.hcl.hbs +12 -0
  53. package/templates/aws-ecs/iac/terraform/environments/dev/terraform.tfvars.hbs +32 -0
  54. package/templates/aws-ecs/iac/terraform/main.tf.hbs +1205 -0
  55. package/templates/aws-ecs/iac/terraform/outputs.tf.hbs +103 -0
  56. package/templates/aws-ecs/iac/terraform/providers.tf +19 -0
  57. package/templates/aws-ecs/iac/terraform/variables.tf.hbs +139 -0
  58. package/templates/aws-ecs/iac/terraform/versions.tf +19 -0
  59. package/templates/base/.claude/rules/APP/001.md +26 -0
  60. package/templates/base/.claude/rules/APP/002.md +26 -0
  61. package/templates/base/.claude/rules/APP/003.md +25 -0
  62. package/templates/base/.claude/rules/APP/004.md +27 -0
  63. package/templates/base/.claude/rules/DT/001.md +25 -0
  64. package/templates/base/.claude/rules/DT/002.md +25 -0
  65. package/templates/base/.claude/rules/DT/003.md +24 -0
  66. package/templates/base/.claude/rules/DT/004.md +22 -0
  67. package/templates/base/.claude/rules/PY/001.md +30 -0
  68. package/templates/base/.claude/rules/PY/002.md +31 -0
  69. package/templates/base/.claude/rules/PY/003.md +29 -0
  70. package/templates/base/.claude/settings.json +42 -0
  71. package/templates/base/.claude/skills/create-doctype/SKILL.md +99 -0
  72. package/templates/base/.dude/commands/README.md +85 -0
  73. package/templates/base/.dude/commands/hello.ts +34 -0
  74. package/templates/base/.dude/lint/checks/PRJ/001.ts +26 -0
  75. package/templates/base/.dude/lint/checks/README.md +69 -0
  76. package/templates/base/.vscode/tasks.json +44 -0
  77. package/templates/base/CLAUDE.md.hbs +49 -0
  78. package/templates/base/README.md.hbs +68 -0
  79. package/templates/base/_env.example.hbs +5 -0
  80. package/templates/base/_env.hbs +12 -0
  81. package/templates/base/_gitignore +26 -0
  82. package/templates/base/_npmrc +2 -0
  83. package/templates/base/apps/README.md +24 -0
  84. package/templates/base/apps/ticketing/README.md +43 -0
  85. package/templates/base/apps/ticketing/pyproject.toml +34 -0
  86. package/templates/base/apps/ticketing/ticketing/__init__.py +1 -0
  87. package/templates/base/apps/ticketing/ticketing/api.py +35 -0
  88. package/templates/base/apps/ticketing/ticketing/events/__init__.py +0 -0
  89. package/templates/base/apps/ticketing/ticketing/events/hd_ticket.py +32 -0
  90. package/templates/base/apps/ticketing/ticketing/fixtures/workflow.json +55 -0
  91. package/templates/base/apps/ticketing/ticketing/fixtures/workflow_action_master.json +12 -0
  92. package/templates/base/apps/ticketing/ticketing/fixtures/workflow_state.json +20 -0
  93. package/templates/base/apps/ticketing/ticketing/hooks.py +54 -0
  94. package/templates/base/apps/ticketing/ticketing/modules.txt +1 -0
  95. package/templates/base/apps/ticketing/ticketing/patches/__init__.py +0 -0
  96. package/templates/base/apps/ticketing/ticketing/patches/v1_0/__init__.py +0 -0
  97. package/templates/base/apps/ticketing/ticketing/patches/v1_0/set_default_branding.py +26 -0
  98. package/templates/base/apps/ticketing/ticketing/patches.txt +5 -0
  99. package/templates/base/apps/ticketing/ticketing/public/images/favicon.png +0 -0
  100. package/templates/base/apps/ticketing/ticketing/public/images/logo.png +0 -0
  101. package/templates/base/apps/ticketing/ticketing/tasks.py +99 -0
  102. package/templates/base/apps/ticketing/ticketing/templates/__init__.py +0 -0
  103. package/templates/base/apps/ticketing/ticketing/templates/pages/__init__.py +0 -0
  104. package/templates/base/apps/ticketing/ticketing/templates/pages/ticket_stats.html +30 -0
  105. package/templates/base/apps/ticketing/ticketing/templates/pages/ticket_stats.py +14 -0
  106. package/templates/base/apps/ticketing/ticketing/ticketing/__init__.py +0 -0
  107. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/__init__.py +0 -0
  108. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/__init__.py +0 -0
  109. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/test_ticket_escalation_rule.py +32 -0
  110. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/ticket_escalation_rule.js +23 -0
  111. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/ticket_escalation_rule.json +99 -0
  112. package/templates/base/apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/ticket_escalation_rule.py +18 -0
  113. package/templates/base/docker/init.sh +114 -0
  114. package/templates/base/docker-compose.yml.hbs +62 -0
  115. package/templates/base/docs/docs/api.md +21 -0
  116. package/templates/base/docs/docs/dude.md.hbs +220 -0
  117. package/templates/base/docs/docs/extending.md +238 -0
  118. package/templates/base/docs/docs/frappe.md.hbs +223 -0
  119. package/templates/base/docs/docs/index.md.hbs +101 -0
  120. package/templates/base/docs/docs/mkdocs.md +235 -0
  121. package/templates/base/docs/mkdocs.yml.hbs +54 -0
  122. package/templates/base/package.json.hbs +11 -0
@@ -0,0 +1,223 @@
1
+ # Frappe core concepts
2
+
3
+ Frappe is a **metadata-driven full-stack framework**: you describe your models
4
+ declaratively and the framework generates the database schema, the admin UI,
5
+ the REST API and the permission system from that description. This page is a
6
+ guided tour of the concepts, and **every concept points at the file in
7
+ `apps/ticketing/` that demonstrates it** — read this page with the code open.
8
+
9
+ ```mermaid
10
+ flowchart LR
11
+ subgraph bench [bench container]
12
+ F[Frappe Framework]{{#if withHelpdesk}} --> H[helpdesk app]{{/if}}
13
+ F --> T[ticketing app<br/>apps/ticketing]
14
+ end
15
+ B[Browser] -->|/app · /helpdesk · /ticket_stats · /api| F
16
+ F --> M[(MariaDB)]
17
+ F --> R[(Redis cache + queue)]
18
+ ```
19
+
20
+ ---
21
+
22
+ ## Bench, site, app
23
+
24
+ Frappe's three nested units:
25
+
26
+ - **Bench** — a self-contained installation: a Python virtualenv, the Frappe
27
+ source, every installed app, and the process manager (`bench start`). In this
28
+ project the bench lives *inside* the `bench` container (persisted in the
29
+ `bench_home` Docker volume) and is created on first boot by
30
+ `docker/init.sh`. `dude shell` drops you straight into it.
31
+ - **Site** — one tenant: one database, one set of installed apps, one config.
32
+ A bench can host many sites; this project provisions one, named after
33
+ `SITE_NAME` in `.env` (default `{{projectName}}.localhost` — Frappe routes
34
+ requests to sites by hostname, which is why the URL matters).
35
+ - **App** — a Python package that plugs into the framework: models (DocTypes),
36
+ server code, web pages, hooks. `frappe` itself is an app{{#if withHelpdesk}}; so is
37
+ `helpdesk`{{/if}}; so is our custom **`ticketing`** app in `apps/ticketing/`.
38
+
39
+ Custom apps under `apps/` in this repo are mounted into the container and
40
+ installed in **editable mode** (`docker/init.sh`), so editing a file on the
41
+ host reloads the dev server live.
42
+
43
+ ---
44
+
45
+ ## DocTypes — models, declared as JSON
46
+
47
+ A **DocType** is Frappe's model. One DocType = one database table = one Desk
48
+ list/form UI = one REST resource — all generated from a single JSON schema.
49
+
50
+ The complete example bundle is
51
+ `apps/ticketing/ticketing/ticketing/doctype/ticket_escalation_rule/`:
52
+
53
+ | File | Role |
54
+ |------|------|
55
+ | `ticket_escalation_rule.json` | the **schema**: fields, types, permissions, naming |
56
+ | `ticket_escalation_rule.py` | the **controller** (server-side lifecycle hooks) |
57
+ | `ticket_escalation_rule.js` | the **form script** (client-side Desk logic) |
58
+ | `test_ticket_escalation_rule.py` | unit tests, run by `dude test` |
59
+ | `__init__.py` | makes the directory a package |
60
+
61
+ Things to notice in the JSON:
62
+
63
+ - **Fields** — each has a snake_case `fieldname`, a `fieldtype` (`Data`,
64
+ `Int`, `Select`, `Link`, `Check`, …) and UI hints (`reqd`, `in_list_view`).
65
+ A `Link` field (`escalate_to` → `User`) is a foreign key.
66
+ - **Naming** — `"autoname": "field:rule_name"` makes the document's primary
67
+ key (`name`) equal to the `rule_name` field. Other schemes: series
68
+ (`TICK-.####`), hash, prompt.
69
+ - **Permissions** — the `permissions` array grants per-role CRUD rights.
70
+ A DocType with no permissions is invisible to everyone but Administrator.
71
+
72
+ ### Controllers
73
+
74
+ `ticket_escalation_rule.py` defines a class named after the DocType
75
+ (`TicketEscalationRule(Document)`); Frappe instantiates it for every document
76
+ of the type. Override lifecycle hooks — `validate`, `before_save`,
77
+ `on_update`, `on_trash`, … — to add server-side behaviour. The example's
78
+ `validate` rejects non-positive escalation delays with `frappe.throw`.
79
+
80
+ ---
81
+
82
+ ## Desk vs portal — the two faces of the UI
83
+
84
+ - **Desk** (`/app`) is the generated back-office: every DocType automatically
85
+ gets a list view, form view, filters, and reports. This is where agents and
86
+ admins work.
87
+ - **Portal / website** pages are public-facing Jinja templates. A file pair
88
+ under `templates/pages/` — `<route>.py` + `<route>.html` — becomes a web
89
+ route automatically. The example:
90
+ `apps/ticketing/ticketing/templates/pages/ticket_stats.{py,html}` serves
91
+ `/ticket_stats`; `get_context()` in the `.py` runs on each request and feeds
92
+ the template.
93
+
94
+ ### Form scripts
95
+
96
+ `ticket_escalation_rule.js` runs in the browser when the Desk form opens.
97
+ `frappe.ui.form.on("Ticket Escalation Rule", { refresh(frm) {…} })` reacts to
98
+ form events and individual field changes. Use it for UX guardrails only — the
99
+ controller must enforce every rule server-side too (never trust the client).
100
+
101
+ ---
102
+
103
+ ## Whitelisted methods and the REST API
104
+
105
+ Any function decorated with `@frappe.whitelist()` becomes an RPC endpoint at
106
+ `/api/method/<dotted.path>`. The example, `apps/ticketing/ticketing/api.py`:
107
+
108
+ ```
109
+ GET /api/method/ticketing.api.ticket_stats
110
+ ```
111
+
112
+ Frappe also exposes a generated **resource API** for every DocType:
113
+
114
+ ```
115
+ GET /api/resource/Ticket Escalation Rule # list (respects permissions)
116
+ GET /api/resource/Ticket Escalation Rule/<name> # read one
117
+ POST /api/resource/Ticket Escalation Rule # create
118
+ ```
119
+
120
+ Both APIs honour the session (or token) of the caller and the DocType
121
+ permission matrix. Never add `allow_guest=True` to a whitelisted method unless
122
+ the data is truly public — lint rule **PY001** flags it.
123
+
124
+ ---
125
+
126
+ ## hooks.py — the app's declarative contract
127
+
128
+ `apps/ticketing/ticketing/hooks.py` is the single place where the app tells
129
+ the framework what it provides. Keep it declarative; put logic in dedicated
130
+ modules. The example declares:
131
+
132
+ - **`doc_events`** — run code when documents of *any* app change. The example
133
+ hooks {{#if withHelpdesk}}Helpdesk's{{/if}} `HD Ticket` (`after_insert`, `on_update`) and points
134
+ at plain functions in `apps/ticketing/ticketing/events/hd_ticket.py`. This
135
+ is the canonical way to extend another app **without forking it**.
136
+ - **`scheduler_events`** — background jobs by frequency (`all`, `hourly`,
137
+ `daily`, `weekly`, `monthly`, `cron`). The example wires two jobs in
138
+ `apps/ticketing/ticketing/tasks.py` (see below).
139
+ - **`fixtures`** — records (not code) the app ships: exported to
140
+ `apps/ticketing/ticketing/fixtures/*.json` and re-imported on every
141
+ `bench migrate`. The example ships a Workflow and its states/actions.
142
+
143
+ `dude lint` verifies the contract stays honest: every dotted path in
144
+ `hooks.py` must resolve to a real function, and declared fixtures must match
145
+ the shipped JSON files (APP rules — see `.claude/rules/APP/`).
146
+
147
+ ---
148
+
149
+ ## The scheduler
150
+
151
+ `bench start` runs a `schedule` process that fires the jobs declared in
152
+ `scheduler_events`. The examples in `apps/ticketing/ticketing/tasks.py`:
153
+
154
+ - `escalate_overdue_tickets` (hourly) — applies enabled, **Approved**
155
+ `Ticket Escalation Rule`s to open tickets: posts a comment and assigns the
156
+ escalation contact.
157
+ - `close_stale_resolved_tickets` (daily) — closes tickets left in Resolved
158
+ for more than 7 days.
159
+
160
+ Jobs must be **idempotent** — the scheduler guarantees at-least-once, not
161
+ exactly-once, execution (note how `_escalate` checks for its own marker
162
+ comment before acting). To run one immediately instead of waiting:
163
+
164
+ ```bash
165
+ dude bench --site all execute ticketing.tasks.escalate_overdue_tickets
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Workflows
171
+
172
+ A **Workflow** gates a DocType behind named states and role-restricted
173
+ transitions — configuration, not code. The example
174
+ (`apps/ticketing/ticketing/fixtures/workflow.json`) puts
175
+ `Ticket Escalation Rule` through **Draft → Approved / Rejected**: the Desk
176
+ form grows an *Approve/Reject* button, the document gets a `workflow_state`
177
+ field, and the hourly task only honours rules whose state is `Approved`.
178
+
179
+ Workflows are built in the Desk UI (search "Workflow") and shipped as
180
+ **fixtures** so they exist on every environment — see the
181
+ [cookbook](extending.md#add-a-workflow) for the export loop.
182
+
183
+ ---
184
+
185
+ ## Developer mode
186
+
187
+ The site is provisioned with `developer_mode = 1` (`docker/init.sh`). This is
188
+ what makes the scaffold a live workshop: with developer mode **on**, creating
189
+ or editing a DocType in the Desk UI **writes the JSON back into the app's
190
+ source tree** on disk, ready to commit. With it off (production), the same
191
+ edit would create a database-only "custom" DocType that never lands in git.
192
+
193
+ {{#if withHelpdesk}}
194
+ ---
195
+
196
+ ## What Frappe Helpdesk adds
197
+
198
+ **Frappe Helpdesk** is itself just a Frappe app (`helpdesk`, installed by
199
+ `docker/init.sh`) — a useful reminder that everything above scales to real
200
+ products. It brings:
201
+
202
+ - The agent UI at `/helpdesk` (a Vue single-page app served by Frappe).
203
+ - A family of DocTypes — **`HD Ticket`** (the ticket itself), `HD Team`,
204
+ `HD Agent`, `HD Service Level Agreement`, and more. Browse them in Desk:
205
+ they are ordinary DocTypes with schemas, controllers and permissions.
206
+ - REST/RPC endpoints for all of the above, like any DocType.
207
+
208
+ The `ticketing` app treats Helpdesk as a peer: it listens to `HD Ticket`
209
+ events (`doc_events`), queries it from tasks and APIs
210
+ (`frappe.get_all("HD Ticket", …)`) and augments it with its own
211
+ `Ticket Escalation Rule` DocType — all without touching Helpdesk's code.
212
+ {{/if}}
213
+
214
+ ---
215
+
216
+ ## Where to go next
217
+
218
+ - [Extending the app](extending.md) — step-by-step recipes for adding each
219
+ kind of building block.
220
+ - `.claude/rules/` — the structural conventions `dude lint` enforces
221
+ (APP/DT/PY rules), each explained with fixes.
222
+ - [Frappe Framework documentation](https://docs.frappe.io/framework) — the
223
+ upstream reference.
@@ -0,0 +1,101 @@
1
+ # Welcome
2
+
3
+ This is the documentation for **{{projectName}}** — a ticketing system built on
4
+ the [Frappe Framework](https://frappeframework.com){{#if withHelpdesk}} and
5
+ [Frappe Helpdesk](https://github.com/frappe/helpdesk){{/if}}, scaffolded with
6
+ [`dude`](https://github.com/cubocicloide/dude).
7
+
8
+ Beyond running out of the box, this project is a **worked example of Frappe's
9
+ core building blocks**: the custom app `apps/ticketing/` demonstrates DocTypes,
10
+ controllers, form scripts, portal pages, whitelisted APIs, scheduled tasks,
11
+ document-event hooks, workflows and fixtures. The
12
+ [Frappe core concepts](frappe.md) page walks through each one, and
13
+ [Extending the app](extending.md) is the "how do I add X?" cookbook.
14
+
15
+ ---
16
+
17
+ ## Getting started
18
+
19
+ `dude` is the project CLI, published on the public npm registry. Install the
20
+ global launcher, then provision and start the app.
21
+
22
+ ```bash
23
+ # 1. Install the dude launcher globally (the only global install).
24
+ npm install -g @cubocicloide/dude-launcher
25
+
26
+ # 2. Scaffold the project (how {{projectName}} was created). Already inside it
27
+ # or cloned it? Skip this and go straight to `pnpm install`.
28
+ dude init {{projectName}}
29
+ cd {{projectName}}
30
+
31
+ # 3. Provision the project's pinned toolchain (CLI + stack) from the lockfile.
32
+ pnpm install
33
+
34
+ # 4. Start everything. The FIRST boot provisions the bench and the site
35
+ # (downloads Frappe{{#if withHelpdesk}}, installs Helpdesk{{/if}}, installs the custom apps) —
36
+ # this takes several minutes. Watch the progress:
37
+ dude up
38
+ dude logs --service bench
39
+ ```
40
+
41
+ From then on, `dude up` starts everything and `dude down` stops it (the bench
42
+ and database persist in Docker volumes; `dude down --volumes` wipes them). See
43
+ [Working with dude](dude.md) for the full command reference.
44
+
45
+ To serve this documentation site:
46
+
47
+ ```bash
48
+ dude docs # → http://localhost:8001
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Contents
54
+
55
+ - [Frappe core concepts](frappe.md) — guided tour of bench, sites, apps, DocTypes, hooks, workflows… each mapped to a concrete file in `apps/ticketing/`.
56
+ - [Extending the app](extending.md) — cookbook: add a DocType, a scheduled task, a workflow, a portal page, an API endpoint, a whole new app.
57
+ - [Working with dude](dude.md) — CLI reference: start the stack, run bench commands, test, lint, and more.
58
+ - [Command reference](api.md) — auto-generated list of every command available in this project.
59
+ - [Writing docs](mkdocs.md) — how to add pages to this documentation site and the Markdown syntax supported.
60
+ {{#if withIac}}
61
+ - [Deploy (AWS ECS)](deploy.md) — provision cloud infrastructure and ship the app.
62
+ {{/if}}
63
+
64
+ ---
65
+
66
+ ## Quick links
67
+
68
+ Once `dude up` reports the bench running (`dude logs --service bench` shows
69
+ `bench start`), open:
70
+
71
+ | Resource | URL | Credentials / notes |
72
+ |----------|-----|---------------------|
73
+ | Desk (admin UI) | <http://{{projectName}}.localhost:8000/app> | `Administrator` / `admin` |
74
+ {{#if withHelpdesk}}
75
+ | Helpdesk (agent UI) | <http://{{projectName}}.localhost:8000/helpdesk> | same login |
76
+ {{/if}}
77
+ | Example portal page | <http://{{projectName}}.localhost:8000/ticket_stats> | public web page from `apps/ticketing` |
78
+ | Example API method | <http://{{projectName}}.localhost:8000/api/method/ticketing.api.ticket_stats> | whitelisted RPC endpoint |
79
+ | This docs site | <http://localhost:8001> | `dude docs` |
80
+
81
+ !!! note "`*.localhost`"
82
+ Modern browsers resolve `*.localhost` to `127.0.0.1` automatically. If a
83
+ tool of yours can't, add `127.0.0.1 {{projectName}}.localhost` to `/etc/hosts`.
84
+
85
+ ---
86
+
87
+ ## Tech stack
88
+
89
+ | Layer | Technology |
90
+ |-------|-----------|
91
+ | Framework | Frappe Framework v15 (Python) — bench, Desk, website engine |
92
+ {{#if withHelpdesk}}
93
+ | Ticketing UI | Frappe Helpdesk (`HD Ticket` and friends) |
94
+ {{/if}}
95
+ | Custom app | `apps/ticketing/` — DocTypes, hooks, tasks, API, portal pages |
96
+ | Database | MariaDB 10.6 |
97
+ | Cache / queue | Redis (separate cache and queue instances) |
98
+ | Infra | Docker Compose (`mariadb`, `redis-cache`, `redis-queue`, `bench`) |
99
+ | Testing | `bench run-tests` (FrappeTestCase) via `dude test` |
100
+ | Formatting | ruff (Frappe style — tabs) via `dude format` |
101
+ | Docs | MkDocs Material |
@@ -0,0 +1,235 @@
1
+ # Writing docs
2
+
3
+ This project uses [MkDocs Material](https://squidfunk.github.io/mkdocs-material/)
4
+ for documentation. Pages are Markdown files stored under `docs/docs/`.
5
+
6
+ ---
7
+
8
+ ## Getting started
9
+
10
+ Start the live-reload server:
11
+
12
+ ```bash
13
+ dude docs
14
+ ```
15
+
16
+ Open [http://localhost:8001](http://localhost:8001), then edit any `.md` file —
17
+ the browser refreshes automatically.
18
+
19
+ ---
20
+
21
+ ## Adding a page
22
+
23
+ 1. Create a new `.md` file under `docs/docs/` (e.g. `docs/docs/runbook.md`).
24
+ 2. Add it to the `nav` section in `docs/mkdocs.yml`:
25
+
26
+ ```yaml
27
+ nav:
28
+ - Home: index.md
29
+ - Frappe core concepts: frappe.md
30
+ - Extending the app: extending.md
31
+ - Working with dude: dude.md
32
+ - Runbook: runbook.md # ← new entry
33
+ ```
34
+
35
+ That is all — MkDocs will include it in the sidebar automatically.
36
+
37
+ ---
38
+
39
+ ## Markdown syntax
40
+
41
+ ### Formatting
42
+
43
+ - **Bold**: `**text**`
44
+ - _Italic_: `_text_`
45
+ - `Code`: `` `text` ``
46
+ - ==Highlight==: `==text==`
47
+ - ^^Underline^^: `^^text^^`
48
+ - ~~Strikethrough~~: `~~text~~`
49
+
50
+ ---
51
+
52
+ ### Admonitions
53
+
54
+ Use admonitions to call out important information:
55
+
56
+ ```markdown
57
+ !!! note "Title"
58
+ Body text here.
59
+
60
+ !!! tip "Tip"
61
+ A helpful hint.
62
+
63
+ !!! warning "Warning"
64
+ Something to be careful about.
65
+
66
+ !!! danger "Danger"
67
+ A critical warning.
68
+ ```
69
+
70
+ Renders as:
71
+
72
+ !!! note "Note"
73
+ Use notes for supplementary information that is useful but not critical.
74
+
75
+ !!! tip "Tip"
76
+ Use tips for best practices and shortcuts.
77
+
78
+ !!! warning "Warning"
79
+ Use warnings for things that can cause unexpected behaviour.
80
+
81
+ !!! danger "Danger"
82
+ Use for actions that can cause data loss or security issues.
83
+
84
+ Collapsible variant (closed by default):
85
+
86
+ ```markdown
87
+ ??? info "Click to expand"
88
+ Hidden until clicked.
89
+ ```
90
+
91
+ Collapsible, open by default:
92
+
93
+ ```markdown
94
+ ???+ info "Expanded by default"
95
+ Visible, but collapsible.
96
+ ```
97
+
98
+ ---
99
+
100
+ ### Code blocks
101
+
102
+ Fenced code block with syntax highlighting:
103
+
104
+ ````markdown
105
+ ```python linenums="1"
106
+ def greet(name: str) -> str:
107
+ return f"Hello, {name}!"
108
+ ```
109
+ ````
110
+
111
+ Renders as:
112
+
113
+ ```python linenums="1"
114
+ def greet(name: str) -> str:
115
+ return f"Hello, {name}!"
116
+ ```
117
+
118
+ With line highlighting:
119
+
120
+ ````markdown
121
+ ```python hl_lines="2 3"
122
+ def example():
123
+ x = 1 # highlighted
124
+ y = 2 # highlighted
125
+ return x + y
126
+ ```
127
+ ````
128
+
129
+ ---
130
+
131
+ ### Diagrams (Mermaid)
132
+
133
+ MkDocs Material renders [Mermaid](https://mermaid.js.org/) diagrams natively:
134
+
135
+ ````markdown
136
+ ```mermaid
137
+ flowchart LR
138
+ A[Browser] -->|HTTP| B[Frappe / bench]
139
+ B -->|SQL| C[(MariaDB)]
140
+ ```
141
+ ````
142
+
143
+ Renders as:
144
+
145
+ ```mermaid
146
+ flowchart LR
147
+ A[Browser] -->|HTTP| B[Frappe / bench]
148
+ B -->|SQL| C[(MariaDB)]
149
+ ```
150
+
151
+ Sequence diagram:
152
+
153
+ ```mermaid
154
+ sequenceDiagram
155
+ participant Browser
156
+ participant Frappe
157
+ Browser->>Frappe: GET /api/method/ticketing.api.ticket_stats
158
+ Frappe-->>Browser: 200 OK {by_status, total}
159
+ ```
160
+
161
+ ---
162
+
163
+ ### Tables
164
+
165
+ ```markdown
166
+ | Column A | Column B | Column C |
167
+ |----------|----------|----------|
168
+ | Value 1 | Value 2 | Value 3 |
169
+ | Value 4 | Value 5 | Value 6 |
170
+ ```
171
+
172
+ | Column A | Column B | Column C |
173
+ |----------|----------|----------|
174
+ | Value 1 | Value 2 | Value 3 |
175
+ | Value 4 | Value 5 | Value 6 |
176
+
177
+ ---
178
+
179
+ ### Task lists
180
+
181
+ ```markdown
182
+ - [x] Completed task
183
+ - [ ] Pending task
184
+ - [ ] Another pending task
185
+ ```
186
+
187
+ Renders as:
188
+
189
+ - [x] Completed task
190
+ - [ ] Pending task
191
+ - [ ] Another pending task
192
+
193
+ ---
194
+
195
+ ### Tabs
196
+
197
+ ```markdown
198
+ === "Python"
199
+ ```python
200
+ print("Hello, world!")
201
+ ```
202
+
203
+ === "TypeScript"
204
+ ```typescript
205
+ console.log("Hello, world!")
206
+ ```
207
+ ```
208
+
209
+ === "Python"
210
+ ```python
211
+ print("Hello, world!")
212
+ ```
213
+
214
+ === "TypeScript"
215
+ ```typescript
216
+ console.log("Hello, world!")
217
+ ```
218
+
219
+ ---
220
+
221
+ ## File structure
222
+
223
+ ```
224
+ docs/
225
+ ├── mkdocs.yml # MkDocs configuration
226
+ └── docs/ # Source pages (edit these)
227
+ ├── index.md # Home page
228
+ ├── frappe.md # Frappe core concepts (guided tour)
229
+ ├── extending.md # Cookbook: add a DocType, task, workflow…
230
+ ├── dude.md # CLI reference
231
+ ├── api.md # Auto-generated command reference
232
+ └── mkdocs.md # This page
233
+ ```
234
+
235
+ Add new `.md` files here and register them in `mkdocs.yml`.
@@ -0,0 +1,54 @@
1
+ site_name: "{{projectName}}"
2
+
3
+ theme:
4
+ name: material
5
+ features:
6
+ - content.code.annotate
7
+ - content.code.copy
8
+ - navigation.tabs
9
+ - navigation.top
10
+ - navigation.sections
11
+ - toc.integrate
12
+
13
+ plugins:
14
+ - search
15
+
16
+ nav:
17
+ - Home: index.md
18
+ - Frappe core concepts: frappe.md
19
+ - Extending the app: extending.md
20
+ - Working with dude: dude.md
21
+ - Command reference: api.md
22
+ - Writing docs: mkdocs.md
23
+ {{#if withIac}}
24
+ - Deploy (AWS ECS): deploy.md
25
+ {{/if}}
26
+
27
+ markdown_extensions:
28
+ - admonition
29
+ - attr_list
30
+ - def_list
31
+ - footnotes
32
+ - tables
33
+ - pymdownx.details
34
+ - pymdownx.highlight:
35
+ anchor_linenums: true
36
+ - pymdownx.inlinehilite
37
+ - pymdownx.snippets
38
+ - pymdownx.superfences:
39
+ custom_fences:
40
+ - name: mermaid
41
+ class: mermaid
42
+ format: !!python/name:pymdownx.superfences.fence_code_format
43
+ - pymdownx.tabbed:
44
+ alternate_style: true
45
+ - pymdownx.tasklist:
46
+ custom_checkbox: true
47
+ - pymdownx.critic
48
+ - pymdownx.caret
49
+ - pymdownx.mark
50
+ - pymdownx.tilde
51
+ - pymdownx.smartsymbols
52
+ - pymdownx.emoji:
53
+ emoji_index: !!python/name:material.extensions.emoji.twemoji
54
+ emoji_generator: !!python/name:material.extensions.emoji.to_svg
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "private": true,
4
+ "devDependencies": {
5
+ "@cubocicloide/dude": "{{dudeVersion}}",
6
+ "@cubocicloide/stack-frappe": "{{stackVersion}}"
7
+ },
8
+ "scripts": {
9
+ "dude": "dude"
10
+ }
11
+ }