Skip to content

Tags Reference (q:) ​

Complete reference for all q: namespace tags in the Quantum Framework. These are the core tags for logic, data, and component definition.

Core Tags ​

q:component ​

Defines a reusable Quantum component. Components are the building blocks of Quantum applications.

xml
<q:component name="UserProfile" type="pure">
  <q:param name="userId" type="integer" required="true" />
  <!-- Component content -->
</q:component>
AttributeTypeDefaultDescription
namestringrequiredComponent name (PascalCase recommended)
typeenumpureComponent type: pure, microservice, event-driven, worker, websocket, graphql, grpc, serverless
portinteger-Port number for microservice components
basePathstring-Base URL path for REST endpoints
healthstring-Health check endpoint path
metricsstring-Metrics provider (prometheus, datadog)
tracestring-Tracing provider (jaeger, zipkin)
require_authbooleanfalseRequire authentication
require_rolestring-Required role(s) (comma-separated)
require_permissionstring-Required permission(s)
interactivebooleanfalseEnable client-side hydration

See also: q:application, q:function, q:param


q:application ​

Defines a Quantum application of one of the non-web engines. A web app is not a q:application: it is pages in components/, served by quantum start (APP-1).

xml
<q:application id="myGame" type="game" engine="2d">
</q:application>
AttributeTypeDefaultDescription
idstringrequiredUnique application identifier
typeenumrequiredApplication type: game (Laboratory), terminal, ui (Experimental)
enginestring-Engine variant (e.g., '2d' for game type)
themestring-Theme preset for UI applications

See also: q:component, q:route


q:set ​

Declares or modifies a variable with type safety and validation.

xml
<!-- Basic assignment -->
<q:set name="counter" type="integer" value="0" />

<!-- With validation -->
<q:set name="email" type="string" validate="email" required="true" />

<!-- Operations -->
<q:set name="counter" operation="increment" />
AttributeTypeDefaultDescription
namestringrequiredVariable name
valueexpression-Value to assign (supports databinding)
typeenumstringData type: string, integer, decimal, boolean, array, struct, date, datetime
defaultany-Default value if not set
scopeenumlocalVariable scope: local, component, session, application, request
operationenumassignOperation: assign, increment, decrement, add, remove, append, prepend, toggle, clear
requiredbooleanfalseWhether the variable is required
validatestring-Validation rule (email, url, cpf, etc.)
patternregex-Regex pattern for validation
minnumber-Minimum value
maxnumber-Maximum value
minlengthinteger-Minimum string length
maxlengthinteger-Maximum string length
enumstring-Allowed values (comma-separated)

See also: q:param, q:loop, State Management


Control Flow ​

q:if ​

Conditional execution with optional elseif and else branches.

xml
<q:if condition="{user.isAdmin}">
  <p>Admin content</p>
<q:elseif condition="{user.isModerator}">
  <p>Moderator content</p>
<q:else>
  <p>Regular user content</p>
</q:else>
</q:if>
AttributeTypeDefaultDescription
conditionexpressionrequiredBoolean expression to evaluate

Children: q:elseif, q:else, q:set, q:loop, q:query, q:return


q:elseif ​

Else-if branch within a q:if block.

xml
<q:elseif condition="{age >= 13}">
  <p>Teen content</p>
</q:elseif>
AttributeTypeDefaultDescription
conditionexpressionrequiredBoolean expression to evaluate

Parent: q:if


q:else ​

Else branch within a q:if block. Executed when all conditions are false.

xml
<q:else>
  <p>Default content</p>
</q:else>

Parent: q:if


q:loop ​

Iterates over ranges, arrays, lists, or query results.

xml
<!-- Range loop -->
<q:loop var="i" type="range" from="1" to="10">
  <p>Item {i}</p>
</q:loop>

<!-- Array loop -->
<q:loop var="user" type="array" items="{users}" index="idx">
  <p>{idx}: {user.name}</p>
</q:loop>

<!-- Query loop -->
<q:loop query="users">
  <tr><td>{users.name}</td></tr>
</q:loop>
AttributeTypeDefaultDescription
varstringrequiredLoop variable name
typeenumrangeIteration type: range, array, list, query, object
frominteger-Start value for range loops
tointeger-End value for range loops
stepinteger1Step value for range loops
itemsexpression-Array or list to iterate
querystring-Query result to iterate
indexstring-Variable name for current index
delimiterstring,Delimiter for list loops

See also: q:if, q:query


Functions ​

q:function ​

Defines a function within a component. Can be exposed as REST endpoint.

xml
<q:function name="greet" returnType="string">
  <q:param name="name" type="string" />
  <q:return value="Hello, {name}!" />
