# Style Guide

You're free to design your application in whichever way suits your needs, but this is the Pulse way:

Index files index.ts should only be used for imports and exports of your modules

  • File names should be formatted as module.type.extention. (eg: auth.routes.ts)
  • Your Pulse code is the core of your application, so would sit in a directory or repository named "core".
  • Your core file structure would consist of the following directories:

    ├── core │ ├── .index.ts Export core object │ │ ├── modules │ │ │ ├── accounts │ │ │ │ ├── index.ts Import actions, states, routes and export as a default object │ │ │ │ ├── account.actions.ts Methods │ │ │ │ ├── account.state.ts State, Computed State & Collections │ │ │ │ ├── account.types.ts for TypeScript users (Optional) │ │ │ │ ├── account.routes.ts for all your routes │ │ │ └── index.ts Export all the modules with the correct name (ex: export { default as accounts } from './accounts) │ │ ├── utils (Optional) │ │ │ └── index.ts │ │ ├── data (Optional) │ │ │ ├── lists.json └── package.json

  • Controller actions should never directly return route response
  • Controller actions should recieve prameters instead of just one object to assemple request payloads
  • Controller functions should use async / await when calling routes