JSDA JSDAStack Reference Project

JSDA-Stack Template

JSDAStack License Node JSDA Kit Symbiote.js Cloud Images Toolkit Live Demo

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:

Powered by JSDA-Kit as the core underlying engine.

Core Features

Project Structure

.
├── 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/              # Web components (universal, client-only, server-only)
│   └── 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

Getting Started

Prerequisites

Installation

Option 1: GitHub Template Repository

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)

Option 2: Using the JSDA-Kit CLI

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 scaffold

Development

Static site (SSG build with watcher + SSR for web components + dev server):

npx jsda ssg

Output goes to dist/.

Dynamic app (JSDA server + SSR for web components):

npx jsda serve

The server starts at http://localhost:3000. Routes are defined in src/dynamic-pages/routes/routes.js.

Production Build

npm run build

Runs jsda build and copies robots.txt to the output directory.

GitHub Pages

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:

  1. Go to your repo Settings → Pages → Source and select GitHub Actions.
  2. Push to main — the workflow will build and deploy automatically.

SSG result demo: https://rnd-pro.github.io/jsda-template/

IDE Setup

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.

Optional TypeScript Setup

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 typescript

Then, you can run the included npm script to verify your types across the project:

npm run check:types

This will run npx tsc --noEmit to validate your types against tsconfig.json without unnecessary compiling the source code.

Project Configuration

All project behavior is controlled via project.cfg.js:

SectionPurpose
dynamicDev server port, route map, base directory, cache rules, request handlers
staticSSG source and output directories
ssrToggle SSR and list component barrel imports
minifyPer-format minification flags (JS, CSS, HTML, SVG) with excludes
bundleJS/CSS bundling toggles with excludes
importmapAuto-generated import map from npm packages via CDN
sitemapSitemap generation with base URL and route excludes
logEnable/disable request logging

Cloud Images Toolkit is configured separately in cit-config.json. See the CIT documentation for details.

File Naming and Syntax Conventions

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.

PatternOutputPurpose
[name].html.js[name].htmlDynamic HTML generator (exports an HTML string).
[name].css.js[name].cssCSS module (exports a CSS string).
[name].svg.js[name].svgSVG graphic (exports an SVG markup string).
[name].json.js[name].jsonJSON data payload (exports a JSON string).
[name].md.js[name].mdMarkdown content (exports a markdown string).
index.jsindex.jsJS bundle entry point.
*.tpl.htmln/aStatic template file containing {[PLACEHOLDER]} tags.

The index.*.js Pattern and SSG

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:

They act as the default entry points for final output generation.

MIME Type Resolution and Minification

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).

Key Dependencies

PackageRole
jsda-kitBuild toolkit — SSG, SSR, dev server, minification, bundling, import maps, sitemap, etc.
@symbiotejs/symbioteLight but powerful Web component library with SSR support and more...
cloud-images-toolkitImage management and cloud (Image CDN) publishing (dev dependency)

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m 'Add your feature')
  4. Push and open a Pull Request

License

MIT License © rnd-pro.com

arrow_forward Template Repoarrow_forward JSDA Manifestarrow_forward Symbiote.jsarrow_forward Cloud Images Toolkit
chevron_right