๐Ÿ”ท Core trusted

coldbox-app-layouts

Use this skill when choosing a ColdBox application layout (flat, boxlang, or modern), scaffolding a new ColdBox project, understanding project directory structure, deciding between app structure options, or migrating from one layout to another. Use when asked about flat layout, boxlang template, modern template, app structure, project skeleton, or web root separation.

$ npx skills add coldbox/skills/coldbox/app-layouts
$ coldbox ai skills install coldbox/skills/coldbox/app-layouts
๐Ÿ”— https://skills.boxlang.io/skills/raw/coldbox/skills/coldbox~app-layouts

App Layouts

When to Use This Skill

Use this skill when:

  • Creating a new ColdBox application from scratch and choosing a project structure
  • Deciding between the flat, boxlang, and modern application templates
  • Scaffolding via box coldbox create app skeleton=<name>
  • Understanding directory conventions for an existing app
  • Migrating from one layout to another

Language & Engine Compatibility

LayoutCFML (Adobe CF / Lucee)BoxLang
flatYesYes
boxlangNoYes only
modernYesYes

Default: The ColdBox CLI (coldbox create app) defaults to the boxlang skeleton. Pass --cfml or skeleton=flat / skeleton=modern to use another layout.

Flat Layout

Template repo: https://github.com/coldbox-templates/flat

The flat layout places all application code directly in the web root. It is the traditional ColdBox structure and the widest-compatibility choice โ€” works with Adobe ColdFusion, Lucee, and BoxLang.

Flat: Directory Map

/
โ”œโ”€โ”€ Application.cfc             # App bootstrap
โ”œโ”€โ”€ index.cfm                   # Front controller
โ”œโ”€โ”€ box.json                    # CommandBox package descriptor
โ”œโ”€โ”€ server.json                 # Server configuration
โ”œโ”€โ”€ pom.xml                     # Maven Java dependencies (optional)
โ”‚
โ”œโ”€โ”€ config/
โ”‚   โ”œโ”€โ”€ ColdBox.cfc             # Framework settings
โ”‚   โ”œโ”€โ”€ Router.cfc              # URL routing
โ”‚   โ””โ”€โ”€ WireBox.cfc             # DI bindings (optional)
โ”‚
โ”œโ”€โ”€ handlers/                   # Event handlers (controllers)
โ”œโ”€โ”€ models/                     # Services, beans, business logic
โ”œโ”€โ”€ views/                      # View templates
โ”œโ”€โ”€ layouts/                    # Layout wrappers
โ”œโ”€โ”€ interceptors/               # Event interceptors
โ”œโ”€โ”€ modules_app/                # Internal HMVC modules
โ”‚
โ”œโ”€โ”€ includes/                   # Public assets (CSS, JS, images)
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ””โ”€โ”€ images/
โ”‚
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ Application.cfc
โ”‚   โ”œโ”€โ”€ runner.cfm
โ”‚   โ””โ”€โ”€ specs/
โ”‚       โ”œโ”€โ”€ integration/
โ”‚       โ””โ”€โ”€ unit/
โ”‚
โ””โ”€โ”€ lib/                        # Framework libraries (managed by CommandBox)
    โ”œโ”€โ”€ coldbox/
    โ””โ”€โ”€ testbox/

Flat: Best For

  • Rapid prototyping and quick-start projects
  • Learning ColdBox โ€” the structure is immediately visible
  • Traditional shared hosting environments
  • Teams familiar with standard CFML application structures
  • Internal tools that do not require strict code/web-root separation

Flat: Caveats

  • All application code (handlers, models, config) lives under the web root and is theoretically directly accessible
  • Modules with UI assets require no special alias configuration since everything is in the same root
  • Not recommended for security-critical production deployments without additional server-level restrictions

Flat: Scaffold Command

box coldbox create app name=myApp skeleton=flat

BoxLang Layout

Template repo: https://github.com/coldbox-templates/boxlang

The BoxLang layout is the default modern architecture for BoxLang-native applications. It uses the same /app + /public separation as the Modern layout but adds BoxLang-specific assets: .bx class files, a runtime/ configuration directory, a Build.bx build script, Vite frontend tooling, and native BoxLang mappings pre-configured in runtime/config/boxlang.json.

