A starter template for building modern web projects with the JSDA-Stack.
JSDA (JavaScript Distributed Assets) is a development philosophy and a set of solutions designed to leverage modern web standards. It treats standard JavaScript ESM modules as highly dynamic, text-based web asset generation endpoints (e.g., HTML, CSS, SVG, MD, JSON).
It feels as intuitive as PHP (evaluating scripts to generate text), but overcomes the limitations of PHP architectures by being inherently universal and format-agnostic:
- Language as Template (No Additional Engines): JSDA uses native JavaScript template literals. You retain the full programmatic power of JS (loops, conditionals, map/filter) without the overhead of learning or compiling an intermediate templating language.
- Universal Multi-Format Generation: JSDA applies the exact same unified mental model to dynamically build and serve any text-based file: CSS modules, SVG graphics, JSON payloads, or RSS feeds - automatically resolving proper MIME types via the
.[ext].jsfile pattern. - Isomorphic (Universal) Codebase: PHP runs strictly on the server, forcing a language divide between backend rendering and frontend interactivity. With JSDA, you can share the exact same utility functions, state logic, and UI components seamlessly across both the Node.js server and the browser.
- Native Async & Data Fetching: JSDA generation modules inherently support Promises and non-blocking I/O. You can use top-level await to query databases or fetch from remote APIs natively before rendering the final string.
- Distributed Composition (Micro-Frontends): JSDA relies on standard ES Modules, resources can be seamlessly imported from local files or even directly from remote JS CDNs. Teams can natively architect decentralized micro-frontends without complex bundlers.
- Hybrid Delivery: JSDA lets you effortlessly transition between blazing-fast SSG for zero-cost edge deployment, or dynamic asset rendering for authenticated routes - all using the exact same codebase.
Powered by JSDA-Kit as the core underlying engine.
- Hybrid Rendering — SSG for static pages, dynamic JSDA server, all with a simple configuration (
project.cfg.js). - SSR for Web Components — Symbiote.js - isomorphic (universal), client-only or server-only components are supported.
- HTML-app Starter — a task board with HTML-defined custom elements, reactive JSON state, record editing, search, filters and explicit browser saving. Application behavior is declared in HTML; the JavaScript entry only loads the runtime.
- Powerful Isomorphic Application Data Management - flexible Pub/Sub based data context objects (Symbiote.js).
- Automated Import Maps — CDN-resolved import maps generated from
package.jsondependencies for efficient resource sharing (micro-frontend architecture, widgets, etc.). - Markdown to HTML — pull and render remote or local Markdown files.
- Code Highlighting — fenced code blocks in Markdown are syntax-highlighted at build time.
- Asset Minification & Bundling — on-the-fly minification of JS, CSS, HTML, and SVG with configurable excludes.
- Sitemap Generation — automatic
sitemap.xmloutput during SSG builds with exclude patterns. - Cloud Image Management — integrated Cloud Images Toolkit for image publishing and CDN delivery. Interactive media widgets generation support out of the box (IMS).
- Icon System — centralized Material Symbols icon collection with auto-injected link tags.
- TypeScript Support — type secured JS code base; no additional compilation step required (JSDoc + *.d.ts).
.
├── src/
│ ├── common-styles/ # Shared CSS modules and design tokens
│ ├── dynamic-pages/ # Dynamic application (JSDA server endpoints)
│ ├── static-pages/ # Static site generation (SSG) sources
│ ├── ui-components/ # HTML-app fragments and class-based web components
│ └── icons/ # Centralized Material Symbols configuration
│
├── types/ # TypeScript definitions (JSDoc)
├── cit/ # Cloud Images Toolkit workspace
├── dist/ # Output directory for the static build
├── secrets/ # Sensitive data (e.g. auth configurations)
│
├── project.cfg.js # Main project configuration
├── cit-config.json # Cloud Images Toolkit configuration
├── tsconfig.json # TypeScript / JSDoc checking
└── package.json
- Node.js ≥ 20
- npm
Since this repository is a GitHub Template, you can simply click the green Use this template button at the top of the repository page to instantly generate your own repository based on this codebase.
(Alternatively, you can manually clone this repository and run npm install)
The easiest way to start a new project is by using the JSDA-Kit built-in scaffolding tool. This command downloads the latest template and sets up your project structure.
mkdir my-project
cd my-project
npx jsda scaffoldStatic site (SSG build with watcher + SSR for web components + dev server):
npx jsda ssgOutput goes to dist/.
Dynamic app (JSDA server + SSR for web components):
npx jsda serveThe server starts at http://localhost:3000. Routes are defined in src/dynamic-pages/routes/routes.js.
npm run buildRuns jsda build and copies robots.txt to the output directory.
Open /pages/html-app/ on the static development server, or /html-app/ on the dynamic server. The static example also works under a deployment subdirectory, such as GitHub Pages. Use the HTML-app Starter navigation link to find it.
The shared task-board template contains the application:
sym-contextdeclares the task list and draft as JSON. The nested draft context usesbindfor incoming data andpub-tofor edits.sym-component reg="starter-task"defines a reusable custom element entirely in HTML.sym-collectionrenders its instances with Itemize, preserving record IDs while searching and filtering.- Native controls use declarative actions to append, edit, complete and delete records.
pub-mappublishes the visible and total counts. - Save in this browser persists only
tasks; Restore saved tasks discards unsaved task edits. Saved tasks restore on the next visit. Storage errors and changes from another tab are shown in the UI.
Both page entries import @symbiotejs/symbiote/html-app. The package is a direct dependency, and project.cfg.js maps both its core and HTML-app entry to versioned CDN modules. Shared styling lives beside the HTML fragment; no application classes or custom event handlers are needed for this example.
This task board initializes in the browser. The existing universal components still demonstrate JSDA's SSR and hydration path. For HTML-app SSR, follow the foundation's server rendering and hydration contract, including explicit owner cleanup and hydration bindings.
Browser saving needs HTTPS or loopback HTTP, Web Locks and IndexedDB. It stores data for the current origin, without sending it to a server. Static and dynamic development servers on different ports have separate saved lists. See the HTML-app guide for JSON sources, trusted HTML imports, routing and HTTP synchronization.
A GitHub Actions workflow (.github/workflows/deploy-pages.yml) is included. It builds the static site and deploys dist/ to GitHub Pages on every push to main.
To enable it:
- Go to your repo Settings → Pages → Source and select GitHub Actions.
- Push to
main— the workflow will build and deploy automatically.
SSG result demo: https://rnd-pro.github.io/jsda-template/
JSDA relies heavily on JavaScript template literals for HTML and CSS (e.g., /*html*/, /*css*/, or using html\`` and css`` template tags).
For the best developer experience, we strongly recommend enabling syntax highlighting for these template strings in your IDE.
If you are using VS Code, install the appropriate extension (F.e. es6-string-html). This will highlight, lint and enable auto-completion for HTML, SVG and CSS embedded inside your JavaScript files.
We use JSDoc annotations within standard JavaScript files to provide type safety via TypeScript. If you do not have TypeScript installed globally or supported natively in your IDE, you can still run type checks locally.
Install typescript as a dev dependency:
npm install -D typescriptThen, you can run the included npm script to verify your types across the project:
npm run check:typesThis will run npx tsc --noEmit to validate your types against tsconfig.json without unnecessary compiling the source code.
All project behavior is controlled via project.cfg.js:
| Section | Purpose |
|---|---|
dynamic |
Dev server port, route map, base directory, cache rules, request handlers |
static |
SSG source and output directories |
ssr |
Toggle SSR and list component barrel imports |
minify |
Per-format minification flags (JS, CSS, HTML, SVG) with excludes |
bundle |
JS/CSS bundling toggles with excludes |
importmap |
Auto-generated import map from npm packages via CDN |
sitemap |
Sitemap generation with base URL and route excludes |
log |
Enable/disable request logging |
Cloud Images Toolkit is configured separately in cit-config.json. See the CIT documentation for details.
JSDA heavily embraces a convention-over-configuration approach. By leveraging strict file naming patterns, JSDA generates various types of web assets directly from JavaScript modules without requiring complex build configuration files. The default export of these modules must simply be a string (or a function returning a string) containing the raw asset data.
| Pattern | Output | Purpose |
|---|---|---|
[name].html.js |
[name].html |
Dynamic HTML generator (exports an HTML string). |
[name].css.js |
[name].css |
CSS module (exports a CSS string). |
[name].svg.js |
[name].svg |
SVG graphic (exports an SVG markup string). |
[name].json.js |
[name].json |
JSON data payload (exports a JSON string). |
[name].md.js |
[name].md |
Markdown content (exports a markdown string). |
index.js |
index.js |
JS bundle entry point. |
*.tpl.html |
n/a | Static template file containing {[PLACEHOLDER]} tags. |
During Static Site Generation (SSG), JSDA-Kit uses the file structure to reflect output path by scanning specifically for files matching the index.*.js pattern (which includes double extensions like index.html.js as well as plain index.js).
These files determine the output file path:
src/static-pages/about/index.html.js→dist/about/index.htmlsrc/static-pages/app/index.js→dist/app/index.js(bundled and minified automatically)
They act as the default entry points for final output generation.
The double-extension pattern (.[ext].js) tells JSDA-Kit exactly what the final output format is. This [ext] is used for proper MIME type resolution during dynamic serving and dictates which minification pipeline to apply during SSG builds (e.g., HTML minifier for .html.js, CSS minifier for .css.js).
| Package | Role |
|---|---|
jsda-kit |
Build toolkit — SSG, SSR, dev server, minification, bundling, import maps, sitemap, etc. |
@symbiotejs/symbiote |
Light but powerful Web component library with SSR support and more... |
cloud-images-toolkit |
Image management and cloud (Image CDN) publishing (dev dependency) |
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add your feature') - Push and open a Pull Request
MIT License © rnd-pro.com