Focus on what truly matters: crafting exceptional applications. Kavach provides a set of components and utility functions that effortlessly integrate authentication and role-based route protection into your app, without compromising its performance or flexibility.
Kavach is a drop-in authentication framework for SvelteKit. It provides:
- A unified API across multiple auth platforms
- Declarative route protection
- Pre-built UI components
So you can add secure authentication to your app in minutes, not days.
- Platform-agnostic — Switch between Supabase, Firebase, Auth0, Amplify, or Convex by swapping one adapter
- Declarative route protection — Define rules once; no scattered
if (!user)checks - Type-safe — Full TypeScript support with centralized types
- Server + Client — Unified session management across browser and server
# Create a SvelteKit project
sv create my-app
cd my-app
# Follow the guided prompts to add Kavach to your project
bunx @kavach/cli init
bun run dev| Provider | Adapter Package | Capabilities | Status |
|---|---|---|---|
| Supabase | @kavach/adapter-supabase |
Auth, Data, Storage, Logging | ✓ |
| Firebase | @kavach/adapter-firebase |
Auth | ✓ |
| Auth0 | @kavach/adapter-auth0 |
Auth | ✓ |
| AWS Amplify | @kavach/adapter-amplify |
Auth | ✓ |
| Convex | @kavach/adapter-convex |
Auth | ✓ |
- Data, Storage & Logging to convex and Firebase
- External storage providers
- External logger api
- External data api
- Mix and match Auth, Data, Storage & Logging (ex Amplify + S3 + Custom Backend)
kavach— Core auth: session management, credential flows, SvelteKit hooks@kavach/sentry— Role-based route protection (RBAC)
@kavach/cli— CLI for scaffolding Kavach into SvelteKit projects@kavach/vite— Vite plugin for code generation
@kavach/logger— Structured context-scoped logging@kavach/cookie— Cookie serialize/deserialize (ESM fork of jshttp/cookie)@kavach/hashing— MD5 hashing for Gravatar@kavach/query— Adapter-agnostic query filter parser
@kavach/ui— Pre-built auth components, cached logins, smart layout
@kavach/adapter-supabase— Supabase authentication and data operations@kavach/adapter-firebase— Firebase authentication@kavach/adapter-auth0— Auth0 authentication@kavach/adapter-amplify— AWS Amplify authentication@kavach/adapter-convex— Convex authentication
Routes are protected by default. Configure public routes in kavach.config.js:
export default {
routes: {
public: ['/login', '/register'],
roles: {
admin: { home: '/admin' },
user: { home: '/dashboard' }
}
}
}MIT © Jerry Thomas