BoxLang: Directory Map

/
โ”œโ”€โ”€ box.json                    # CommandBox package descriptor
โ”œโ”€โ”€ server.json                 # CommandBox server config (webroot = public/)
โ”œโ”€โ”€ pom.xml                     # Maven Java deps (optional)
โ”œโ”€โ”€ Build.bx                    # BoxLang build + distribution script
โ”‚
โ”œโ”€โ”€ app/                        # Application code (NOT web-accessible)
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”œโ”€โ”€ ColdBox.bx          # Framework settings
โ”‚   โ”‚   โ”œโ”€โ”€ Router.bx           # URL routing
โ”‚   โ”‚   โ”œโ”€โ”€ WireBox.bx          # DI bindings (optional)
โ”‚   โ”‚   โ”œโ”€โ”€ CacheBox.bx         # Caching config (optional)
โ”‚   โ”‚   โ””โ”€โ”€ Scheduler.bx        # Task scheduling (optional)
โ”‚   โ”œโ”€โ”€ handlers/               # Event handlers
โ”‚   โ”œโ”€โ”€ helpers/                # Application helpers (optional)
โ”‚   โ”œโ”€โ”€ interceptors/           # Event interceptors
โ”‚   โ”œโ”€โ”€ layouts/                # View layouts
โ”‚   โ”œโ”€โ”€ logs/                   # App logs (optional)
โ”‚   โ”œโ”€โ”€ models/                 # Business logic
โ”‚   โ”œโ”€โ”€ modules/                # App-specific modules (optional)
โ”‚   โ””โ”€โ”€ views/                  # View templates (.bxm)
โ”‚
โ”œโ”€โ”€ public/                     # Web root (CommandBox points here)
โ”‚   โ”œโ”€โ”€ Application.bx          # Web-facing bootstrap
โ”‚   โ”œโ”€โ”€ index.bxm               # Front controller
โ”‚   โ”œโ”€โ”€ favicon.ico
โ”‚   โ”œโ”€โ”€ robots.txt
โ”‚   โ””โ”€โ”€ includes/               # Static assets
โ”‚
โ”œโ”€โ”€ lib/                        # Dependencies (managed by CommandBox)
โ”‚   โ”œโ”€โ”€ coldbox/
โ”‚   โ”œโ”€โ”€ testbox/
โ”‚   โ”œโ”€โ”€ modules/                # ColdBox modules
โ”‚   โ””โ”€โ”€ java/                   # Java JARs (managed by Maven)
โ”‚
โ”œโ”€โ”€ resources/                  # Non-web resources
โ”‚   โ”œโ”€โ”€ migrations/             # Database migrations (cbmigrations)
โ”‚   โ”œโ”€โ”€ docker/                 # Docker configuration (optional)
โ”‚   โ”œโ”€โ”€ seeders/                # Database seeders
โ”‚   โ”œโ”€โ”€ swagger/                # API docs (cbswagger)
โ”‚   โ””โ”€โ”€ assets/                 # Vite source assets (if using Vite)
โ”‚       โ”œโ”€โ”€ css/
โ”‚       โ””โ”€โ”€ js/
โ”‚
โ”œโ”€โ”€ runtime/                    # BoxLang runtime overrides
โ”‚   โ”œโ”€โ”€ boxlang.json            # Custom BoxLang configuration
โ”‚   โ”œโ”€โ”€ global/
โ”‚   โ”‚   โ”œโ”€โ”€ classes/
โ”‚   โ”‚   โ””โ”€โ”€ components/
โ”‚   โ””โ”€โ”€ logs/
โ”‚
โ””โ”€โ”€ tests/
    โ”œโ”€โ”€ Application.bx
    โ”œโ”€โ”€ runner.cfm
    โ””โ”€โ”€ specs/
        โ””โ”€โ”€ integration/

