@happyvertical/template-sveltekit
SvelteKit project template with SMRT framework integration. Scaffolds a full-stack app with auto-generated REST API routes, TypeScript, and SQLite.
v0.20.44TemplateSvelteKitFull-Stack
Overview
@happyvertical/smrt-template-sveltekit provides the base SvelteKit project
template used by smrt gnode create. It scaffolds a full-stack app with the SMRT
Vite plugin for automatic REST API route generation, an example @smrt() object,
server-side initialization, and SQLite database configuration.
What the Template Provides
- SvelteKit 2.x with Svelte 5 and TypeScript
smrtPlugin()Vite integration for automatic REST API route generation- Example
@smrt()object (Item.ts) with barrel export - Server-side SMRT initialization (
src/lib/server/smrt.ts) smrt.config.tswith SQLite database and optional AI provider.env.examplewith starter environment variables
Usage
With smrt CLI (recommended)
bash
smrt gnode create my-app --template sveltekit
cd my-app
pnpm install
cp .env.example .env # Edit with your values
pnpm dev # Start dev server at http://localhost:5173Programmatic Usage
typescript
import { copyTemplate } from '@happyvertical/smrt-template-sveltekit';
copyTemplate('./my-new-project', {
name: 'my-app',
overwrite: false,
});Package Exports
getTemplatePath()-- returns absolute path to thetemplate/directorycopyTemplate(destination, options)-- copies template files with project name substitution inpackage.jsontemplateInfo-- metadata object describing the template (SvelteKit 2.x, Svelte 5, REST API, SMRT CLI, SQLite)
Environment Variables
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | Database path (default: ./data/app.db) |
DATABASE_TYPE | Yes | Database engine (default: sqlite) |
PUBLIC_SITE_NAME | No | Display name for the site |
PUBLIC_SITE_URL | No | Public URL (default: http://localhost:5173) |
OPENAI_API_KEY | No | OpenAI API key for AI features |
ANTHROPIC_API_KEY | No | Anthropic API key (alternative AI provider) |
Placeholder Substitution
During smrt gnode create, these placeholders are replaced in template files:
| Placeholder | Value |
|---|---|
{{PROJECT_NAME}} | Project name from CLI |
{{PACKAGE_NAME}} | Lowercase, hyphenated package name |