webapp-template Svelte Themes

Webapp Template

WebApp Template using SvelteKit + DaisyUI + Postgres + Drizzle ORM

Generic SvelteKit App

A simple, generic application skeleton with Authentication (Login, Register, Logout, Profile) and a Dashboard layout.

Stack

  • Framework: SvelteKit
  • Runtime: Bun
  • Styling: Tailwind CSS + DaisyUI
  • Database: PostgreSQL
  • ORM: Drizzle ORM

Setup

  1. Install Dependencies:

    bun install
    
  2. Environment Variables: Create a .env.local file (or .env if not ignored) with the following content:

    # Private Secrets (Backend only)
    DB_USER="user"
    DB_PASSWORD="password"
    DB_HOST="localhost"
    DB_PORT="5432"
    DB_NAME="dbname"
    
    JWT_SECRET="your-secure-secret-key"
    
    # Public Configuration (Exposed to Client)
    PUBLIC_APP_NAME="My Generic App"
    

    Note: Secrets like database credentials and JWT_SECRET are kept private for security.

  3. Database Setup:

    • Use Drizzle Kit to push the schema to your database:
      bun drizzle-kit push
      
  4. Run Development Server:

    bun dev
    

Features

  • Authentication: JWT-based session management.
  • Protected Routes: The (app) group is protected; unauthenticated users are redirected to /login.
  • Layout: Sidebar navigation, Breadcrumbs, and User Menu.
  • Profile: Update name and change password.

Project Structure

  • src/lib/server/db.ts: Database connection.
  • src/lib/server/schema.ts: Drizzle schema definition.
  • src/lib/server/auth.ts: Auth utilities (JWT, Password Hashing).
  • src/hooks.server.ts: Session verification middleware.
  • src/routes/(app): Authenticated routes (Dashboard, Profile).
  • src/routes/login & register: Public auth routes.

Top categories

Loading Svelte Themes