v0.21

cli

introduction

dframework includes a command line interface accessible via the dstrn binary. it provides commands for scaffolding new projects, managing the database, generating application files, analyzing architecture, and running an interactive shell.

1dstrn help

available commands

scaffolding

command description
dstrn init <dir> [--ai] scaffold a minimal project with optional ai helpers
dstrn serve run the server in the current directory
dstrn tinker open an interactive repl shell with models preloaded
dstrn key:generate generate a random encryption key

database

command description
dstrn migrate run all pending migrations
dstrn migrate:status display migration status
dstrn migrate:rollback rollback the last migration batch
dstrn migrate:make <table> create a new migration template
dstrn seed run all seeders
dstrn seed:make <Name> create a new seeder template
dstrn drop drop the database with confirmation

generators

command description
dstrn make:model <Name> create a new model
dstrn make:controller <Name> create a new controller
dstrn make:middleware <Name> create a new middleware
dstrn make:command <Name> create a new console command
dstrn make:job <Name> create a new background job
dstrn make:component <Name> create a new view component

system

command description
dstrn run <CommandName> run a user command from console/commands
dstrn logs:clear clear or archive log files with date filtering
dstrn docs:publish publish framework documentation to your project
dstrn ai:publish publish agentic documentation helpers

native

command description
dstrn simulate --<platform> run in a platform simulator
dstrn build --target <platform> build a production binary
dstrn make:plugin <Name> scaffold a cross platform native plugin
dstrn native:status display native config and readiness
dstrn native:doctor full environment diagnostic
dstrn native:clean [--<platform>] clean native build artifacts

architecture

command description
dstrn graph display the application dependency graph
dstrn lint detect architecture violations
dstrn dead find unreachable dead code
dstrn doctor compute a project quality score

creating a project

the init command scaffolds a new project with the standard directory structure, a default configuration file, a sample route, and a basic view.

1dstrn init my-app

passing the --ai flag includes agentic documentation helpers in the generated project.

1dstrn init my-app --ai

running the server

the serve command starts the application server in the current directory.

1dstrn serve

this loads the application configuration, imports all route files, boots the socket server, starts the scheduler, and begins listening for http requests. the startup banner displays the application url and port.

tinker

the tinker command opens an interactive shell with the full application context loaded. all models are automatically imported and available as globals.

1dstrn tinker
1dframework> const users = await User.all();
2dframework> users.length
342
4dframework> await User.where('role', 'admin').get();

the shell persists command history to .tinker_history in your project root. all framework facades (DB, Config, Session, Auth, Log, etc.) are available in the context.

user commands

creating a command

scaffold a new command file using the make:command generator.

1dstrn make:command PruneExpiredSessions

this creates console/commands/PruneExpiredSessions.js. the generated file exports a class with a handle() method where you write the command logic. the command has access to all framework globals.

1export default class PruneExpiredSessions {
2 async handle() {
3 const cutoff = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
4 await DB.table('sessions').where('updated_at', '<', cutoff).delete();
5 Log.info('expired sessions pruned');
6 }
7}

running a command

execute any command from console/commands using the run command.

1dstrn run PruneExpiredSessions

dframework imports the command class, instantiates it, calls handle(), and reports the elapsed execution time on completion.

commands are also used by the scheduler. any command referenced in console/Schedule.js is resolved from the same console/commands directory.

logs management

the logs:clear command provides flexible log file management with date range filtering, environment targeting, archiving, and a preview mode.

1dstrn logs:clear
2dstrn logs:clear --env=prod
3dstrn logs:clear --before=2026-01-01
4dstrn logs:clear --after=2026-05-01 --archive
5dstrn logs:clear --preview
flag description
--env=prod or --env=dev target a specific environment log directory
--before=YYYY-MM-DD clear logs before the specified date
--after=YYYY-MM-DD clear logs after the specified date
--archive compress logs into a zip instead of deleting
--preview show which files would be affected without acting

architecture analyzer

dframework includes a static analysis engine that builds a complete dependency graph of your application. it powers the graph, lint, dead, and doctor commands.

dependency graph

the graph command generates a visual representation of how your application is wired. it shows every http route and socket wire, the controllers they dispatch to, the middleware they pass through, and the models those controllers depend on.

1dstrn graph
1get /users (users.index)
2 └─ AuthMiddleware
3 └─ UserController (User)
4 └─ index()
5
6post /users (users.store)
7 └─ AuthMiddleware
8 └─ UserController (User)
9 └─ store()
10
11chat:message
12 └─ AuthMiddleware
13 └─ ChatController (Message)
14 └─ onMessage()

for machine readable output, pass the --json flag.

1dstrn graph --json

this outputs the full graph as a json object with nodes and edges arrays, suitable for external visualization tools.

architecture lint

the lint command detects structural violations in your application. it enforces the following dependency rules:

1dstrn lint

if violations are found, each one is printed with a description.

1 ERROR controller UserController depends on controller AdminController
2 controllers may not depend on controllers

dead code detection

the dead command performs reachability analysis starting from all registered routes and socket wires. it traverses the dependency graph and reports any controllers, models, or middleware that are never referenced by any route.

1dstrn dead
1 ERROR found 2 unreachable components
2
3unused controller
4 LegacyController
5
6unused model
7 TempModel

database tables are excluded from the analysis since they may be accessed through raw queries.

project doctor

the doctor command computes a quality score from 0 to 100 based on three factors:

1dstrn doctor
1 OK health score 95 out of 100
2
3deductions
4 dead code minus 5 (1 unreachable components)

scores of 90 and above are displayed as success, 70-89 as informational, and below 70 as an error.

the compiler

dframework includes a build time compiler that bundles and minifies the frontend runtime assets.

javascript compilation

the js compiler concatenates the framework's core client side files (the main runtime, native bridge, custom elements, and utility functions), along with any user defined component files found in public/js/components. the combined output is minified with three compression passes, function name mangling, and toplevel mangling. the result is written to public/js/dstrn.js.

in the local environment with debug mode enabled, the __DF_DEBUG__ global is set to true, enabling debug only code paths in the client runtime. in production, these paths are eliminated during dead code elimination.

css compilation

the css compiler concatenates the framework's base styles, utility classes, icon font, and component styles. it then generates responsive variants for each utility class across six breakpoints (sm, md, lg, xl, xxl, ultra) using the prefix\:classname pattern. user defined component css files from public/css/components are included in the output.

the final output is minified by stripping comments, collapsing whitespace, removing unnecessary semicolons, and eliminating zero unit suffixes. the result is written to public/css/dstrn.css.