YouBothAgent▾
You — Business rules and flows you own. Read these yourself.
Both — Know the idea; your agent follows the details.
Agent — Conventions and references your agent follows. Look up as needed.
CLI Reference▾
AkanJS Reference▾
Page CLI
create-crud-page writes the list, create, detail and edit pages for a module that already exists, so you can browse and edit its data right away. Run it after create-module, then edit the pages like any other code.Words Used on This Page
TermDescription
CRUD
Create, read, update and delete: the basic things you do with a model's records.
sys:module
How the CLI names a module:
shop:product is lib/product/ in the shop app.A folder in parentheses, such as
(public). It groups files and adds nothing to the URL.scaffold
The starter code a command writes, meant to be edited.
Pages It Writes
File
Default
--single
Written into the target folder, by default
page/(<app>)/(public)/<module>/_index.tsx
✓
✓
/<module>: the list of cards, with a create button. Under --single the button opens a modal.new/_index.tsx
✓
/<module>/new: the create form, built from Template.General.[<module>Id]/_index.tsx
✓
/<module>/<id>: the detail from Zone.View, with a link to the edit page.[<module>Id]/edit/_index.tsx
✓
/<module>/<id>/edit: the edit form, filled with the saved record.✓WrittenNot written
What the Module Must Have
The pages call these parts of the module. A module made with create-module has all of them; if you renamed or removed one, fix the generated pages to match.
PartDescription
inPublic
The slice the list and both forms load and save through.
Zone.CardZone.View
The list of cards and the detail screen.
Template.General
The form body, shared by the create and edit pages.
Check After It Runs
- Links assume the URL is
/<module>. The buttons, the redirect after saving and the cards inZone.Cardall point to paths starting with/<module>. Move the pages to another URL and update them too. --singlewrites no detail page. Each card still links to/<module>/<id>, so change that link, or generate the full set of four pages without--singleinstead.- The pages check no session. Writes follow the slice
create-modulewrote:cru: Adminwithlibs/shared,cru: Nonewithout it. Gate the pages in a_layout.tsxand set the guards your screens need before you ship.


--base-path is a folder inside the app, not a URL prefix. --base-path admin writes to apps/shop/admin/, outside page/, so no route is created. Give the whole folder, such as page/(shop)/(admin)/product.Related Pages
create-crud-page
Create the list, create, detail and edit pages for an existing module.
They go into
page/(<app>)/(public)/<module>/ unless --base-path names another folder.Signature
Arguments
appString
The app that gets the pages. Left out, the only app is used, or you pick one from a list.
sys:moduleString
The module, such as
shop:product. Left out, you pick the app or library, then the module.Options
--base-pathStringdefault page/(<app>)/(public)/<module>-b
The folder to write into, relative to the app root, such as
page/(shop)/(admin)/product.--singleBooleandefault false-s
Write one
_index.tsx with the list and a create modal, instead of four pages.Notes
NameDescription
same app
Pick a module of the target app. The pages import from
@apps/<sys>/client.database modules only
A service module in
lib/_<service> or a scalar in lib/__scalar is not accepted.with create-module
akan create-module <name> <app> --page runs this command with the default folder.existing file
A file already at the path is overwritten with the scaffold, so commit first.
Examples