ssg-generator-vite
v1.3.2
Published
JSON-driven static site generator powered by Vue 3 + Vite SSG
Maintainers
Readme
SSG Generator
A proof of concept for generating static sites from dynamic content. You can define an entire site — including all interactions, articles, and pages — through a single JSON object.
Overview
The goal is to let developers create, update, and deploy a site by only changing a JSON file. The generated output is pure static HTML, requiring no server to process requests. This means near-perfect performance and SEO scores out of the box.
Contributing
This idea is too large to tackle alone, so any help or feature requests are welcome.
Commands
npm run json— starts the Express server that provides the JSON structure- Edit
JSONsExample/example.tsto change what appears in the frontend
- Edit
npm run dev— starts the dev server with HMR (requires the JSON server to be running)npm run build— type-checks and builds the projectnpm run gen— fetches the JSON structure, encodes it, and runs the full SSG buildnpm run preview— serves the generated static files locallynpm run build:lib— builds the library for NPM (ESM, CJS, UMD, IIFE)
Library (Browser Usage)
ssg-generator-vite can be used as a client-side library to render sites dynamically from JSON directly in the browser.
import { mountSsgApp, exportSsgApp } from 'ssg-generator-vite'
// Mount directly
mountSsgApp('#app', { structure: mySsgJson, history: 'hash' })
// Or get the configured app first (add plugins, global components, etc.)
const { app, router } = await exportSsgApp({ structure: mySsgJson, history: 'hash' })
app.use(MyPlugin)
app.mount('#app')For more details, see Browser Usage Guide.
Tech stack
| | |
|---|---|
| Vue 3 | UI rendering with Composition API |
| Vite | Bundler and dev server |
| vite-ssg | Pre-renders each route to static HTML |
| TypeScript | Full type coverage via src/types/index.ts |
| Vitest | Unit test suite |
TODOs
- Dynamic routes — static part not generated correctly in all cases
- Missing features:
- Nested SEO (meta tags at component level)
- JSON Schema for editor autocomplete
- More CSS framework support
- Standalone CLI (
npx ssg-gen)
