Getting Started

Get SvelteForge Admin running locally in under five minutes. The project uses SvelteKit with Svelte 5, so the development experience is fast — hot module replacement, instant server restarts, and type-safe routing out of the box.

Prerequisites

  • Node.js 22.17+ (LTS recommended)
  • pnpm — Install globally with npm install -g pnpm if you don't have it

Installation

1. Clone the repository

git clone https://github.com/your-org/svelteforge-admin.git
cd svelteforge-admin

2. Install dependencies

pnpm install

3. Set up the database

SvelteForge uses Drizzle ORM with SQLite (via better-sqlite3 in WAL mode). Push the schema to create the database file:

pnpm db:push

This creates svelteforge.db in the project root with all tables: users, sessions, pages, notifications, oauthAccounts, appSettings, and passwordResetTokens.

4. Seed with sample data

pnpm db:seed

The seed script populates the database with realistic sample data:

DataCountDetails
Users503 with known credentials (see below), 47 randomly generated
Pages65Mix of draft, published, and archived content
Notifications33Various types: info, success, warning, error
App Settings4Site name, description, maintenance mode, registration toggle

5. Start the dev server

pnpm dev

Open http://localhost:5173 in your browser. SvelteKit's dev server provides instant hot module replacement — changes to Svelte components, server code, and styles reflect immediately.

Default Login Credentials

After seeding, you can log in with any of these accounts to test different permission levels:

UsernamePasswordRolePermissions
adminpassword123AdminFull access — manage users, content, settings, roles
editorpassword123EditorCreate and edit content, view analytics
viewerpassword123ViewerRead-only access to dashboards and content

Note: If you register a new account on a fresh database (before seeding), the first registered user automatically receives the admin role. Subsequent registrations default to the viewer role.

Environment Variables

Create a .env file in the project root. Copy from .env.example if available:

# Database
DATABASE_URL=svelteforge.db

# Application
ORIGIN=http://localhost:5173

# OAuth (optional — providers are disabled when not set)
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
VariableRequiredDescription
DATABASE_URLYesPath to the SQLite database file
ORIGINYesPublic URL: set before building for CSRF checks, and at runtime for OAuth callbacks
GOOGLE_CLIENT_IDNoGoogle OAuth 2.0 client ID
GOOGLE_CLIENT_SECRETNoGoogle OAuth 2.0 client secret
GITHUB_CLIENT_IDNoGitHub OAuth app client ID
GITHUB_CLIENT_SECRETNoGitHub OAuth app client secret

OAuth providers are configured in #lib/server/oauth.ts using SvelteKit's $app/env/private. When the environment variables are missing, the corresponding social login buttons are automatically hidden from the login page. See the Authentication docs for full OAuth setup instructions.

Available Commands

SvelteForge Admin uses pnpm as its package manager. Here are all available scripts:

CommandDescription
pnpm devStart the SvelteKit dev server with HMR
pnpm buildCreate a production build
pnpm previewPreview the production build locally
pnpm checkRun svelte-check for type errors
pnpm check:watchType-check in watch mode
pnpm db:pushPush Drizzle schema changes to the database
pnpm db:generateGenerate Drizzle migration files from schema
pnpm db:studioOpen Drizzle Studio GUI for database browsing
pnpm db:seedSeed the database with sample data
pnpm testRun all unit tests with Vitest
pnpm test:watchRun unit tests in watch mode
pnpm test:e2eRun end-to-end tests with Playwright
pnpm lintLint with ESLint 9
pnpm formatFormat code with Prettier
pnpm format:checkCheck formatting without writing changes

SvelteKit Route Groups

SvelteForge Admin uses SvelteKit's file-based routing with route groups to apply different layouts and access controls to different sections of the app:

src/routes/
  (app)/          # Protected routes — requires authentication
    dashboard/    # Main dashboard with analytics
    users/        # User management CRUD
    content/      # CMS pages
    analytics/    # Charts and data visualization
    notifications/
    settings/
    roles/
    database/
  (auth)/         # Public auth routes — login, register, OAuth callbacks
    login/
    register/
    forgot-password/
    reset-password/
  (public)/       # Public pages — no auth required
    pricing/
  docs/           # Documentation (you are here)
  api/            # API endpoints
  logout/         # Server-only logout action

Route groups (directories wrapped in parentheses) do not affect the URL path. They exist purely for organizing layouts and middleware. The (app) group has an auth guard in its +layout.server.ts that redirects unauthenticated users to /login. SvelteKit's hooks.server.ts validates the session on every request and populates event.locals.user and event.locals.session.

Next Steps

  • Project Structure — Understand the codebase layout
  • Authentication — Configure OAuth and understand the auth flow
  • Database — Learn the Drizzle ORM schema and migrations
  • Routing — Deep dive into SvelteKit route groups and guards

Need More?

Scale Up with DashboardPack

SvelteForge Admin is a great starting point. When your project needs advanced features — multi-layout dashboards, production CRUD generators, theme customizers, and 50+ pre-built pages — explore the premium templates at DashboardPack.