Using the CLI
The Devux CLI is your main tool for generating code and managing your project. It's an interactive menu-driven interface powered by @clack/prompts.
Starting the CLI
pnpm devuxThis opens the main menu where you select what you want to work with.
Main Menu
What do you want to work with?
○ Domains
○ Endpoints
○ Domain Repos
○ Domain Services
○ App Services
○ Base Classes
○ List & Inspect
○ Visualize (Open endpoints dependency graph in browser)Press Esc at any submenu to go back.
Domains
Create and manage domain folders (top-level business groupings).
Domains - What do you want to do?
○ Create
○ Rename (currently disabled)
○ DeleteCreate prompts for a kebab-case name and creates the domain folder structure.
Delete removes the domain and all its endpoints, repos, and services. It will warn you about what will be deleted.
Endpoints
Create and manage API endpoints.
Endpoints - What do you want to do?
○ Create
○ Rename (currently disabled)
○ Delete
○ Manage dependenciesCreating an Endpoint
The CLI will prompt you for:
- Domain – which domain this endpoint belongs to
- Endpoint ID – unique identifier in kebab-case (e.g.,
create-customer) - Route – the HTTP path (e.g.,
/customers) - HTTP Method – GET, POST, PUT, PATCH, DELETE
- Transactional – whether to use database transactions
- Create a repo – optionally create an endpoint repo at the same time
Generated files:
- Use-case, controller, validator, presenter
- Route configuration
- Zod schemas (request/response)
- Test files
- Tester class
Managing Dependencies
Add or remove dependencies (repos, services) to an endpoint:
Manage "create-customer" - What do you want to do?
○ Add dependency
○ Remove dependency
○ Add endpoint repo
○ Delete endpoint repoAdd dependency lets you add:
- Domain repos from any domain
- Domain services from any domain
- App services
Add endpoint repo creates a new repo specifically for this endpoint.
Domain Repos
Repos shared across multiple endpoints within a domain.
Domain Repos - What do you want to do?
○ Create
○ Rename (currently disabled)
○ Delete
○ Manage dependenciesCreating a Domain Repo
Prompts for:
- Domain selection
- Repo name (kebab-case)
Creates the repo files, schemas, and tester.
Domain Services
Shared business logic within a domain.
Domain Services - What do you want to do?
○ Create
○ Rename (currently disabled)
○ Delete
○ Manage dependencies
○ Manage service reposCreating a Domain Service
Prompts for:
- Domain selection
- Service name (kebab-case)
Creates the service files, schemas, and tester.
Service Repos
Domain services can have their own repos (service repos):
Manage "calculate-pricing" service repos - What do you want to do?
○ Add service repo
○ Delete service repoApp Services
Application-wide services (cross-cutting concerns).
App Services - What do you want to do?
○ Create
○ Rename (currently disabled)
○ Delete
○ Manage dependenciesCreating an App Service
Prompts for:
- Service name (kebab-case)
- Scope - Request scoped or Global
See App Services for when to use each scope.
Base Classes
Manage dependencies at the base class level - affecting all components of that type.
Base Classes - What do you want to do?
○ Add dependency
○ Remove dependencyThis is useful when you want to add a dependency to all use-cases, all repos, or all services at once.
List & Inspect
View your project's injectables and their dependencies.
List & Inspect - What do you want to do?
○ List all injectables
○ Inspect an injectableList all shows all registered components grouped by type.
Inspect shows details about a specific injectable:
- Its dependencies
- What depends on it (dependents)
- Its type and domain
Visualize
Opens an interactive HTML visualization of your endpoints and their dependencies in your browser.
See Visualizer for more details.
Other CLI Commands
Outside the interactive menu, you also have:
# Sync API client from OpenAPI spec
pnpm api:sync
# Sync translations
pnpm i18n:sync
# Open the visualizer directly
pnpm visualizeNaming Conventions
All names must be in kebab-case:
- ✅
create-customer - ✅
order-management - ✅
calculate-pricing - ❌
createCustomer - ❌
Create_Customer
The CLI automatically converts to PascalCase for class names, camelCase for variables, etc.
Error Recovery
If the CLI fails mid-operation, your working tree may be in an incomplete state. Reset with:
git restore . && git clean -fdThen run the CLI again.