Getting Started
Step-by-step guide to create your first BoxLang module using templates
Create your first BoxLang module in minutes using our official templates. Choose between pure BoxLang for rapid development or Java + BoxLang for full runtime integration.
Pick Your Path
1. Clone the Template
git clone https://github.com/ortus-boxlang/boxlang-module-template-bx.git my-module
cd my-module2. Customize Metadata
Edit box.json with your module details:
{
"name": "My Amazing Module",
"version": "1.0.0",
"slug": "bx-my-module",
"shortDescription": "Does amazing things",
"boxlang": {
"minimumVersion": "1.0.0",
"moduleName": "myModule"
}
}3. Configure ModuleConfig.bx
class {
property name="moduleRecord";
property name="boxRuntime";
property name="log";
this.version = "1.0.0";
this.mapping = "myModule";
this.author = "Your Name";
this.description = "My amazing module";
function configure() {
settings = {
loadedOn: now(),
loadedBy: "Your Name"
};
interceptors = [];
customInterceptionPoints = [];
}
function onLoad() {}
function onUnload() {}
}4. Add Your First BIF
Create bifs/HelloWorld.bx:
5. Test Locally
✅ Done! No build step required — your module is ready to distribute.
1. Clone the Template
2. Configure Module Metadata
Edit box.json and gradle.properties:
3. Create ModuleConfig.bx
Same as the pure BoxLang approach — place it at src/main/bx/ModuleConfig.bx:
4. Add a Java BIF
Create src/main/java/ortus/boxlang/modules/mymodule/bifs/Greet.java:
Register via ServiceLoader in src/main/resources/META-INF/services/ortus.boxlang.runtime.bifs.BIF:
5. Build & Test
Output is in build/module/ ready for distribution.
✅ Done! Your Java + BoxLang module is built and packaged.
Module Folder Structure
Available Template Injections
When writing your ModuleConfig.bx, BoxLang automatically injects these properties:
moduleRecord
ModuleRecord
The module's registration record
boxRuntime
BoxRuntime
The BoxLang runtime singleton
functionService
FunctionService
Register/query BIFs
componentService
ComponentService
Register/query components
interceptorService
InterceptorService
Register/announce interceptors
asyncService
AsyncService
Async execution and futures
schedulerService
SchedulerService
Scheduled task management
datasourceService
DatasourceService
Datasource and JDBC
cacheService
CacheService
Cache store management
log
BoxLangLogger
Module-specific logger
Next Steps
Module Descriptor — Deep dive into
box.jsonandModuleConfig.bxArchitecture — Understand module isolation and class loading
Capabilities — Explore what modules can provide
Last updated
Was this helpful?