</q:function>

<!-- REST endpoint -->
<q:function name="getUsers" endpoint="/users" method="GET" roles="admin">
  <q:query name="users" datasource="db">SELECT * FROM users</q:query>
  <q:return value="{users}" />
</q:function>
AttributeTypeDefaultDescription
namestringrequiredFunction name
returnTypeenumanyReturn type: any, void, string, integer, decimal, boolean, array, struct, query
scopeenumcomponentVisibility: component, public, private
accessenumpublicAccess modifier: public, private, protected
descriptionstring-Function documentation
cacheboolean-Cache function results
memoizebooleanfalseMemoize function calls
purebooleanfalseMark as pure function (no side effects)
asyncbooleanfalseAsync function execution
timeoutstring-Execution timeout (e.g., '30s')
retryinteger-Number of retries on failure
endpointstring-REST endpoint path
methodenum-HTTP method: GET, POST, PUT, DELETE, PATCH
producesstringapplication/jsonResponse content type
consumesstringapplication/jsonRequest content type
authstring-Authentication requirement
rolesstring-Required roles (comma-separated)
rateLimitstring-Rate limit (e.g., '100/minute')
corsboolean-Enable CORS

Children: q:param, q:return, q:set, q:if, q:loop, q:query


q:param ​

Declares a parameter for components, functions, queries, or actions.

xml
<q:param name="userId" type="integer" required="true" />
<q:param name="status" type="string" enum="active,inactive" default="active" />
<q:param name="avatar" type="binary" accept="image/*" maxsize="5MB" />
AttributeTypeDefaultDescription
namestringrequiredParameter name
typeenumstringData type: string, integer, decimal, boolean, array, struct, date, datetime, binary, email, url
requiredbooleanfalseWhether required
defaultany-Default value
valueexpression-Value expression (for query params)
descriptionstring-Documentation
sourceenumautoParameter source: auto, path, query, body, header, cookie
validatestring-Validation rule
patternregex-Regex pattern
minnumber-Minimum value
maxnumber-Maximum value
minlengthinteger-Minimum length
maxlengthinteger-Maximum length
enumstring-Allowed values (comma-separated)
acceptstring-Accepted file types for binary
maxsizestring-Maximum file size

q:return ​

Returns a value from a function or route.

xml
<q:return value="{result}" />
<q:return value="Success" type="string" />
AttributeTypeDefaultDescription
valueexpressionrequiredValue to return
typeenumstringReturn type: string, integer, decimal, boolean, array, struct, query, json
namestring-Named return for multiple values

Data ​

q:query ​

Executes a database query with automatic parameter binding.

xml
<q:query name="users" datasource="db">
  SELECT * FROM users WHERE active = true
</q:query>

<q:query name="user" datasource="db" cache="true" ttl="300">
  SELECT * FROM users WHERE id = :userId
  <q:param name="userId" value="{userId}" type="integer" />
</q:query>

<!-- Paginated query -->
<q:query name="products" datasource="db" paginate="true" pageSize="20">
  SELECT * FROM products ORDER BY name
</q:query>
AttributeTypeDefaultDescription
namestringrequiredQuery result variable name
datasourcestring-Database connection name
sourcestring-Source query for Query-of-Queries
cachebooleanfalseCache query results
ttlinteger-Cache TTL in seconds
reactivebooleanfalseEnable reactive updates
intervalinteger-Polling interval in ms
paginatebooleanfalseEnable automatic pagination
pageinteger1Current page number
pageSizeinteger20Items per page
timeoutinteger-Query timeout in ms
maxrowsinteger-Maximum rows to return
resultstring-Variable for query metadata
modeenum-Query mode (rag for RAG pipeline)
modelstring-LLM model for RAG queries

Children: q:param


q:invoke ​

Invokes a function, component method, or external HTTP endpoint.

xml
<!-- Call a function -->
<q:invoke name="result" function="calculateTotal" />

<!-- Call external API -->
<q:invoke name="data" url="https://api.example.com/users" method="GET">
  <q:header name="Authorization" value="Bearer {token}" />
</q:invoke>

<!-- Call a microservice -->
<q:invoke name="response" service="user-service" endpoint="/users/{id}" method="GET" />
AttributeTypeDefaultDescription
namestringrequiredResult variable name
functionstring-Function name to call
componentstring-Component containing the function
urlurl-External URL to call
endpointstring-REST endpoint path
servicestring-Service name for discovery
methodenumGETHTTP method: GET, POST, PUT, DELETE, PATCH
contentTypestringapplication/jsonRequest content type
authTypeenum-Auth type: none, basic, bearer, api-key
authTokenstring-Auth token value
timeoutinteger-Request timeout in ms
retryinteger-Retry count
retryDelayinteger-Delay between retries in ms
responseFormatenumautoResponse format: auto, json, xml, text, binary
cachebooleanfalseCache response
ttlinteger-Cache TTL in seconds

