LogoLogo
HomeAPIBlog
3.0.0-SNAPSHOT
3.0.0-SNAPSHOT
  • INTRODUCTION
    • Getting Started
      • Running Local Development Servers
      • Beginner Tutorial: Hello World
      • Beginner Tutorial: Hello Database
      • Tutorial: Wheels, AJAX, and You
    • Frameworks and Wheels
    • Requirements
    • Manual Installation
    • Upgrading
    • Screencasts
  • Command Line Tools
    • CLI Overview
    • Quick Start Guide
    • Command Reference
      • Core Commands
        • wheels init
        • wheels info
        • wheels reload
        • wheels deps
        • wheels destroy
        • wheels watch
      • Code Generation
        • wheels generate app
        • wheels generate app-wizard
        • wheels generate controller
        • wheels generate model
        • wheels generate view
        • wheels generate property
        • wheels generate route
        • wheels generate resource
        • wheels generate api-resource
        • wheels generate frontend
        • wheels generate test
        • wheels generate snippets
        • wheels scaffold
      • Database Commands
        • wheels dbmigrate info
        • wheels dbmigrate latest
        • wheels dbmigrate up
        • wheels dbmigrate down
        • wheels dbmigrate reset
        • wheels dbmigrate exec
        • wheels dbmigrate create blank
        • wheels dbmigrate create table
        • wheels dbmigrate create column
        • wheels dbmigrate remove table
        • wheels db schema
        • wheels db seed
      • Testing Commands
        • wheels test
        • wheels test run
        • wheels test coverage
        • wheels test debug
      • Configuration Commands
        • wheels config list
        • wheels config set
        • wheels config env
      • Environment Management
        • wheels env
        • wheels env setup
        • wheels env list
        • wheels env switch
      • Plugin Management
        • wheels plugins
        • wheels plugins list
        • wheels plugins install
        • wheels plugins remove
      • Code Analysis
        • wheels analyze
        • wheels analyze code
        • wheels analyze performance
        • wheels analyze security
      • Security Commands
        • wheels security
        • wheels security scan
      • Performance Commands
        • wheels optimize
        • wheels optimize performance
      • Documentation Commands
        • wheels docs
        • wheels docs generate
        • wheels docs serve
      • CI/CD Commands
        • wheels ci init
      • Docker Commands
        • wheels docker init
        • wheels docker deploy
      • Deployment Commands
        • wheels deploy
        • wheels deploy audit
        • wheels deploy exec
        • wheels deploy hooks
        • wheels deploy init
        • wheels deploy lock
        • wheels deploy logs
        • wheels deploy proxy
        • wheels deploy push
        • wheels deploy rollback
        • wheels deploy secrets
        • wheels deploy setup
        • wheels deploy status
        • wheels deploy stop
    • CLI Development Guides
      • Creating Commands
      • Service Architecture
      • Migrations Guide
      • Testing Guide
  • Working with Wheels
    • Conventions
    • Configuration and Defaults
    • Directory Structure
    • Switching Environments
    • Testing Your Application
    • Using the Test Environment
    • Contributing to Wheels
    • Submitting Pull Requests
    • Documenting your Code
  • Handling Requests with Controllers
    • Request Handling
    • Rendering Content
    • Redirecting Users
    • Sending Files
    • Sending Email
    • Responding with Multiple Formats
    • Using the Flash
    • Using Filters
    • Verification
    • Event Handlers
    • Routing
    • URL Rewriting
      • Apache
      • IIS
      • Tomcat
      • Nginx
    • Obfuscating URLs
    • Caching
    • Nesting Controllers
    • CORS Requests
  • Displaying Views to Users
    • Pages
    • Partials
    • Linking Pages
    • Layouts
    • Form Helpers and Showing Errors
    • Displaying Links for Pagination
    • Date, Media, and Text Helpers
    • Creating Custom View Helpers
    • Localization
  • Database Interaction Through Models
    • Object Relational Mapping
    • Creating Records
    • Reading Records
    • Updating Records
    • Deleting Records
    • Column Statistics
    • Dynamic Finders
    • Getting Paginated Data
    • Associations
    • Nested Properties
    • Object Validation
    • Object Callbacks
    • Calculated Properties
    • Transactions
    • Dirty Records
    • Soft Delete
    • Automatic Time Stamps
    • Database Migrations
      • Migrations in Production
    • Using Multiple Data Sources
  • Plugins
    • Installing and Using Plugins
    • Developing Plugins
    • Publishing Plugins
  • Project Documentation
    • Overview
  • External Links
    • Source Code
    • Issue Tracker
    • Sponsor Us
    • Community
