PagesBuilding extensions · 33 / 37
New in v1.4.0
Building your own extension
New in QuantCraft v1.4.0. This page describes functionality that ships with v1.4.0, the next major release. The current release is v1.3.0, which does not include it yet.
You can make an extension for yourself or to share, from the QuantCraft IDE, with no setup beyond turning on Developer mode. You write plain JavaScript (and HTML/CSS) in a project folder, run it live, and pack it into a single .qcext file.
New to extensions? Read Extensions first. Ready-made code is in Extension examples; every setting, permission and function is in Extension API.
What you can build
| Kind | What it is | Needs |
|---|---|---|
| Panel | A sidebar icon that opens a window of your own, plus an optional footer status | nothing (add permissions for the data you read) |
| Data provider | Supplies price bars, live trades, symbols or prices from your vendor. Starts with a mock so it works before you write vendor code | data.provide and the vendor's domain |
| Fundamentals provider | Supplies company fundamentals for charts, runs and the Screener | data.provide and the vendor's domain |
| Broker | Places orders through your brokerage (see Broker extensions). Starts with a mock broker | data.provide + place orders |
| AI tools | Tools the AI assistant can call | ai.tools |
| WebAssembly engine | A sandboxed .wasm module behind an AI tool or provider | run its own program |
| Python engine | A Python program (with pure-Python packages) behind a tool or provider | run its own program |
| Native engine | Your own program, one build per operating system | run its own program, and Verified or Developer mode |
| Theme | Colours only, no code | nothing |
| npm packages | Add-on for the others: use npm packages and split your code into modules | a build step |
1. Turn on Developer mode
Extensions → Developer → Developer mode. It lets you load an extension straight from a folder. Loaded folders run unverified, which is why it is a switch you turn on yourself.
2. Create a project
In the IDE, open the Files sidebar and choose New extension project.
- Give it a Name; the id is made from your publisher name and the name (
publisher.name, lowercase). The id is fixed once you publish, so choose it with care. - Under Parts, tick one or more kinds. They share one manifest. Advanced holds the broker, engines and npm packages.
- Create project. The wizard lists the files it will create and the permissions it asks for.
Open the project folder in the IDE. Its manifest is qcext.json. The Manifest button in the project bar opens a form that edits it for you.
A minimal manifest (qcext.json) for a panel that reads price bars. The wizard writes one like this for you, and the Manifest button edits it:
{
"id": "acme.lastclose",
"version": "0.1.0",
"apiVersion": 1,
"name": "Last close",
"description": "Latest close and 30-day change for a symbol.",
"permissions": ["data.ohlcv"],
"contributes": {
"sidebar": { "title": "Last close", "icon": "ui/icon.svg", "entry": "ui/index.html" }
}
}The complete project, with its page and script, is in Extension examples.
3. The project bar
When the IDE's workspace is an extension project, a bar appears above the editor.
| Button | What it does |
|---|---|
| Validate | Checks the manifest, every file it points at, JavaScript/JSON/HTML/CSS syntax, relative imports and permission use. Problems are listed as file:line |
| Run / Stop | Loads the folder as a developer extension and opens it. Run is off while the manifest has errors |
| Reload | Reload now (it also reloads by itself when you save) |
| Window | Opens the extension in a separate preview window ("Live · reloads on save") instead of the in-app modal |
| Manifest | A form for qcext.json |
| Mock | For data providers: fetch sample bars and watch live ticks, set latency, failures, bad data and silence, and see exactly what QuantCraft accepted or dropped and why |
| Build | Checks, packs and signs your project into a .qcext |
| Debug | Live calls, provider traffic, data sources and storage (see below) |
| Logs | Everything the extension reported |
| DevTools | Opens the browser developer tools. Only in builds that include them |
The status chip shows Running, Reloaded N s ago, Reloading…, Stopped or Error · N problem.
Hot reload: while a project runs, saving a file reloads it in about a second. A syntax error or bad manifest pauses the reload and keeps the last working version on screen; fix it and it reloads. A reload that would add a new permission is refused until you load the folder again and approve it.
4. Write it
Every page and script loads the QuantCraft SDK and waits for it:
<script type="module" src="/_sdk/qc.js"></script>
<script type="module" src="app.js"></script>const qc = await window.qc.ready; // then use qc.* (see the Extension API page)Rules every extension follows:
- No inline scripts, no
eval. Put code in.jsfiles. Styles go in a.cssfile (or an inline<style>). - Network: only to the HTTPS hosts you declare as
net:<host>permissions (a hostname such asapi.example.com, no scheme or port, at most 20). Declare them in the manifest, and the user sees them when installing. - Secrets: declare a setting of type
secret(and thesecretspermission) and read it withqc.secrets.get. The user types the key in the extension's Settings; never ask for it in your own page. - Use as few permissions as you can. An update that adds one makes every user approve again.
- Paths are relative, with
/, and never... - Colours: use the
--qc-*CSS variables so your page follows light, dark and the user's theme.
5. Add npm packages (optional)
Tick npm packages in the wizard (or add it later). Your code lives in src/; Build (and Run / Reload) bundles it into the files the manifest loads, and package.json and src/ are left out of the package. The first time, QuantCraft asks you to allow the project's build script (Run this project's build script?). Dependencies are installed with scripts disabled. Use only packages that run in a browser.
6. Build and share
Press Build. It runs these steps and shows each result: Check the manifest → Check syntax → Check permission use → Install dependencies / Build (compile) when needed → Pack the files → Sign. The result is dist/<id>-<version>.qcext.
- Raise
versioninqcext.json(semver) before building a new release. - The package is signed with a key on your computer. That makes it Self-signed, which is not the same as Verified: other people will see it as unverified.
- Install this build installs the package on your machine to test it as a user would.
- To share it, send the
.qcextfile. People install it with Install extension → From file (or From URL / GitHub). Verified status and the Browse catalog are managed by QuantCraft.
Limits: a package may hold up to 2000 files, 20 MB per file and 100 MB in total.
Testing a data provider with Mock
Start from the Data provider or Fundamentals provider part: it ships with a mock source and a switch (USE_MOCK) at the top of the provider file. Leave it true to try the whole flow, then set it to false and fill in the vendor calls.
In Mock: Fetch bars, Watch live ticks, then use Latency, Failure rate, Bad bars, Future bars, Bad ticks and Go quiet after to see how your extension and QuantCraft behave when the vendor misbehaves. The panel lists what was accepted, dropped and why.
Debugging
| Tool | What it gives you |
|---|---|
| Logs | Levels, sources and a filter. Errors show the file and line, and a stack. In a bundled project (npm packages) the position is mapped back to your src/ file, and clicking it opens the file at that line |
| Debug → Calls | Every call between your extension and QuantCraft in both directions: the method, the result (or error code such as permission_denied, timeout, rate_limited), how long it took, the size, and a short summary of the arguments. Anything that looks like a key or password is hidden, and results are not recorded |
| Debug → Providers | For each provider call: count, errors, average and maximum time |
| Debug → Data sources | For the open chart: which source serves bars, ticks, symbols, prices and fundamentals, and why (your chip, your footer choice, a source that is off or removed, or a failure this session) |
| Debug → Storage and secrets | The names and size of what your extension stores, and which secret settings are set. Never the values |
| DevTools | Breakpoints and stepping in the browser developer tools: open your file under Sources and set a breakpoint, or write debugger; in your code. Available in builds that include the tools |
Only your own Developer projects are traced.
Common problems:
| You see | Likely cause |
|---|---|
permission_denied | The permission is missing from qcext.json (add it), or the user turned it off |
| "Extension failed to load" | The page threw before it started, or a file it points at is missing. Read Logs |
| A blank panel | await window.qc.ready is missing, or an inline script was blocked |
| A request to your vendor is blocked | Add its hostname as a net: permission |
| "Run is off" | The manifest has errors: Validate lists them |
| A data source is skipped | See Debug → Data sources for the reason |
Command line: qc-ext
If you prefer working outside the IDE, the SDK package includes a qc-ext command:
| Command | What it does |
|---|---|
qc-ext init <dir> --template <parts> --id publisher.name --name "Name" | Creates a project (the same parts as the wizard; combine with commas) |
qc-ext validate [dir] | The same check as Validate; non-zero exit on errors |
qc-ext dev [dir] | Re-validates on every change (load the folder in the app with Developer mode to run it) |
qc-ext pack [dir] | Validates and writes dist/<id>-<version>.qcext; add --build to run the build first |
Let the AI assistant do it
The QuantCraft AI chat can write an extension for you. Open the project as the IDE workspace, use Agent mode, and describe what you want ("a data provider for my vendor's REST API", "a panel that lists today's movers").
- It reads the right guide and starts from the same files as New extension project.
- After every batch of edits QuantCraft checks the whole project and tells the assistant the exact
file:lineproblems, so it fixes them without being asked. - In Agent mode it can run the project, build it (only if you already allowed the build script), pack it, and read the extension's logs and calls to find out why something fails.
- It will ask you to do the things that are yours: turn on Developer mode, allow a build script, install dependencies, replace an installed extension with the same id. It never signs, installs a package or publishes for you.
Review what it writes, especially the permissions it asks for.