BoxLang: Best For

  • BoxLang-native applications where you want idiomatic .bx classes throughout
  • Projects using the BoxLang OS runtime for CLI/script use alongside web serving
  • Applications leveraging Vite for modern frontend asset pipelines (Vue 3, Tailwind)
  • Production BoxLang deployments with compiled bytecode distribution via Build.bx
  • Teams fully committed to the BoxLang ecosystem

BoxLang: Caveats

  • BoxLang only โ€” does not support Adobe ColdFusion or Lucee
  • Requires BoxLang OS runtime (1.6+) in addition to CommandBox for the build script
  • Module web UI assets require server.json aliases (same as Modern)
  • Test components must include appMapping="/app"
  • The runtime/ directory is BoxLang-specific and does not exist in Flat or Modern

BoxLang: Scaffold Command

# Default โ€” this is what `box coldbox create app` uses
box coldbox create app name=myApp

# Explicit
box coldbox create app name=myApp skeleton=boxlang

# With optional features
box coldbox create app name=myApp skeleton=boxlang --vite --docker --migrations

BoxLang: Testing Baseline

// tests/specs/integration/MainSpec.bx
class extends="coldbox.system.testing.BaseTestCase" appMapping="/app" {

    function beforeAll() {
        super.beforeAll()
    }

    function run(){
        describe( "Main Handler", function(){
            beforeEach( function( currentSpec ){
                setup()
            })

            it( "can render the homepage", function(){
                var event = this.get( "main.index" )
                expect( event.getRenderedContent() ).notToBeEmpty()
            })
        })
    }
}

Modern Layout

Template repo: https://github.com/coldbox-templates/modern

The Modern layout implements a security-first architecture by separating application code from the web root. It is compatible with both Adobe ColdFusion (2021+) and BoxLang. Unlike the BoxLang layout, it uses .cfc files and traditional CFML tag syntax throughout; BoxLang .bx files may be used when running on BoxLang with CFML compat mode.

Note: Lucee is not supported by this template.

Modern: Directory Map

/
โ”œโ”€โ”€ box.json                    # CommandBox package descriptor
โ”œโ”€โ”€ server.json                 # CommandBox server config (webroot = public/)
โ”œโ”€โ”€ pom.xml                     # Maven Java deps (optional)
โ”‚
โ”œโ”€โ”€ app/                        # Application code (NOT web-accessible)
โ”‚   โ”œโ”€โ”€ Application.cfc         # Contains only `abort;` to block direct access
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”œโ”€โ”€ ColdBox.cfc         # Framework settings
โ”‚   โ”‚   โ”œโ”€โ”€ Router.cfc          # URL routing
โ”‚   โ”‚   โ”œโ”€โ”€ WireBox.cfc         # DI bindings (optional)
โ”‚   โ”‚   โ””โ”€โ”€ CacheBox.cfc        # Caching config (optional)
โ”‚   โ”œโ”€โ”€ handlers/               # Event handlers
โ”‚   โ”œโ”€โ”€ helpers/                # Application helpers (optional)
โ”‚   โ”œโ”€โ”€ interceptors/           # Event interceptors
โ”‚   โ”œโ”€โ”€ layouts/                # View layouts
โ”‚   โ”œโ”€โ”€ logs/                   # App logs
โ”‚   โ”œโ”€โ”€ models/                 # Business logic
โ”‚   โ””โ”€โ”€ views/                  # View templates (.cfm)
โ”‚
โ”œโ”€โ”€ public/                     # Web root (CommandBox points here)
โ”‚   โ”œโ”€โ”€ Application.cfc         # Bootstrap that maps to /app
โ”‚   โ”œโ”€โ”€ index.cfm               # Front controller
โ”‚   โ”œโ”€โ”€ favicon.ico
โ”‚   โ”œโ”€โ”€ robots.txt
โ”‚   โ””โ”€โ”€ includes/               # Static assets (CSS, JS, images)
โ”‚
โ”œโ”€โ”€ lib/                        # Dependencies (managed by CommandBox)
โ”‚   โ”œโ”€โ”€ coldbox/
โ”‚   โ”œโ”€โ”€ testbox/
โ”‚   โ”œโ”€โ”€ modules/                # ColdBox modules
โ”‚   โ””โ”€โ”€ java/                   # Java JARs (managed by Maven)
โ”‚
โ”œโ”€โ”€ resources/                  # Non-web resources
โ”‚   โ”œโ”€โ”€ database/               # Migrations and seeders
โ”‚   โ””โ”€โ”€ apidocs/                # API documentation
โ”‚
โ””โ”€โ”€ tests/
    โ”œโ”€โ”€ Application.cfc
    โ”œโ”€โ”€ runner.cfm
    โ”œโ”€โ”€ index.cfm
    โ””โ”€โ”€ specs/
        โ””โ”€โ”€ integration/

