Schema Reference
Complete reference for all XML elements and attributes available in Structure Creator schemas.
Elements
<folder>
Creates a directory.
| Attribute | Required | Description |
|---|---|---|
name | Yes | Folder name (supports variables) |
<folder name="src">
<!-- child elements -->
</folder>
<file>
Creates a file with optional content.
| Attribute | Required | Description |
|---|---|---|
name | Yes | File name (supports variables) |
url | No | URL to download content from |
generate | No | Generator type: image or sqlite |
width | No | Image width in pixels (default: 100, max: 10000) |
height | No | Image height in pixels (default: 100, max: 10000) |
background | No | Image background hex color (default: #CCCCCC) |
format | No | Image format: png or jpeg (auto-detected from extension) |
<!-- Empty file -->
<file name="index.ts" />
<!-- File with inline content -->
<file name="README.md">
# Project Title
Description here.
</file>
<!-- File with content from URL -->
<file name="tsconfig.json" url="https://example.com/tsconfig.json" />
<!-- File with CDATA for special characters -->
<file name="App.tsx"><![CDATA[
export const App = () => <div>Hello</div>;
]]></file>
<!-- Generated image -->
<file name="logo.png" generate="image" width="200" height="200" background="#3B82F6" />
<!-- Generated SQLite database -->
<file name="app.db" generate="sqlite"><![CDATA[
CREATE TABLE users (id INTEGER PRIMARY KEY, email TEXT NOT NULL);
]]></file>
<if>
Conditional inclusion based on a variable's truthiness.
| Attribute | Required | Description |
|---|---|---|
var | Yes | Variable name to check |
A variable is truthy when set to: "true", "yes", "1", "on", or any non-empty string.
A variable is falsy when: empty, not set, or set to "false", "no", "0", "off".
<if var="INCLUDE_TESTS">
<folder name="tests" />
</if>
<else>
Alternative content when the preceding <if> is falsy. Must immediately follow an <if> element.
<if var="USE_TYPESCRIPT">
<file name="index.ts" />
</if>
<else>
<file name="index.js" />
</else>
<repeat>
Repeats child elements a specified number of times.
| Attribute | Required | Description |
|---|---|---|
count | Yes | Number of iterations (supports variables) |
as | No | Variable name for index (default: i) |
The index variable is 0-based. Use %i_1% for 1-based indexing.
<repeat count="3" as="n">
<file name="file-%n%.txt" /> <!-- file-0.txt, file-1.txt, file-2.txt -->
<file name="item-%n_1%.txt" /> <!-- item-1.txt, item-2.txt, item-3.txt -->
</repeat>
<variables>
Container for variable definitions. Provides metadata like descriptions, placeholders, and validation rules for variables.
<variables>
<variable name="CLIENT_NAME"
description="The client's company name"
placeholder="Enter client name"
example="Acme Corp"
required="true" />
</variables>
<variable>
Defines metadata for a variable. Must be inside <variables>.
| Attribute | Required | Description |
|---|---|---|
name | Yes | Variable name without % delimiters |
description | No | Help text shown below the input |
placeholder | No | Placeholder text for empty inputs |
example | No | Example value shown as "Example: value" |
required | No | Whether variable is required (true/false) |
pattern | No | Regex pattern for validation |
minLength | No | Minimum character length |
maxLength | No | Maximum character length |
<variables>
<variable name="PROJECT_TYPE"
description="Type of project"
placeholder="Enter project type"
example="website"
pattern="^[a-z-]+$"
minLength="3"
maxLength="30" />
</variables>
See Variables & Transforms for more details.
<hooks>
Container for lifecycle hooks.
<hooks>
<post-create>npm install</post-create>
</hooks>
<post-create>
Command to run after structure creation. Must be inside <hooks>. Multiple commands run in order.
<hooks>
<post-create>git init</post-create>
<post-create>npm install</post-create>
</hooks>
Variables
Variables use the %NAME% syntax and are substituted at creation time.
<folder name="%PROJECT_NAME%">
<file name="%COMPONENT%Component.tsx" />
</folder>
Built-in Variables
These variables are always available:
| Variable | Description |
|---|---|
%PROJECT_NAME% | Project name from the UI |
%DATE% | Current date (YYYY-MM-DD) |
%YEAR% | Current year |
%MONTH% | Current month (01-12) |
%DAY% | Current day (01-31) |
See Variables & Transforms for details on transforms, date formatting, and validation.
Complete Example
<structure>
<variables>
<variable name="NUM_COMPONENTS"
description="Number of components to generate"
placeholder="Enter a number"
example="3"
required="true"
pattern="^\d+$" />
<variable name="INCLUDE_STYLES"
description="Include CSS files for each component"
example="true" />
</variables>
<folder name="%PROJECT_NAME%">
<folder name="src">
<folder name="components">
<repeat count="%NUM_COMPONENTS%" as="i">
<folder name="Component%i_1%">
<file name="index.tsx" />
<if var="INCLUDE_STYLES">
<file name="styles.css" />
</if>
</folder>
</repeat>
</folder>
<file name="main.tsx" />
</folder>
<file name="package.json">
{
"name": "%PROJECT_NAME:kebab-case%",
"version": "1.0.0"
}
</file>
<hooks>
<post-create>npm install</post-create>
</hooks>
</folder>
</structure>