A production-ready dashboard template built with Qwik and Tailwind CSS, designed for rapid project initialization with enterprise-grade features.
- User Authentication - Secure login/logout system with JWT
- Two-Factor Authentication (2FA) - TOTP-based 2FA with QR code setup
- Role-Based Access Control (RBAC) - Fine-grained permission system
- Session Management - Automatic session tracking and timeout handling
- Password Security - bcrypt hashing with salt rounds
- User CRUD Operations - Create, read, update, and delete users
- Role Assignment - Assign multiple roles to users
- User Status Management - Activate/deactivate user accounts
- Profile Management - User profile editing and avatar support
- Login Attempt Tracking - Security audit trail
- Dark Mode - Full dark mode support with CSS custom properties
- Responsive Design - Mobile-first, fully responsive layouts
- Modern UI Components - Pre-built reusable components
- Accessibility - ARIA-compliant components
- Icons - @qwikest/icons integration
- System Overview - Real-time statistics and metrics
- Chart Integration - Chart.js for data visualization
- Reports - Customizable reporting system
- Settings Management - System configuration interface
- Auto Database Setup - Database automatically initializes on first run
- Type Safety - Full TypeScript support
- Hot Module Replacement - Fast development with Vite
- Code Quality - Biome for linting and formatting
- Demo Users - Pre-configured demo accounts for testing
- Node.js: v18.17.0 or higher
- Bun: Latest version (or npm/yarn/pnpm)
-
Clone the repository
git clone <your-repo-url> cd qwik-dashboard-template
-
Install dependencies
bun install
-
Set up environment variables
cp .env.example .env
Edit
.envand configure:DATABASE_URL="file:./dev.db" JWT_SECRET="your-super-secret-jwt-key-change-this-in-production" TWO_FACTOR_ISSUER="Qwik Dashboard" SESSION_EXPIRES_IN="7d" NODE_ENV="development"
-
Start development server
bun run dev
The database will automatically initialize on first run! π
-
Access the application
- Open http://localhost:5173
- Login with demo accounts (see below)
The system automatically creates these demo accounts:
| Role | Password | Access Level | |
|---|---|---|---|
| Admin | admin@example.com | password123 | Full system access |
| Editor | editor@example.com | password123 | Read dashboard/users |
| User | user@example.com | password123 | Read dashboard only |
β οΈ Security Note: Change these credentials in production!
qwik-dashboard-template/
βββ prisma/
β βββ schema.prisma # Database schema
β βββ seed.ts # Database seed data
βββ public/ # Static assets
β βββ favicon.svg
β βββ logo.svg
β βββ manifest.json
βββ src/
β βββ components/
β β βββ ui/ # Reusable UI components
β β β βββ Badge.tsx
β β β βββ Box.tsx
β β β βββ Button.tsx
β β β βββ Input.tsx
β β β βββ Modal.tsx
β β β βββ OTPInput.tsx
β β β βββ PageHeader.tsx
β β β βββ Select.tsx
β β β βββ Table.tsx
β β β βββ Textarea.tsx
β β βββ router-head/
β β βββ theme-script.tsx # Dark mode script
β βββ routes/
β β βββ auth/ # Authentication routes
β β β βββ login/
β β β βββ setup-2fa/
β β β βββ verify-2fa/
β β βββ dashboard/ # Dashboard routes
β β β βββ index.tsx # Dashboard home
β β β βββ profile/ # User profile
β β β βββ roles/ # Role management
β β β βββ security/ # Security settings
β β β βββ settings/ # System settings
β β β βββ users/ # User management
β β β βββ reports/ # Reports
β β βββ plugin@db.ts # Database init plugin
β β βββ layout.tsx # Root layout
β β βββ index.tsx # Homepage redirect
β βββ server/
β β βββ auth/ # Auth configuration
β β βββ middleware/ # Request middleware
β β βββ services/ # Business logic
β β βββ db.ts # Prisma client
β β βββ db-init.ts # Auto database setup
β βββ utils/ # Utility functions
β βββ entry.dev.tsx
β βββ entry.preview.tsx
β βββ entry.ssr.tsx
β βββ root.tsx
βββ .env.example # Environment variables template
βββ biome.json # Biome configuration
βββ playwright.config.ts # Playwright configuration
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite configuration
# Development
bun run dev # Start development server
bun run dev.debug # Start with Node.js debugger
# Building
bun run build # Production build
bun run build.client # Client-only build
bun run build.preview # Preview build
bun run build.types # Type checking
# Code Quality
bun run fmt # Format code with Biome
bun run lint # Lint and type check
# Database
bun run db:studio # Open Prisma Studio (browse database)
# Preview
bun run preview # Preview production buildThe database automatically initializes on first server start:
- Checks if database file exists
- Creates database if needed
- Syncs schema (dev:
db push, prod:migrate deploy) - Seeds default data (roles, permissions, demo users)
No manual setup required! π
The database is fully managed automatically. For advanced operations:
# Browse database with Prisma Studio
bun run db:studio
# Note: db:generate, db:migrate, db:push, and db:seed
# are automatically handled by the system on startupThe schema includes:
- Users - User accounts with authentication
- Roles - System and custom roles
- Permissions - Resource-based permissions
- UserRoles - User-role assignments
- RolePermissions - Role-permission assignments
- Sessions - Active user sessions
- LoginAttempts - Security audit log
- PendingAuth - 2FA pending authentication
- Settings - System configuration
This template uses the latest Tailwind CSS v4 with:
- CSS-first configuration
- Modern color system
- Dark mode via CSS custom properties
- Responsive design utilities
Toggle dark mode with the theme switcher in the navigation bar. The theme persists across sessions.
Implementation:
// Theme is managed via classList
// Dark mode: document.documentElement.classList.add('dark')
// Light mode: document.documentElement.classList.remove('dark')- User logs in with email/password
- Credentials validated against database
- JWT token generated and stored
- If 2FA enabled, redirect to verification
- Session tracked in database
- Navigate to Security Settings
- Click "Enable 2FA"
- Scan QR code with authenticator app
- Enter verification code
- Save recovery codes securely
Fine-grained RBAC with:
- Resources: users, roles, settings, dashboard
- Actions: read, manage
- Assignment: Roles β Permissions β Users
Example:
// Check permission
import { hasPermission } from '~/server/services/auth.service';
const canManageUsers = hasPermission(user, 'users', 'manage');# Create production build
bun run build
# Preview production build locally
bun run previewEnsure these are set in production:
DATABASE_URL="<production-database-url>"
JWT_SECRET="<strong-random-secret>"
TWO_FACTOR_ISSUER="Your App Name"
SESSION_EXPIRES_IN="7d"
NODE_ENV="production"Add deployment adapters:
# Cloudflare
bun qwik add cloudflare-pages
# Netlify
bun qwik add netlify-edge
# Vercel
bun qwik add vercel-edge
# Node.js
bun qwik add express| Category | Technology |
|---|---|
| Framework | Qwik 1.17+ |
| Styling | Tailwind CSS v4 |
| Database | Prisma + SQLite |
| Authentication | JWT + bcryptjs |
| 2FA | speakeasy + qrcode |
| Validation | Zod |
| Icons | @qwikest/icons |
| Linting/Formatting | Biome |
| Type Checking | TypeScript 5.4 |
| Build Tool | Vite 5.3 |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Run linting (
bun run lint) - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use TypeScript for all new files
- Follow Biome formatting rules
- Add JSDoc comments for public APIs
- Use semantic commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
- Qwik - Resumable framework
- Tailwind CSS - Utility-first CSS
- Prisma - Next-generation ORM
- Biome - Toolchain for web projects