Children: q:header, q:param, q:body


q:data ​

Imports and transforms data from external sources.

xml
<q:data name="products" source="./data/products.csv" type="csv" />

<q:data name="config" source="./config.json" type="json" cache="true" ttl="3600" />

<q:data name="feed" source="https://api.example.com/feed.xml" type="xml" xpath="//item" />
AttributeTypeDefaultDescription
namestringrequiredResult variable name
sourceurlrequiredData source URL or path
typeenumcsvData format: csv, xml, json, excel
cachebooleantrueCache imported data
ttlinteger-Cache TTL in seconds
delimiterstring,CSV delimiter
headerbooleantrueCSV has header row
encodingstringutf-8File encoding
xpathstring-XPath for XML extraction

q:transaction ​

Wraps queries in a database transaction for atomic operations.

xml
<q:transaction>
  <q:query datasource="db">
    UPDATE accounts SET balance = balance - :amount WHERE id = :from
    <q:param name="from" value="{fromAccount}" />
    <q:param name="amount" value="{amount}" />
  </q:query>
  <q:query datasource="db">
    UPDATE accounts SET balance = balance + :amount WHERE id = :to
    <q:param name="to" value="{toAccount}" />
    <q:param name="amount" value="{amount}" />
  </q:query>
</q:transaction>
AttributeTypeDefaultDescription
isolationLevelenumREAD_COMMITTEDIsolation: READ_UNCOMMITTED, READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE

Children: q:query, q:set, q:if


Components ​

q:import ​

Imports a component for use within the current component.

xml
<q:import component="Header" />
<q:import component="Button" from="./components/ui" />
<q:import component="AdminLayout" as="Layout" />
AttributeTypeDefaultDescription
componentstringrequiredComponent name to import
frompath-Path to component file
asstring-Alias name

q:slot ​

Defines a content projection slot for component composition.

xml
<!-- Default slot -->
<q:slot />

<!-- Named slot -->
<q:slot name="header" />

<!-- Slot with default content -->
<q:slot name="footer">
  <p>Default footer content</p>
</q:slot>
AttributeTypeDefaultDescription
namestringdefaultSlot name

Actions & Forms ​

q:action ​

Defines a form action handler with validated parameters. Protect it by protecting the page (require_auth / require_role on q:component), which covers its actions too.

xml
<q:action name="createUser" method="POST">
  <q:param name="email" type="email" required="true" />
  <q:param name="password" type="string" required="true" minlength="8" />

  <q:query datasource="db">
    INSERT INTO users (email, password_hash)
    VALUES (:email, :passwordHash)
    <q:param name="email" value="{email}" />
    <q:param name="passwordHash" value="{hashPassword(password)}" />
  </q:query>

  <q:redirect url="/users" flash="User created!" />
</q:action>
AttributeTypeDefaultDescription
namestringrequiredAction name
methodenumPOSTHTTP method: POST, PUT, DELETE, PATCH

Children: q:param, q:query, q:set, q:redirect, q:flash


q:redirect ​

Redirects to another URL, optionally with a flash message.

xml
<q:redirect url="/thank-you" />
<q:redirect url="/products" flash="Product created!" status="303" />
AttributeTypeDefaultDescription
urlurlrequiredTarget URL
flashstring-Flash message to display
statusinteger302HTTP status code (301, 302, 303, 307, 308)

q:flash ​

Sets a flash message to be displayed once after redirect.

xml
<q:flash type="success" message="Operation completed!" />
<q:flash type="error">An error occurred</q:flash>
AttributeTypeDefaultDescription
typeenuminfoMessage type: info, success, warning, error
messagestring-Message text (or use tag content)

LLM Integration ​

q:llm ​

Invokes an LLM (Large Language Model) via Ollama or compatible API.

xml
<q:llm name="response" model="phi3">
  <q:prompt>Summarize this text: {text}</q:prompt>
</q:llm>

<q:llm name="chat" model="mistral" responseFormat="json">
  <q:message role="system">You are a helpful assistant</q:message>
  <q:message role="user">{question}</q:message>
</q:llm>
AttributeTypeDefaultDescription
namestringrequiredResult variable name
modelstring-Model name (phi3, mistral, llama3)
endpointurl-Custom API endpoint
systemstring-System prompt
responseFormatenum-Response format: text, json
temperaturedecimal-Temperature (0.0-2.0)
maxTokensinteger-Max tokens in response
timeoutinteger30Request timeout in seconds
cachebooleanfalseCache LLM responses

