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 pnpmif 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:
| Data | Count | Details |
|---|---|---|
| Users | 50 | 3 with known credentials (see below), 47 randomly generated |
| Pages | 65 | Mix of draft, published, and archived content |
| Notifications | 33 | Various types: info, success, warning, error |
| App Settings | 4 | Site 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:
| Username | Password | Role | Permissions |
|---|---|---|---|
admin | password123 | Admin | Full access — manage users, content, settings, roles |
editor | password123 | Editor | Create and edit content, view analytics |
viewer | password123 | Viewer | Read-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= | Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | Path to the SQLite database file |
ORIGIN | Yes | Public URL: set before building for CSRF checks, and at runtime for OAuth callbacks |
GOOGLE_CLIENT_ID | No | Google OAuth 2.0 client ID |
GOOGLE_CLIENT_SECRET | No | Google OAuth 2.0 client secret |
GITHUB_CLIENT_ID | No | GitHub OAuth app client ID |
GITHUB_CLIENT_SECRET | No | GitHub 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:
| Command | Description |
|---|---|
pnpm dev | Start the SvelteKit dev server with HMR |
pnpm build | Create a production build |
pnpm preview | Preview the production build locally |
pnpm check | Run svelte-check for type errors |
pnpm check:watch | Type-check in watch mode |
pnpm db:push | Push Drizzle schema changes to the database |
pnpm db:generate | Generate Drizzle migration files from schema |
pnpm db:studio | Open Drizzle Studio GUI for database browsing |
pnpm db:seed | Seed the database with sample data |
pnpm test | Run all unit tests with Vitest |
pnpm test:watch | Run unit tests in watch mode |
pnpm test:e2e | Run end-to-end tests with Playwright |
pnpm lint | Lint with ESLint 9 |
pnpm format | Format code with Prettier |
pnpm format:check | Check 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.