sveltekit-template Svelte Themes

Sveltekit Template

A modern, type-safe SvelteKit application featuring a comprehensive dashboard with authentication, data visualization, and interactive components built with shadcn/ui components.

SvelteKit Dashboard Application

A modern, type-safe SvelteKit application featuring a comprehensive dashboard with authentication, data visualization, and interactive components built with shadcn/ui components.

šŸš€ Features

  • Authentication System: Google OAuth integration with Better Auth
  • Interactive Dashboard: Data tables with drag-and-drop functionality
  • Data Visualization: Interactive charts with LayerChart and D3.js
  • Responsive UI: Mobile-first design with shadcn/ui components
  • Type Safety: Full TypeScript support throughout the application
  • Database Integration: PostgreSQL with Prisma ORM
  • Modern Styling: Tailwind CSS with custom themes

šŸ› ļø Technology Stack

Core Framework

  • SvelteKit 2.50.1 - Full-stack framework for Svelte applications
  • Svelte 5.48.2 - Next-generation reactive frontend framework
  • TypeScript 5.9.3 - Static type checking for JavaScript

Backend & Database

  • Prisma 7.3.0 - Next-generation ORM for Node.js and TypeScript
  • PostgreSQL - Relational database management system
  • Better Auth 1.4.18 - Authentication library with social providers

UI Components & Styling

  • shadcn/ui - Reusable component library
  • Tailwind CSS 4.1.18 - Utility-first CSS framework
  • @tailwindcss/typography - Typography plugin

Data Visualization

  • LayerChart - Charting library for Svelte
  • D3.js - Data-driven documents library
  • @tanstack/table-core - Headless UI for building powerful tables

Utilities

  • Zod 4.1.13 - TypeScript-first schema declaration and validation
  • clsx - Utility for constructing className strings
  • tailwind-merge - Merge Tailwind CSS classes efficiently
  • svelte-sonner - Toast notifications for Svelte

šŸ“ Project Structure

src/
ā”œā”€ā”€ features/
│   ā”œā”€ā”€ accounts/           # Authentication related components
│   │   └── ui/
│   │       └── login-form.svelte
│   └── dashboard-template/ # Dashboard components
│       ā”œā”€ā”€ chart-area-interactive.svelte
│       ā”œā”€ā”€ data-table.svelte
│       ā”œā”€ā”€ data-table-cell-viewer.svelte
│       ā”œā”€ā”€ data-table-checkbox.svelte
│       ā”œā”€ā”€ data-table-reviewer.svelte
│       ā”œā”€ā”€ schemas.ts
│       └── section-cards.svelte
ā”œā”€ā”€ lib/
│   ā”œā”€ā”€ components/
│   │   ā”œā”€ā”€ app/            # Application layout components
│   │   │   ā”œā”€ā”€ app-sidebar.svelte
│   │   │   ā”œā”€ā”€ mode-switcher.svelte
│   │   │   ā”œā”€ā”€ nav-main.svelte
│   │   │   ā”œā”€ā”€ sidebar-opt-in-form.svelte
│   │   │   └── site-header.svelte
│   │   └── ui/             # shadcn/ui components
│   │       ā”œā”€ā”€ avatar/
│   │       ā”œā”€ā”€ badge/
│   │       ā”œā”€ā”€ button/
│   │       ā”œā”€ā”€ card/
│   │       ā”œā”€ā”€ chart/
│   │       ā”œā”€ā”€ checkbox/
│   │       ā”œā”€ā”€ data-table/
│   │       ā”œā”€ā”€ drawer/
│   │       ā”œā”€ā”€ dropdown-menu/
│   │       ā”œā”€ā”€ field/
│   │       ā”œā”€ā”€ input/
│   │       ā”œā”€ā”€ label/
│   │       ā”œā”€ā”€ select/
│   │       ā”œā”€ā”€ sidebar/
│   │       ā”œā”€ā”€ table/
│   │       ā”œā”€ā”€ tabs/
│   │       └── ...
│   ā”œā”€ā”€ hooks/
│   │   └── is-mobile.svelte.ts
│   ā”œā”€ā”€ styles/
│   │   ā”œā”€ā”€ layout-arcade.css
│   │   ā”œā”€ā”€ layout-default.css
│   │   └── layout-mono.css
│   ā”œā”€ā”€ auth-client.ts      # Client-side authentication
│   ā”œā”€ā”€ auth.ts            # Server-side authentication configuration
│   ā”œā”€ā”€ environment.ts     # Environment constants
│   ā”œā”€ā”€ prisma.ts          # Prisma client configuration
│   └── utils.ts           # Utility functions
ā”œā”€ā”€ routes/
│   ā”œā”€ā”€ (global)/
│   │   ā”œā”€ā”€ (private)/dashboard/  # Protected dashboard routes
│   │   │   ā”œā”€ā”€ +page.svelte
│   │   │   └── data.ts
│   │   ā”œā”€ā”€ (public)/             # Public landing page
│   │   │   └── +page.svelte
│   │   ā”œā”€ā”€ +layout.server.ts
│   │   └── +layout.svelte
│   ā”œā”€ā”€ (simple)/
│   │   ā”œā”€ā”€ auth/login/           # Authentication routes
│   │   │   ā”œā”€ā”€ +page.server.ts
│   │   │   └── +page.svelte
│   │   └── +layout.svelte
│   └── layout.css
ā”œā”€ā”€ app.d.ts
ā”œā”€ā”€ app.html
└── hooks.server.ts        # Server hooks for authentication middleware

šŸ”§ Installation

  1. Clone the repository:
git clone <repository-url>
cd my-app
  1. Install dependencies:
bun install
# or
npm install
# or
yarn install
# or
pnpm install
  1. Set up environment variables: Create a .env file in the root directory:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/database_name"

# Better Auth
BETTER_AUTH_URL="http://localhost:5173"
BETTER_AUTH_SECRET="your-secret-key-here"

# Google OAuth (optional)
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
  1. Set up the database:
npx prisma migrate dev
npx prisma generate

šŸƒ Development

Start the development server:

bun run dev
# or
npm run dev
# or
yarn dev
# or
pnpm dev

The application will be available at http://localhost:5173.

šŸ“¦ Available Scripts

  • dev - Start development server
  • build - Build for production
  • preview - Preview production build locally
  • check - Run type checking
  • check:watch - Run type checking in watch mode
  • lint - Check code formatting with Prettier
  • format - Format code with Prettier

šŸ” Authentication System

The application uses Better Auth for authentication with the following features:

  • Social Login: Google OAuth integration
  • Session Management: Secure session handling with cookies
  • Route Protection: Automatic redirection for protected routes
  • User Context: Access to user and session data throughout the application

Protected Routes

Routes under (private) group require authentication. Unauthenticated users will be redirected to /auth/login.

šŸ—„ļø Database Schema

The Prisma schema includes the following models:

  • User: User accounts with email, name, and profile information
  • Session: User sessions with expiration and device information
  • Account: Connected accounts (social providers)
  • Verification: Email verification tokens

šŸŽØ Component Library

This project uses shadcn/ui components with custom styling:

  • Data Tables: Interactive tables with sorting, filtering, and drag-and-drop
  • Charts: Responsive data visualizations with LayerChart
  • Forms: Accessible form components with validation
  • Navigation: Sidebar navigation with collapsible sections
  • Layout: Responsive grid systems and containers

🌐 Deployment

The application uses @sveltejs/adapter-node which automatically adapts to Node.js servers

For production deployment:

bun run build

šŸ¤ Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ™ Acknowledgments

Top categories

Loading Svelte Themes