Common Workflows
This page shows a few end‑to‑end examples that combine the concepts from the getting‑started guides and reference docs.
Build and run a simple CFML script
-
Create a project directory and script:
mkdir -p ~/projects/hello-lucli cd ~/projects/hello-lucli echo "writeOutput('Hello from LuCLI' & chr(10));" > hello.cfs -
Run the script:
lucli hello.cfs -
Add arguments and handle them in CFML (see Shortcuts & Direct Execution):
lucli hello.cfs one two three
Start a project server with URL rewriting
-
In your project directory, create
lucee.json:{ "name": "my-app", "port": 8080, "urlRewrite": { "enabled": true, "routerFile": "index.cfm" } } -
Create a basic
index.cfmrouter. -
Run:
lucli server start -
Open
http://localhost:8080/and test routes like/aboutor/blog.
See URL Rewriting for router patterns and advanced configuration.
Turn a script into a reusable module
-
Create and refine a
.cfsscript until you use it regularly. -
Scaffold a module:
lucli modules init my-utility -
Move your logic into
~/.lucli/modules/my-utility/Module.cfc. -
Run it anywhere:
lucli my-utility arg1 arg2
See the Modules page for more on module structure and arguments.
Debug a server with a Java agent
-
Add an agent block to your
lucee.json(for example, a debugger or Prometheus exporter):{ "monitoring": { "enabled": true, "jmx": { "port": 8999 } }, "agents": { "luceedebug": { "enabled": false, "jvmArgs": [ "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:9999" ], "description": "Lucee step debugger agent" } } } -
Start the server with the agent enabled:
lucli server start --enable-agent luceedebug -
Attach your debugger or scrape metrics, depending on the agent.
-
If startup fails and you suspect agents, retry without them:
lucli server start --no-agents
For full agent configuration options, see Server Agents.
Typical development loop
A common day‑to‑day loop looks like:
-
Start or restart a project server:
lucli server start -
Tail logs while you develop:
lucli server log --follow -
Use the monitoring dashboard when you need more detail:
lucli server monitor -
Run one‑off CFML scripts for maintenance or data fixes:
lucli scripts/cleanup.cfs -
Once a script stabilizes, promote it to a module so you can call it from any directory.
These examples should give you a feel for how the pieces fit together. For deeper explanations, follow the links to the relevant sections in the docs tree.