Presets
A preset is the app template a framework ships in its own npm package. vulcan project init --preset and vulcan package add --preset read it and create the app. A preset is data only: VULCAN never imports or runs code from it.
Two things make a package a preset. The first is a vulcan.presets.app field in its package.json, the path to preset.json:
{
"name": "@acme/api",
"version": "1.0.0",
"files": ["dist/presets"],
"vulcan": { "presets": { "app": "./dist/presets/app/preset.json" } }
}The second is that preset.json, with the files it copies next to it:
{
"presetVersion": 1,
"side": "backend",
"summary": "A small HTTP API on Bun with one route.",
"devPort": 3000,
"dependencies": { "hono": "^4.13.13" },
"devDependencies": { "@types/bun": "^1.4.1", "@venizia/dev-configs": "^0.3.4", "typescript": "^6.0.3" },
"scripts": { "server:dev": "bun run src/index.ts", "typecheck": "bun check", "test": "bun test" },
"checks": ["typecheck", "test"],
"urls": ["/api/hello"],
"imports": { "#src/*": "./src/*.js" },
"files": "./files",
"atlas": [{ "name": "acme", "repo": "acme/acme", "ref": "main" }]
}dist/presets/
app/
preset.json
files/
_env.example
tsconfig.json
.configs/lints/oxlint.config.mts
src/index.ts
src/__tests__/smoke.test.tsThe folder is yours to name; the official presets build into dist/presets/{app,lib}, and the examples here do the same.
The typecheck script is bun check (Bun 1.4.4 or later): it reports the same errors as tsc --noEmit, including decorator metadata, in a fraction of the time (83 s down to 3.2 s on a real app). Two differences matter in a script: a failing run exits with code 1, not 2, so test for != 0; and above 50 errors it groups identical ones unless you pass --all, which you want when you count errors. If the package has a script named check, bun check runs that script instead; pass --no-script to run the type checker. Keep tsc where it emits (build output, declaration files); bun check -b is documented to follow project references like tsc -b, but it was not measured here, so keep tsc -b for a build that depends on them.
The app must pass vulcan project doctor, which init runs last. Its style check wants @venizia/dev-configs declared and a lint config that imports it, so the example ships .configs/lints/oxlint.config.mts (import { defineConfig } from 'oxlint'; import { oxlintConfigs } from '@venizia/dev-configs/linters'; export default defineConfig(oxlintConfigs);) and lists @venizia/dev-configs in devDependencies. A preset without them ends init with [style] package.json: add @venizia/dev-configs as a devDependency - here, or at the root.
preset.json keys
presetVersion(number, required): The format version. This VULCAN reads1side(backendorfrontend, required): Which folder oflayoutthe app goes insummary(string, required): One sentence. It becomes the app's line in the knowledge index and its concept descriptiondevPort(positive integer, required): The default dev port.addpicks the next free one when another app holds itdependencies(object, optional): Package to range. They go in the rootcatalogand in the app ascatalog:devDependencies(object, optional): The same, for developmentpeers(object, optional): Package to range that the rootcatalogmust already satisfy whenaddruns. A catalog pin equal to the version this preset lists for that package independenciesordevDependenciesis accepted without the comparison, a prerelease includedscripts(object, optional): Thescriptsof the app'spackage.json. Use the standard seven (server:dev,compile,typecheck,lint,lint:fix,test,clean; ruleV-B-05): the rootdevscript runsserver:devin every app, andvulcan project doctornotes an app that lacks one or carriesdev,start,build,rebuild,previeworserver:prodchecks(array of script names, optional): Scripts thatinitandaddrun in the app after install, in order. Each entry must be a key ofscripts, or the preset is refusedurls(array of paths, optional): Paths to open on the dev port, each starting with/(/api/hello).initandaddend with oneopen http://localhost:<port><path>line per path. With none, they print the root. They are recorded in the app'spackage.jsonundervulcan.urls, so a lateraddprints them tooimports(object of strings, optional): Node subpath imports for the app, written to itspackage.jsonasimportsexactly as given, so code can import#src/...with notsconfigpaths,tsc-aliasor Vite alias. Every key must start with#, or the preset is refused and the message names the key. Every value is a string. The tokens are not replaced here. VULCAN 0.3.3 and older ignore the keyfiles(string, required): The folder to copy, relative topreset.json. It, and thevulcan.presets.apppath, must stay inside the package; a path that climbs out with..is refusedatlas(array of{ name, repo, ref }, optional): Documentation sources added toknowledge.atlas.sources, so agents read the framework's docs
The app's package.json is generated from these keys: name is the app name, version is 0.0.0, and the preset package itself is a dependency. A package.json in files/ is overwritten. When the preset has imports, the app's package.json carries it after private; a preset without it leaves the key out.
A library kind
A preset can also make libraries of the same framework: packages other apps import. Add a lib path next to app under presets; the file it names is a second, smaller preset. A package with no presets.lib makes no libraries.
{
"vulcan": {
"presets": {
"app": "./dist/presets/app/preset.json",
"lib": "./dist/presets/lib/preset.json"
}
}
}Both paths are any JSON file inside the package; they need not be named preset.json. A package that has presets.lib must keep its presets.app too: a lib-only package is not supported.
{
"presetVersion": 1,
"summary": "A shared library on Bun.",
"dependencies": { "zod": "^4.0.0" },
"devDependencies": { "typescript": "^6.0.3" },
"peerDependencies": { "@acme/core": "^1.0.0" },
"scripts": { "typecheck": "bun check", "lint": "eslint .", "test": "bun test" },
"checks": ["typecheck"],
"imports": { "#src/*": "./src/*.js" },
"exports": { ".": "./src/index.ts" },
"packageFields": { "type": "module", "sideEffects": false },
"files": "./files",
"atlas": []
}presetVersion:1. Same rule as the app filesummary: One line; it becomes the description of the package's knowledge page and its bullet in the indexdependencies,devDependencies,peerDependencies: Name to range. Each range joins the rootcatalogand the package'spackage.jsonsayscatalog:; a version the monorepo already pins winsscripts: Written to the package'spackage.jsonchecks: Keys ofscriptsthat run in the new package after the installimports: Subpath imports; every key starts with#exports: Written verbatimpackageFields: Onlytype,sideEffects,browserandengines. Any other key is refused: a generated key (name,version,private,exports,imports,scripts, the three dependency maps) saysis generated by vulcan - declare it in <field> instead, anything else saysis not allowed - one of: type, sideEffects, browser, enginesfiles: The folder to copy, relative to this fileatlas: Sources to add, as in the app file
The app-only keys side, devPort, urls and peers are not allowed here: the file is read strictly, and a library has no port or url.
The library files take the tokens , (the folder name, billing) and (the npm name, @acme/billing).
vulcan package add --lib generates package.json as name, version (0.0.0), private, the packageFields, exports, imports, scripts, then the three dependency maps. A library lands in the --dir folder, else the one shared folder of layout, else the one folder the existing libraries share; with none of those, or with several shared folders, add asks for --dir. Its name takes --scope, else the scope the packages already in that folder agree on, else the project's own scope, else none. See vulcan package add.
A shared kind
A preset can make a third kind: a side-neutral package that apps of either side import. The lib kind makes a library of one framework; the shared kind makes a package that depends on no framework. Add a shared path next to app and lib:
{
"vulcan": {
"presets": {
"app": "./dist/presets/app/preset.json",
"lib": "./dist/presets/lib/preset.json",
"shared": "./dist/presets/shared/preset.json"
}
}
}The shared file has the same keys as a lib preset file (the table above), read by the same schema, and its files folder is copied the same way. app stays required: a package that has only presets.shared is refused, as a lib-only package is. A package with no presets.shared makes no shared packages, and a VULCAN that predates the kind ignores the key.
The shared files take the tokens , (the folder name, common) and (the npm name, @acme/common). The token is not replaced in a shared package, and is not replaced in a library.
vulcan package add --shared generates package.json and places the package by the rules of --lib, in the same shared folder of layout; the folder never depends on the kind. The preset's package is not added as a dependency, so a project with only frontend apps can run vulcan package add --preset <name> --shared common and needs no app of that preset. The config records the preset with a shared summary and the package with presetType: "shared" (Configuration). See vulcan package add.
Tokens in files
Every text file under files/ has these tokens replaced. A file with a NUL byte or invalid UTF-8 (an image, a font) is copied byte for byte, and a script keeps its executable bit. Symbolic links are skipped, so a preset installed as links (a file: folder dependency) is refused; pass the folder with --preset file: instead:
: The project name: The app name: The app's folder from the project root, with no slash at either end:apps/web,be/api3. A Dockerfile that is built from the root uses it forCOPY: The portinitoraddchose: A frontend's proxy target,http://localhost:<port>of the backend app chosen with--api. Empty for a backend, with--no-api, and oninit
An unknown token such as stays as written.
A Dockerfile in a preset
A preset may ship .configs/builders/Dockerfile in its files/. It is built from the monorepo root, so every path in it starts from the root and names the app:
COPY {{appPath}}/package.json ./{{appPath}}/package.jsondocker build -f be/api3/.configs/builders/Dockerfile \
--build-arg APP_BUILD_COMMIT="$(git rev-parse HEAD)" \
--build-arg APP_BUILD_BRANCH="$(git rev-parse --abbrev-ref HEAD)" .The root .dockerignore that vulcan project init writes leaves out .git, so the image gets the commit and branch from the build arguments instead. It also excludes **/.env and **/.env.* (and keeps !**/.env.example): a Dockerfile that copies the project would otherwise put every app's secrets in an image layer, which a CI cache can keep.
Never copy a file with a credential into an image: an .npmrc with an auth token, a .netrc, a key. A build that installs from a private registry takes it from the environment, BUN_CONFIG_REGISTRY, handed over as a build secret (docker build --secret) and never as a copied file; a build argument is visible in the image history, so it does not carry a token either.
An app root holds only .configs/, src/, package.json, tsconfig.json and .env.example; there is no scripts/ folder and no README.md (the app's knowledge page is its documentation). Nothing in VULCAN expects either: doctor reads the scripts in package.json and never the files behind them. A frontend preset puts in its dev server proxy:
export default defineConfig({
server: { port: {{devPort}}, proxy: { '/api': '{{apiUrl}}' } },
});A backend preset needs a .env.example with a line ending in PORT=<number> (for example APP_ENV_SERVER_PORT=). add reads that line to find the next free port and to find the backend a frontend proxies to.
The dotfile names
npm drops dotfiles from a tarball. A preset ships these four names with a leading _, and the copy writes each one with a leading .:
In files/ | Written as |
|---|---|
_gitignore | .gitignore |
_npmrc | .npmrc |
_env | .env |
_env.example | .env.example |
Only these four file names are renamed, in any folder of files/. Every other name keeps its spelling, so __root.tsx, _app.tsx, _layout.tsx and _redirects are copied as they are, and folder names are never renamed. Any other dotfile (.editorconfig, for one) copies from a file: preset under its real name, but an npm package would not carry it.
presetVersion
presetVersion lets VULCAN refuse a preset it does not understand. A preset with another number stops init with a message that names both versions:
vulcan project init: @acme/api@1.0.0 has preset version 2; this VULCAN reads version 1 - upgrade @venizia/vulcanWrite the version your preset was made for, and raise it only when you use a newer format.
Test a preset
Point --preset at the package folder with file:. The path resolves against the current directory:
bun x @venizia/vulcan project init --preset file:../acme-api --project demo --backend-dir services --app core-apiWith file:, the preset package itself is written to the catalog as file:<absolute path>, so the generated app installs from your folder.
--preset takes <name> (an unscoped name is @venizia/<name>), <name>@<range>, @scope/<name> or file:<path>. init --preset creates a new project folder and refuses one that exists and is not empty; see vulcan project init. Run it without VULCAN_NO_INSTALL: a good preset ends with the checks, vulcan project doctor and okf check --strict all green.
To test the format without an install, set VULCAN_NO_INSTALL=1. The install, git init, sync and the checks then print as skipped, and the files are still written. This is what VULCAN's own tests do.
A preset that does not fit the format stops with the key and the reason:
vulcan project init: @acme/api@1.0.0: ./dist/presets/app/preset.json: side one of: backend, frontend; devPort Invalid input: expected number, received undefined