ToolingCLICode Generation

Overview

The arkos generate command (alias arkos g) creates boilerplate files that follow Arkos.js conventions. Instead of writing the same scaffolding by hand for every module, you describe what you want and the CLI generates it — correctly named, correctly typed, and ready to customize.

Generating Multiple Components at Once

The most powerful entry point is generate components. It lets you generate any combination of components for one or more modules in a single command.

arkos generate components [options]
arkos g co [options]

Options specific to this command:

FlagAliasDescription
--allGenerate all available components for the module
--names <names>-nComma-separated list of components to generate
--modules <names>--msComma-separated list of module names

Generate Everything for a Module

arkos generate components --module post --all
arkos g co -m post --all

This generates the full set of files for the post module:

src/modules/post/
├── post.controller.ts
├── post.service.ts
├── post.router.ts
├── post.interceptors.ts
├── post.hooks.ts
├── post.policy.ts
├── post.query.ts
├── schemas/
│   ├── post.schema.ts
│   ├── create-post.schema.ts
│   ├── update-post.schema.ts
│   └── query-post.schema.ts
└── dtos/
    ├── post.dto.ts
    ├── create-post.dto.ts
    ├── update-post.dto.ts
    └── query-post.dto.ts
prisma/schema/post.prisma

Generate Specific Components

Pass a comma-separated list of component names or their aliases with -n:

arkos generate components --module post --names service,controller,router
arkos g co -m post -n s,c,r

You can mix full names and aliases freely:

arkos g co -m post -n service,c,router,sc,dto

Generate Components for Multiple Modules at Once

Use --modules (or --ms) to run the same generation across several modules:

arkos generate components --modules post,user,comment --all
arkos g co --ms post,user,comment --all

# Or specific components across multiple modules
arkos g co --ms post,user -n s,c,r

When using multiple modules, use --modules / --ms. Passing a comma-separated list to -m / --module is not supported and will throw an error.

Available Components

Full NameAliasWhat It GeneratesGuide
controllercController class extending BaseControllerCore
servicesService class extending BaseServiceCore
routerrRouter file with RouteHook exportCore
interceptorsiInterceptor middleware arraysCore
hookshService hook arraysCore
query-optionsqPrisma query options configPrisma
modelmPrisma model filePrisma
schemascBase Zod schemaValidation
create-schemacsCreate Zod schemaValidation
update-schemausUpdate Zod schemaValidation
query-schemaqsQuery Zod schemaValidation
dtodBase class-validator DTOValidation
create-dtocdCreate DTOValidation
update-dtoudUpdate DTOValidation
query-dtoqdQuery DTOValidation
policypArkosPolicy fileAuthentication
auth-configsaAuth config file (deprecated)Authentication

Overwriting Existing Files

By default the CLI refuses to overwrite an existing file. Pass -o or --overwrite to force it:

arkos g co -m post --all --overwrite

Custom Output Path

Override the default src/modules location with -p:

arkos g co -m post --all -p src/api
# Results in: src/api/post/post.controller.ts, etc.