Reference

CLI Commands

CanxJS provides a powerful CLI to help you scaffold, develop, and maintain your applications.

Quick Start

Create and run your first CanxJS application in seconds.

Terminal
# Create a new project
bunx create-canx my-app
# Navigate to project
cd my-app
# Install dependencies
bun install
# Start development server
bun run dev

All Commands

Project Creation

$ bunx create-canx my-app

Create a new CanxJS project with the default MVC template

$ bunx create-canx my-app --api

Create an API-only project without views

$ bunx create-canx my-app --micro

Create a minimal microservice setup

$ bunx create-canx my-app --ts

Create project with strict TypeScript configuration

Development

$ bun run dev

Start development server with hot reload

$ bun run build

Build for production

$ bun run start

Start production server

$ bun run lint

Run ESLint on your codebase

Database

$ bun run canx migrate

Run pending migrations

$ bun run canx migrate:rollback

Rollback the last batch of migrations

$ bun run canx migrate:fresh

Drop all tables and re-run all migrations

$ bun run canx seed

Run database seeders

$ bun run canx make:migration create_users

Create a new migration file

$ bun run canx make:seeder UserSeeder

Create a new seeder file

Generators

$ bun run canx make:controller UserController

Create a new controller

$ bun run canx make:model User

Create a new model

$ bun run canx make:middleware Auth

Create a new middleware

$ bun run canx make:route api

Create a new route file

Utilities

$ bun run canx cache:clear

Clear application cache

$ bun run canx routes

List all registered routes

$ bun run canx env

Display current environment configuration

Generator Example

The CLI generators create boilerplate code for you, following CanxJS conventions.

Terminal
# Create a controller
bun run canx make:controller UserController
# Creates: src/controllers/UserController.ts
# With basic CRUD methods: index, show, store, update, destroy

Next Steps

Learn more about the CanxJS API and how to use it in your applications.