Thank you for your interest in contributing! This guide will help you get set up for development and testing.
- Node.js 22+
- pnpm
- A Convex account (free tier works)
git clone https://github.com/mmailaender/convex-better-auth-svelte.git
cd convex-better-auth-svelte
pnpm installCreate a new Convex project or use an existing one:
npx convex devThis will prompt you to create a new project or link to an existing one.
pnpm run devThis starts both the Vite dev server and Convex in watch mode.
pnpm run test:unitE2E tests require a test user in your Convex database.
Make sure your dev server is running, then:
pnpm run setup:test-userThis creates a user with the credentials from .env.test in your Convex database.
First time only:
pnpm exec playwright installpnpm run test:e2eOr run with UI:
pnpm run test:e2e:uiThe E2E tests cover these authentication scenarios:
| Scenario | Description |
|---|---|
| SSR Authenticated | User is authenticated via SSR, sees content immediately |
| SSR → Sign Out | Authenticated user signs out |
| Client-only Auth | User signs in without SSR state |
| Protected Queries | Queries that require authentication |
├── src/
│ ├── lib/
│ │ ├── svelte/ # Client-side auth integration
│ │ │ ├── client.svelte.ts
│ │ │ └── index.ts
│ │ └── sveltekit/ # Server-side helpers
│ │ └── index.ts
│ └── routes/
│ ├── +layout.svelte # Root layout (CSS, nav)
│ ├── +page.svelte # Landing page
│ ├── dev/ # Development playground
│ │ ├── +layout.svelte
│ │ └── +page.svelte # Full auth demo
│ └── test/ # E2E test routes
│ ├── ssr/ # SSR auth tests
│ ├── client-only/ # Client-only auth tests
│ └── queries/ # Query behavior tests
├── e2e/ # E2E tests (Playwright)
├── scripts/ # Development scripts
└── convex/ # Convex backend
| Route | Purpose |
|---|---|
/ |
Landing page with links |
/dev |
Development playground with full auth demo |
/test/ssr |
SSR authentication test page |
/test/client-only |
Client-only authentication test page |
/test/queries |
Public/protected query behavior test page |
- We use Prettier for formatting
- Run
pnpm run formatbefore committing - Run
pnpm run lintto check for issues
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
pnpm test:e2e) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Feel free to open an issue if you have questions or run into problems!