@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.ts with SQLite database and optional AI provider
  • .env.example with 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:5173

Programmatic 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 the template/ directory
  • copyTemplate(destination, options) -- copies template files with project name substitution in package.json
  • templateInfo -- metadata object describing the template (SvelteKit 2.x, Svelte 5, REST API, SMRT CLI, SQLite)

Environment Variables

VariableRequiredDescription
DATABASE_URLYesDatabase path (default: ./data/app.db)
DATABASE_TYPEYesDatabase engine (default: sqlite)
PUBLIC_SITE_NAMENoDisplay name for the site
PUBLIC_SITE_URLNoPublic URL (default: http://localhost:5173)
OPENAI_API_KEYNoOpenAI API key for AI features
ANTHROPIC_API_KEYNoAnthropic API key (alternative AI provider)

Placeholder Substitution

During smrt gnode create, these placeholders are replaced in template files:

PlaceholderValue
{{PROJECT_NAME}}Project name from CLI
{{PACKAGE_NAME}}Lowercase, hyphenated package name