A simple, generic application skeleton with Authentication (Login, Register, Logout, Profile) and a Dashboard layout.
- Framework: SvelteKit
- Runtime: Bun
- Styling: Tailwind CSS + DaisyUI
- Database: PostgreSQL
- ORM: Drizzle ORM
-
Install Dependencies:
bun install
-
Environment Variables: Create a
.env.localfile (or.envif 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_SECRETare kept private for security. -
Database Setup:
- Use Drizzle Kit to push the schema to your database:
bun drizzle-kit push
- Use Drizzle Kit to push the schema to your database:
-
Run Development Server:
bun dev
- 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.
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®ister: Public auth routes.