Powered by GitBook
LogoLogo
On this page
  • Synopsis
  • Description
  • Arguments
  • Options
  • Available Templates
  • Base (Default)
  • Base@BE (Backend Edition)
  • HelloWorld
  • HelloDynamic
  • HelloPages
  • Examples
  • Create basic application
  • Create with custom template
  • Create in specific directory
  • Create with Bootstrap
  • Create with H2 database
  • Create with all options
  • Generated Structure
  • Configuration Files
  • box.json
  • server.json
  • .wheels-cli.json
  • Database Setup
  • With H2 (Embedded)
  • With External Database
  • Post-Generation Steps
  • Template Development
  • Best Practices
  • Common Issues
  • See Also

Was this helpful?

Edit on GitHub
Export as PDF
  1. Command Line Tools
  2. Command Reference
  3. Code Generation

wheels generate app

Create a new Wheels application from templates.

Synopsis

wheels generate app [name] [template] [directory] [options]
wheels g app [name] [template] [directory] [options]
wheels new [name] [template] [directory] [options]

Description

The wheels generate app command creates a new Wheels application with a complete directory structure, configuration files, and optionally sample code. It supports multiple templates for different starting points.

Arguments

Argument
Description
Default

name

Application name

Required

template

Template to use

Base

directory

Target directory

./{name}

Options

Option
Description
Default

--reloadPassword

Set reload password

wheels

--datasourceName

Database datasource name

App name

--cfmlEngine

CFML engine (lucee/adobe)

lucee

--useBootstrap

Include Bootstrap CSS

false

--setupH2

Setup H2 embedded database

false

--init

Initialize as CLI-enabled app

true

--force

Overwrite existing directory

false

--help

Show help information

Available Templates

Base (Default)

wheels generate app myapp
  • Minimal Wheels application

  • Basic directory structure

  • Essential configuration files

Base@BE (Backend Edition)

wheels generate app myapp Base@BE
  • Backend-focused template

  • No view files

  • API-ready configuration

HelloWorld

wheels generate app myapp HelloWorld
  • Simple "Hello World" example

  • One controller and view

  • Great for learning

HelloDynamic

wheels generate app myapp HelloDynamic
  • Dynamic content example

  • Database interaction

  • Form handling

HelloPages

wheels generate app myapp HelloPages
  • Static pages example

  • Layout system

  • Navigation structure

Examples

Create basic application

wheels generate app blog

Create with custom template

wheels generate app api Base@BE

Create in specific directory

wheels generate app myapp Base ./projects/

Create with Bootstrap

wheels generate app portfolio --useBootstrap

Create with H2 database

wheels generate app demo --setupH2

Create with all options

wheels generate app enterprise HelloDynamic ./apps/ \
  --reloadPassword=secret \
  --datasourceName=enterprise_db \
  --cfmlEngine=adobe \
  --useBootstrap \
  --setupH2

Generated Structure

myapp/
├── .wheels-cli.json      # CLI configuration
├── box.json              # Dependencies
├── server.json           # Server configuration
├── Application.cfc       # Application settings
├── config/
│   ├── app.cfm          # App configuration
│   ├── routes.cfm       # URL routes
│   └── settings.cfm     # Framework settings
├── controllers/
│   └── Main.cfc         # Default controller
├── models/
├── views/
│   ├── layout.cfm       # Default layout
│   └── main/
│       └── index.cfm    # Home page
├── public/
│   ├── stylesheets/
│   ├── javascripts/
│   └── images/
├── tests/
└── wheels/              # Framework files

Configuration Files

box.json

{
  "name": "myapp",
  "version": "1.0.0",
  "dependencies": {
    "wheels": "^2.5.0"
  }
}

server.json

{
  "web": {
    "http": {
      "port": 3000
    }
  },
  "app": {
    "cfengine": "lucee@5"
  }
}

.wheels-cli.json

{
  "name": "myapp",
  "version": "1.0.0",
  "framework": "wheels",
  "reload": "wheels"
}

Database Setup

With H2 (Embedded)

wheels generate app myapp --setupH2
  • No external database needed

  • Perfect for development

  • Auto-configured datasource

With External Database

  1. Create application:

    wheels generate app myapp --datasourceName=myapp_db
  2. Configure in CommandBox:

    server set app.datasources.myapp_db={...}

Post-Generation Steps

  1. Navigate to directory

    cd myapp
  2. Install dependencies

    box install
  3. Start server

    box server start
  4. Open browser

    http://localhost:3000

Template Development

Create custom templates in ~/.commandbox/cfml/modules/wheels-cli/templates/apps/:

mytemplate/
├── config/
├── controllers/
├── models/
├── views/
└── template.json

Best Practices

  1. Use descriptive application names

  2. Choose appropriate template for project type

  3. Set secure reload password for production

  4. Configure datasource before starting

  5. Run tests after generation

Common Issues

  • Directory exists: Use --force or choose different name

  • Template not found: Check available templates with wheels info

  • Datasource errors: Configure database connection

  • Port conflicts: Change port in server.json

See Also

  • wheels init - Initialize existing application

PreviousCode GenerationNextwheels generate app-wizard

Last updated 2 days ago

Was this helpful?

- Interactive app creation

- Generate CRUD scaffolding

wheels generate app-wizard
wheels scaffold