@sprig-and-prose/sprig-ui-csr
v0.3.6
Published
A Client-Side Rendering (CSR) version of sprig-universe-ui. This is a plain Svelte application served by a simple Node.js HTTP server.
Downloads
138
Readme
sprig-ui-csr
A Client-Side Rendering (CSR) version of sprig-universe-ui. This is a plain Svelte application served by a simple Node.js HTTP server.
Overview
This application serves a Svelte app via Node's native http package. The server handles three route patterns:
/_ui/*- Serves UI assets from the Vite build output/api/manifest- Servesmanifest.jsonfrom the current directory (or configured path)- Everything else - Serves
index.htmlfor client-side routing
Installation
npm installDevelopment
Build the Svelte app:
npm run buildStart the server:
npm startOr use the CLI directly:
node src/cli.jsThe server will be available at http://localhost:5173 (or the configured port).
CLI Options
# Use default port (5173) and manifest path (./manifest.json)
sprig-ui-csr
# Specify a custom port
sprig-ui-csr --port 3000
# or
sprig-ui-csr -p 3000
# Specify a custom manifest path
sprig-ui-csr --manifest ./custom-manifest.json
# or
sprig-ui-csr -m ./custom-manifest.json
# Combine options
sprig-ui-csr -p 8080 -m ./data/manifest.json
# Show help
sprig-ui-csr --helpOther Commands
# Format code
npm run format
# Lint code
npm run lint
# Type check (JSDoc types)
npm run typecheck
# Build for production
npm run buildProject Structure
sprig-ui-csr/
├── package.json
├── biome.json
├── tsconfig.json
├── vite.config.js
├── index.html
├── src/
│ ├── main.js # Svelte app entry point
│ ├── App.svelte # Root Svelte component
│ ├── server.js # HTTP server implementation
│ ├── cli.js # CLI entry point
│ └── styles/
│ └── app.css # Global styles
└── dist/ # Vite build output (served as /_ui/*)Technologies
- Svelte 5: Component framework
- Vite 6: Build tool
- TypeScript 5.7: Type checking (via JSDoc annotations)
- Biome 2.3: Linting and formatting
- Node.js HTTP: Native HTTP server (no framework dependencies)
Configuration
- TypeScript: Configured in
tsconfig.jsonfor type checking only (no compilation) - Biome: Configured in
biome.json(formats JS/TS, ignores Svelte files) - Vite: Configured in
vite.config.js(builds Svelte app with base path/_ui/)
Manifest API
The /api/manifest endpoint serves the manifest.json file from the current working directory (or a configured path). If the file doesn't exist, it returns a 404 error.
License
ISC
