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.
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, andmodernapplication 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
| Layout | CFML (Adobe CF / Lucee) | BoxLang |
|---|---|---|
flat | Yes | Yes |
boxlang | No | Yes only |
modern | Yes | Yes |
Default: The ColdBox CLI (
coldbox create app) defaults to theboxlangskeleton. Pass--cfmlorskeleton=flat/skeleton=modernto 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
.bxclasses 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.jsonaliases (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) requireserver.jsonaliases sincelib/is outside the web root - Test components must include
appMapping="/app"inBaseTestCase - Direct HTTP access to
/app/returns 404 by design โ this is intentional app/Application.cfconly containsabort;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
| Scenario | Recommended Layout |
|---|---|
| Learning ColdBox or rapid prototyping | flat |
| Simple internal tool on traditional hosting | flat |
| BoxLang-native app, CLI + web, or Vite frontend | boxlang |
| Full BoxLang ecosystem (compiled builds, BoxLang OS) | boxlang |
| Production Adobe CF or mixed CF/BoxLang team | modern |
| Enterprise security-first deployment | modern |
| 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
- Move
handlers/,models/,views/,layouts/,interceptors/,config/intoapp/ - Create
public/withApplication.cfc(or.bx) that setsCOLDBOX_APP_ROOT_PATHandCOLDBOX_APP_MAPPING="/app" - Move
index.cfm(orindex.bxm) and static assets topublic/ - Update
server.jsonto setwebroot = "public"and add any module aliases - Update all test components to include
appMapping="/app"
Modern to BoxLang
- Rename
.cfcfiles to.bxand replacecomponentwithclass - Rename
.cfm/.cfmlview/layout files to.bxm - Rename config files (
ColdBox.cfcโColdBox.bx,Router.cfcโRouter.bx, etc.) - Add a
runtime/directory withboxlang.jsonfor BoxLang mappings - Add
Build.bxif you need compiled distribution builds