A modern, production-ready SvelteKit dashboard starter with fully functional Role-Based Access Control (RBAC)
Features ⢠Getting Started ⢠Documentation ⢠Contributing
SvelterApp is a comprehensive, open-source SvelteKit dashboard starter template designed for building modern SaaS applications and admin dashboards. It comes with a fully functional Role-Based Access Control (RBAC) system, multi-tenant organization support, and a beautiful, responsive UI built with modern web technologies.
š Complete Authentication System
š”ļø Role-Based Access Control (RBAC)
š¢ Multi-Tenant Architecture
š„ User Management
š Dashboard & Analytics
š Internationalization (i18n)
šØ Modern UI/UX
š§ Email Service
š Audit Logging
$state, $derived, $effect)Before you begin, ensure you have the following installed:
git clone https://github.com/SaiefBrahim/SvelterApp.git
cd SvelterApp
pnpm install
# or
npm install
Copy the .env.example file to .env:
cp .env.example .env
Edit .env and configure the following variables:
# Database
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/svelterapp?schema=public"
# Auth.js Configuration
# Generate with: npx auth secret
AUTH_SECRET="your_auth_secret"
AUTH_TRUST_HOST=true
# Application
ENVIRONMENT="development"
PUBLIC_APP_NAME="Svelter App"
PUBLIC_APP_URL="http://localhost:5173"
# Resend Email Service (optional for development)
RESEND_API_KEY=
MAILER_ADDRESS="SvelterApp <[email protected]>"
Important: Generate a secure AUTH_SECRET:
npx auth secret
# Generate Prisma Client
pnpm db:generate
# Run database migrations
pnpm db:migrate
# Seed the database with initial data
pnpm db:seed
The seed script will create:
[email protected], password: admin123)pnpm lang:compile
pnpm dev
The application will be available at http://localhost:5173
After seeding the database, you can log in with:
[email protected]admin123ā ļø Important: Change the default password in production!
| Command | Description |
|---|---|
pnpm dev |
Start development server |
pnpm build |
Build for production |
pnpm preview |
Preview production build |
pnpm check |
Run type checking |
pnpm db:generate |
Generate Prisma Client |
pnpm db:push |
Push schema changes to database |
pnpm db:migrate |
Run database migrations |
pnpm db:seed |
Seed the database |
pnpm db:studio |
Open Prisma Studio |
pnpm db:reset |
Reset database (ā ļø destructive) |
pnpm lang:compile |
Compile i18n messages |
svelterapp/
āāā prisma/
ā āāā schema.prisma # Database schema
ā āāā seed.ts # Database seeding script
ā āāā migrations/ # Database migrations
āāā src/
ā āāā lib/
ā ā āāā components/ # Reusable components
ā ā ā āāā ui/ # Shadcn-svelte components
ā ā ā āāā layout/ # Layout components
ā ā āāā server/
ā ā ā āāā auth/ # Authentication logic
ā ā ā āāā db/ # Database connection
ā ā ā āāā rbac/ # RBAC guards and permissions
ā ā ā āāā services/ # Business logic services
ā ā āāā utils/ # Utility functions
ā āāā routes/
ā āāā (app)/ # Protected routes
ā āāā (auth)/ # Authentication routes
ā āāā api/ # API endpoints
āāā messages/ # i18n translation files
āāā static/ # Static assets
āāā project.inlang/ # Inlang configuration
The RBAC system is built on a hierarchical role structure:
SUPER_ADMIN (Level 4)
ADMIN (Level 3)
MANAGER (Level 2)
OPERATOR (Level 1)
Permissions follow the resource:action pattern:
users:create, users:read, users:update, users:delete, users:manageroles:read, roles:manageaudit_logs:readinvites:read, invites:managesessions:read, sessions:manageorganization_settings:read, organization_settings:update, organization_settings:managesrc/lib/server/rbac/permissions.tsprisma/seed.tsDEFAULT_ROLE_PERMISSIONSrequirePermission(event, 'resource:action')We welcome contributions! SvelterApp is an open-source project, and we appreciate your help in making it better.
Fork the repository
Create a feature branch
git checkout -b feature/amazing-feature
Make your changes
Commit your changes
git commit -m "Add amazing feature"
git push origin feature/amazing-feature
Open a Pull Request
$state, $derived, $effect)$lib/components/ui for UI componentsIf you find a bug or have a feature request:
Be respectful, inclusive, and constructive in all interactions.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ā¤ļø using SvelteKit
ā Star us on GitHub ⢠š Report Bug ⢠š” Request Feature