@happyvertical/template-site-static-json

Scaffold template for static community news sites with JSON data storage. Includes a local WeatherHeader shim and stubbed Caelus/Praeco workflow scripts on the v0.29.32 baseline.

v0.29.34TemplateStatic SiteJSONWeatherHeader shim

Overview

@happyvertical/smrt-template-site-static-json generates a SvelteKit static community-news site with JSON file-based data storage. It is the template smrt gnode create expands when you pass --template site-static-json: pre-built routes (home, about, contact), Markdown rendering, config-driven site identity, and integration hooks for weather forecasts (Caelus) and council-meeting article generation (Praeco). The build emits static HTML for any CDN.

Usage

bash
smrt gnode create my-town-site --template site-static-json \
  --location "My Town, AB" \
  --lat 53.5 --lon -113.5

cd my-town-site
pnpm install
cp .env.example .env      # Add your GEMINI_API_KEY
pnpm run init-data        # Initialize data directory
pnpm dev                  # Start dev server

What the Template Provides

  • SvelteKit with adapter-static for static-site generation
  • JSON file-based data storage in data/
  • Config-driven site identity, navigation, categories, and theming via smrt.config.js
  • Caelus-shaped weather payload rendering (via the local WeatherHeader.svelte shim — see below)
  • Praeco integration scaffolding for council-meeting scraping and article generation (workflow scripts stubbed — see below)
  • Typed site config helper (initSiteConfig() / getSite())
  • Pre-built routes: home, about, contact
  • Markdown utility for content rendering

WeatherHeader Shim

The template ships template/src/lib/components/WeatherHeader.svelte as a local shim. It used to be imported from @happyvertical/smrt-svelte, but that package no longer ships the component, so the template inlines an equivalent.

The shim renders the Caelus-shaped forecast payload (current conditions plus a short outlook). If you wire a different weather provider — or restructure the forecast object — edit this file in your generated project to suit your data layer. The shim has no upstream dependency, so customising it does not break pnpm update.

Workflow Scripts (Stubs on v0.29.32)

pnpm run workflow:caelus and pnpm run workflow:praeco are documented contracts but currently ship as stub scripts. They print an "upstream package needs a CLI bin" message and exit with status 1.

Two independent reasons today's scaffold cannot run them:

  1. Upstream packages are library-only. @happyvertical/caelus and @happyvertical/praeco do not declare a bin field, so npx @happyvertical/caelus / npx @happyvertical/praeco exits with "could not determine executable to run."
  2. No local workflow shim. The template does not ship template/src/workflows/caelus.ts or template/src/workflows/praeco.ts files that would import the upstream package and invoke the workflow programmatically. A tsx-based script would work fine once such a shim exists.

Once upstream ships CLI bins, the stubs can be replaced with npx @happyvertical/caelus --config smrt.config.js and npx @happyvertical/praeco --config smrt.config.js (note the scoped names — the unscoped caelus package is a 404 on the public registry). Alternatively, add a template/src/workflows/<name>.ts shim that imports the upstream main export and invokes the workflow, then point the script at tsx src/workflows/<name>.ts. Until either lands, callers who need these workflows should write the shim themselves in their generated project.

Configuration

Edit smrt.config.js to customize. Key sections:

  • site -- name, description, location, navigation links, theme colors
  • categories -- content categories for routing (e.g., politics/local)
  • modules.praeco -- council meeting sources and report configurations
  • modules.caelus -- weather location (set automatically from --lat/--lon flags)

Environment Variables

VariableRequiredDescription
GEMINI_API_KEYYesGoogle Gemini API key for Praeco article generation
PUBLIC_GTM_IDNoGoogle Tag Manager container ID
CUSTOM_DOMAINNoCustom domain for deployment

Available Scripts

ScriptDescription
pnpm devStart development server
pnpm buildBuild static site to ./build
pnpm previewPreview the built site
pnpm run init-dataInitialize JSON data files
pnpm run workflow:caelusStub. Prints "upstream package needs a CLI bin" and exits 1 (see Workflow Scripts).
pnpm run workflow:praecoStub. Prints "upstream package needs a CLI bin" and exits 1 (see Workflow Scripts).
pnpm run validate:jsonValidate JSON data files
pnpm run validate:slugsValidate content slugs

Placeholder Substitution

During smrt gnode create, placeholders are replaced from CLI flags:

{{SITE_NAME}}, {{LOCATION_NAME}}, {{LATITUDE}}, {{LONGITUDE}}, {{TIMEZONE}}. See template.config.js for the full mapping.

Deployment

Build and deploy to any static host:

bash
pnpm build
# Deploy ./build to S3, Netlify, Vercel, Cloudflare Pages, etc.