Kora/developer documentation/Template Module
Template Module
A starter module with one of everything, ready to copy.
Kora-Template is a working module with a model, handler, route, clock, event, config, languages and a custom dashboard page. Copy it and rename things.
git clone https://github.com/zerodev-ca/Kora-Template modules/exampleFiles
modules/example/
├── main.js
├── resources/
│ ├── config/
│ │ └── settings.js
│ ├── dashboard/
│ │ └── pages/
│ │ └── template/
│ │ ├── page.js
│ │ └── view.tsx
│ └── lang/
│ ├── en/
│ │ ├── common.json
│ │ └── messages.js
│ └── es-ES/
│ └── common.json
└── src/
├── clocks/
│ └── cleanup.js
├── events/
│ └── licenseCreated.js
├── handlers/
│ └── Items.js
├── models/
│ └── Item.js
└── routes/
└── items/
└── route.jsAfter Cloning
- Change
nameinmain.jsto your folder name. - Rename the model, handler and route to what your module stores.
- Start Kora. The module shows up under Modules and its page in the sidebar.
- Add a
common.jsonfor each locale you support. See Languages.
Where Things Go
| You want to | Put it in | See |
|---|---|---|
| Store data | src/models/ | Models |
| Write the logic | src/handlers/ | Handlers |
| Add API endpoints | src/routes/ | Routes |
| Run something on a schedule | src/clocks/ | Clocks |
| React to licenses and validations | src/events/ | Events |
| Add Discord commands | src/commands/ | Commands |
| Add settings | resources/config/ | Configuration |
| Add dashboard pages | resources/dashboard/pages/ | Pages |
| Add text and translations | resources/lang/ | Languages |