-
Notifications
You must be signed in to change notification settings - Fork 0
PROJECT STRUCTURE
Daniel Arndt edited this page Mar 19, 2026
·
1 revision
This template keeps the CLI layer thin and pushes reusable logic into services and shared core helpers.
src/
├─ cli/
│ ├─ commands/
│ ├─ shared/
│ └─ ui/
├─ core/
│ ├─ errors/
│ ├─ types/
│ └─ utils/
├─ services/
├─ cli.ts
└─ index.ts
Contains command registration, help customization, output formatting, and argument parsing.
Keep this layer focused on:
- registering commands
- defining arguments and options
- formatting CLI output
- calling services
Avoid placing business rules here.
Contains foundations reused across the project.
Examples:
- custom error classes
- common shared types
- number parsing helpers
- formatting helpers
- array helpers
- random helpers
Contains reusable logic called by the CLI.
Examples in this template:
- greeting service
- app info service
- math service
- text service
- array service
- random service
- the user runs a command
- the command registrar parses arguments and options
- the command calls a service
- the service uses
corehelpers when needed - the CLI prints the result or formats the error
- command files stay readable
- services stay testable
- shared helpers have a clear home
- new projects can reuse the same mental model