07 — App-Templates Approach¶
Purpose¶
Specify how app templates (qcobjects-new-app, CLI templates/pwa|apps)
deliver the out-of-box experience — with the complete template contract.
Sources: qcobjects-new-app README + CONFIG.md + scripts (v2.4.40-ts).
Definitions below are authoritative.
Scope¶
Template repos and the CLI scaffolding that stamps them out. PWA runtime semantics: 06-app-structure; widgets: 04-sdk.
Template contract (normative)¶
- Templates MUST be runnable immediately after
npm install:npm start(cert + serve) with no extra configuration. - Templates MUST demonstrate, at minimum: boot (
init), one data-bound component, one backend route call, offline shell (service worker), and one form with validation. - Template
config.jsonMUST use$ENV(...)for every secret/host and$config(...)for derived paths; a committed.env.exampleSHOULD document each variable (the canonical template does not ship one — add it per app). - CLI
src/templates/pwais the minimal shell;src/templates/appsare fuller starters. Both MUST track the 06-app-structure layout; any layout change MUST update templates in the same release. - Templates MUST pin
qcobjects+qcobjects-sdkto a tested minor range and MUST be re-verified (install + serve + build) on every core/SDK minor bump. qcobjects-new-appdoubles as the integration testbed: demo routes underdemo-tests/MAY exist there but MUST NOT leak intosrc/templates.- CSS theme matrix ships with every template:
css/theme/{basic,cyan,redlight,xtra}+desktop/+mobile/variants; new themes MUST follow the same directory shape. - Template hero/pages components (
templates/components/{hero,pages}) MUST keepname↔*.tpl.htmlfile correspondence (tplextension: tpl.html).
Template catalogue (normative)¶
| Template (npm) | create flag |
Source | Purpose | Status |
|---|---|---|---|---|
qcobjectsnewapp (v2.4.40-ts) |
--pwa / default |
QuickCorp/qcobjects-new-app (public) |
Reference PWA starter + integration testbed (demo-tests/) |
stable, canonical |
qcobjects-ecommerce-amp (v0.0.7) |
--amp |
private GitLab | AMP storefront starter | stable |
qcobjectsnewphp (v1.0.35) |
--php |
private GitLab | PHP-backend PWA starter | stable |
CLI src/templates/pwa + src/templates/apps |
built-in | qcobjects-cli repo |
Minimal embedded assets (sw.js for generate-sw, spa-local.*, cert helpers) — NOT a create fallback (create always npm is the template package) |
stable |
create-qcobjects (v2.0.13) |
npx initializer |
QCObjects/create-qcobjects (private) |
Standalone creation tool | stable |
| any npm package | --custom <name> |
author-provided | Custom layouts per 05-cli § Custom templates | stable mechanism |
QCObjects-App-Templates/* boilerplates |
--custom <name> |
QCObjects-App-Templates org (public): qcobjects-swipper-template (swiper/slider showcase), qcobjects-boilerplate-{pwa,tailwind,tabs-spa,dashboard,hello-world}-template (all v1.0.0) |
Minimal starters by concern | stable, convention-compliant |
- New official templates MUST enter this table (flag, source, purpose, status) in their release PR and MUST satisfy the Template contract above.
- Private-source templates MUST still publish versioned npm tarballs so
createworks without repo access; their sources MAY stay private. --customnames MUST use the-templatesuffix convention (qcobjects-<name>-template, kind infixes preserved:qcobjects-handler-<name>-template, etc. — see 05-cli). TheQCObjects-App-Templates/*boilerplates were renamed into compliance (bare names →-templatesuffix); GitHub redirects preserve old URLs.- The npm package
nameSHOULD match the repo name. Counter-example on record: repojeanmachuca-labs/qcobjects-jobs-templatepublishes packageqcobjects-jobs(no keywords) — install-by-name still works, but discovery and--customauditing assume name parity, so keep them identical.
CSS framework interoperability (normative)¶
The framework is CSS-agnostic: it ships plain CSS (SDK src/css, template
css/ matrix) and composes with any CSS system at two layers.
- Light DOM (page shell, non-shadowed components): any global stylesheet
works unchanged — link Foundation, Bootstrap, Tailwind builds, or hand CSS in
index.htmlas usual (reference demos exist for Foundation, Materialize, and raw CSS). - Shadow DOM (shadowed components): page CSS cannot cross the boundary —
each shadowed template MUST carry its own
<style>importing what it needs (<style>@import url("css/components/….css")</style>); chained imports (e.g. a component CSS importing a compiled Tailwind build) resolve inside the shadow root (see 03-core-framework § Component authoring rules). - Preprocessors (SCSS/Sass, Tailwind, PostCSS): build-time concerns owned by
the app, NOT the framework — no framework package depends on them. Apps MAY
compile
scss/ → css/and Tailwind sources intosrc/cssbefore the standard build (reference:qcobjects-web-2025runssass+tailwindcssahead ofbuild:assets); compiled output MUST land in the served CSS tree, never source.scssfiles. - Theme matrix: every template ships
css/theme/{basic,cyan,redlight,xtra} desktop/+mobile/variants andcss/components/per-component styles; production apps MAY add themes (observed:neumorphismin the store app,job-detailin the jobs template); new themes MUST follow the same directory shape. Switching themes MUST be a CSS swap only — no component or template changes.- Auth-flow CSS kit: multi-step auth UIs SHOULD group their styles as one
kit dir (reference:
css/theme/webflow-ui-kit/withsignup,forgot-password,reset-password,email-confirmation,third-partystylesheets) rather than scattering per-page CSS — the kit travels with the auth templates as a unit.
Configuration precedence (normative, from template README + CONFIG.md)¶
- Open
config.json. (The template also ships an identicalconfig.yaml, but the CLI runtime parses ONLYconfig.json— YAML is inert until a YAML loader lands. Do not rely on YAML-wins.) - Field meanings per
CONFIG.md(migrated in full to 12-schemas): General (devmode: info|debug|warn|error;autodiscover[_libs|_commands|_handlers];domain(default$ENV(DOMAIN,localhost));certificate_provider(default$ENV(CERTIFICATE_PROVIDER,self_signed));useTemplate(SSR gate, default false);documentRoote.g."$config(projectPath)public/";documentRootFileIndex;cacheControl;relativeImportPath;serverPortHTTP/HTTPS;useLocalSDK;useLegacyHTTP;private-key-pem/private-cert-peme.g."$config(domain)-privkey.pem";enableShellCommands), Backend (db_engine{name,databaseName},auth{enabled,defaultUser,defaultPasswd, microsoftapikey,googleapikey},routes[]{name,description,path,microservice, redirect_to,responseHeaders,cors.allow_origins}), Package (package{source{backend,frontend},build,dist}).
Verification¶
- CI stamps each template into a temp dir, runs install + serve smoke test + build, and all three succeed.
npm auditon a freshly stamped template shows zero critical vulnerabilities.schemas/examples/app-config.json(derived from the template config) validates.