Children: q:prompt, q:message


q:prompt ​

Defines the prompt text for an LLM invocation.

xml
<q:prompt>Translate to French: {text}</q:prompt>

Parent: q:llm


q:message ​

Defines a chat message for LLM conversation mode.

xml
<q:message role="system">You are a helpful assistant</q:message>
<q:message role="user">{userQuestion}</q:message>
AttributeTypeDefaultDescription
roleenumuserMessage role: system, user, assistant

Parent: q:llm


q:knowledge ​

Defines a knowledge base for RAG (Retrieval Augmented Generation).

xml
<q:knowledge name="docs">
  <q:source type="file" path="./docs/" />
  <q:source type="url" url="https://docs.example.com" />
</q:knowledge>
AttributeTypeDefaultDescription
namestringrequiredKnowledge base name
modelstring-Embedding model
chunkSizeinteger500Text chunk size
chunkOverlapinteger50Overlap between chunks

Children: q:source


Utilities ​

q:mail ​

Sends an email (ColdFusion cfmail-inspired).

xml
<q:mail to="{user.email}" from="noreply@app.com" subject="Welcome!">
  <h1>Welcome, {user.name}!</h1>
  <p>Thank you for signing up.</p>
</q:mail>
AttributeTypeDefaultDescription
tostringrequiredRecipient email address(es)
subjectstringrequiredEmail subject
fromstring-Sender email address
ccstring-CC recipients
bccstring-BCC recipients
replyTostring-Reply-To address
typeenumhtmlContent type: html, text
charsetstringUTF-8Character encoding

q:file ​

Handles file operations (upload, delete, move, copy).

xml
<q:file action="upload" file="{avatar}" destination="./uploads/avatars/" />
<q:file action="delete" file="{filePath}" />
<q:file action="move" file="{source}" destination="{target}" nameConflict="makeUnique" />
AttributeTypeDefaultDescription
actionenumuploadOperation: upload, delete, move, copy
filestringrequiredFile variable or path
destinationpath./uploads/Destination path
nameConflictenumerrorConflict handling: error, overwrite, skip, makeUnique
resultstring-Variable to store result

q:log ​

Logs a message for debugging or monitoring.

xml
<q:log message="Processing user {userId}" level="debug" />
<q:log var="userData" level="info" />
AttributeTypeDefaultDescription
messageexpression-Log message (supports databinding)
levelenuminfoLog level: debug, info, warn, error
varstring-Variable to dump

q:dump ​

Dumps a variable's contents for debugging.

xml
<q:dump var="users" />
<q:dump var="config" label="Configuration" format="json" />
AttributeTypeDefaultDescription
varstringrequiredVariable to dump
labelstring-Label for the output
formatenumautoOutput format: auto, json, table, tree

Events ​

q:onEvent ​

Subscribes to and handles events.

xml
<q:onEvent event="user.created" maxRetries="3" retryDelay="30s">
  <q:mail to="{event.data.email}" subject="Welcome!">
    Welcome to our platform!
  </q:mail>
</q:onEvent>
AttributeTypeDefaultDescription
eventstringrequiredEvent pattern (supports wildcards)
queuestring-Queue name for message broker
maxRetriesinteger0Maximum retry attempts
retryDelaystring-Delay between retries (e.g., '30s')
deadLetterstring-Dead letter queue name
filterexpression-Filter expression
concurrentinteger1Concurrent handler count
timeoutstring-Handler timeout

Children: q:set, q:if, q:query, q:invoke


q:dispatchEvent ​

Publishes an event to the event bus.

xml
<q:dispatchEvent event="user.created" data="{userData}" />
<q:dispatchEvent event="order.placed" data="{order}" priority="high" delay="5s" />
AttributeTypeDefaultDescription
eventstringrequiredEvent name
dataexpression-Event payload
queuestring-Target queue
exchangestring-Exchange name
routingKeystring-Routing key
priorityenumnormalPriority: low, normal, high
delaystring-Delay before delivery (e.g., '5s')
ttlstring-Time-to-live (e.g., '60s')

q:route ​

Defines a route in an application.

xml
<q:route path="/" method="GET" />
<q:route path="/users/:id" method="GET" />
AttributeTypeDefaultDescription
pathstringrequiredURL path pattern
methodenumGETHTTP method: GET, POST, PUT, DELETE, PATCH

Parent: q:application


q:script ​

Embeds custom script code within a component.

xml
<q:script>
  // Custom JavaScript or Python code
  function customHelper(value) {
    return value.toUpperCase();
  }
</q:script>

Quantum Framework - Simplicity over configuration