Quick Start

Get up and running with Kavach in just a few minutes.

1. Install Packages

npm install kavach @kavach/sentry @kavach/ui @kavach/vite

2. Configure Kavach

Create a kavach.config.js file in your project root:

export default {
  adapter: 'supabase',
  providers: [
    { name: 'google', label: 'Continue with Google' },
    { name: 'magic', mode: 'otp', label: 'Email for Magic Link' }
  ],
  routes: {
    auth: '(public)/auth',
    logout: '/logout'
  },
  rules: [
    { path: '/', public: true },
    { path: '/dashboard', roles: ['user', 'admin'] },
    { path: '/admin', roles: ['admin'] }
  ]
}

3. Set Up Hooks

Add authentication to your src/hooks.server.js:

import { kavach } from '$kavach/auth'

export const handle = kavach.handle

4. Use Components

Add authentication UI to your app:

import { AuthPage } from '@kavach/ui'

<AuthPage />

Next Steps

Kavach — Authentication made simple llms.txt