Modern: Best For

  • Production and enterprise applications requiring code/web-root separation
  • Mixed CFML + BoxLang teams where Adobe CF 2021+ or BoxLang is the target engine
  • Security-conscious deployments where application logic must not be directly web-accessible
  • Environments where you cannot configure server-level URL rewriting to block access to application directories

Modern: Caveats

  • Module web UI assets (e.g., cbdebugger, cbswagger) require server.json aliases since lib/ is outside the web root
  • Test components must include appMapping="/app" in BaseTestCase
  • Direct HTTP access to /app/ returns 404 by design โ€” this is intentional
  • app/Application.cfc only contains abort; as a security barrier

Modern: Scaffold Command

box coldbox create app name=myApp skeleton=modern

Critical server.json Aliases

{
    "web": {
        "webroot": "public",
        "rewrites": { "enable": true },
        "aliases": {
            "/coldbox/system/exceptions": "./lib/coldbox/system/exceptions/",
            "/tests": "./tests/"
        }
    }
}

Add an alias for every module that exposes web assets:

"/cbdebugger": "./lib/modules/cbdebugger"

Modern: Testing Baseline

// tests/specs/integration/MainSpec.cfc
component extends="coldbox.system.testing.BaseTestCase" appMapping="/app" {

    function beforeAll(){
        super.beforeAll()
    }

    function run(){
        describe( "Main Handler", function(){
            beforeEach( function( currentSpec ){
                setup()
            })

            it( "can render the homepage", function(){
                var event = this.get( "main.index" )
                expect( event.getRenderedContent() ).notToBeEmpty()
            })
        })
    }
}

Choosing the Right Layout

ScenarioRecommended Layout
Learning ColdBox or rapid prototypingflat
Simple internal tool on traditional hostingflat
BoxLang-native app, CLI + web, or Vite frontendboxlang
Full BoxLang ecosystem (compiled builds, BoxLang OS)boxlang
Production Adobe CF or mixed CF/BoxLang teammodern
Enterprise security-first deploymentmodern
Multi-engine team (Lucee included)flat (only layout supporting Lucee)

Decision Flowchart

Are you using BoxLang exclusively?
โ”œโ”€โ”€ Yes โ†’ Do you need Vite, Build.bx, or BoxLang OS runtime?
โ”‚         โ”œโ”€โ”€ Yes โ†’ boxlang
โ”‚         โ””โ”€โ”€ No  โ†’ boxlang (still the default) or modern
โ””โ”€โ”€ No  โ†’ Does security or deployment require code outside the web root?
          โ”œโ”€โ”€ Yes โ†’ modern
          โ””โ”€โ”€ No  โ†’ flat

Migrating Between Layouts

Flat to Modern or BoxLang

  1. Move handlers/, models/, views/, layouts/, interceptors/, config/ into app/
  2. Create public/ with Application.cfc (or .bx) that sets COLDBOX_APP_ROOT_PATH and COLDBOX_APP_MAPPING="/app"
  3. Move index.cfm (or index.bxm) and static assets to public/
  4. Update server.json to set webroot = "public" and add any module aliases
  5. Update all test components to include appMapping="/app"

Modern to BoxLang

  1. Rename .cfc files to .bx and replace component with class
  2. Rename .cfm/.cfml view/layout files to .bxm
  3. Rename config files (ColdBox.cfc โ†’ ColdBox.bx, Router.cfc โ†’ Router.bx, etc.)
  4. Add a runtime/ directory with boxlang.json for BoxLang mappings
  5. Add Build.bx if you need compiled distribution builds