A modern task management application built with SvelteKit 2 and Convex, featuring real-time data synchronization and comprehensive test coverage.
svelte-convex/
├── e2e/ # End-to-end tests
│ └── tasks-page.test.ts # E2E tests for tasks page (10 tests)
├── src/
│ ├── convex/ # Convex backend functions
│ │ ├── _generated/ # Auto-generated Convex types
│ │ ├── tasks.ts # Tasks query endpoint
│ │ └── tasks.spec.ts # Unit tests for tasks API (6 tests)
│ ├── lib/ # Shared library code
│ │ ├── assets/ # Static assets
│ │ └── index.ts # Library exports
│ ├── routes/ # SvelteKit routes
│ │ ├── +layout.svelte # Root layout (Convex setup)
│ │ ├── +page.svelte # Home page (tasks list)
│ │ └── page.svelte.spec.ts # Component unit tests (4 tests)
│ ├── app.d.ts # App type definitions
│ ├── app.html # HTML template
│ └── demo.spec.ts # Demo unit test
├── static/ # Static files
│ └── robots.txt
├── convex.json # Convex configuration
├── sampleData.jsonl # Sample task data for seeding
├── svelte.config.js # SvelteKit configuration
├── vite.config.ts # Vite & Vitest configuration
├── playwright.config.ts # Playwright configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project dependencies
git clone <repository-url>
cd svelte-convex
npm install
# or
pnpm install
npx convex dev
This will create a .env.local file with your PUBLIC_CONVEX_URL.
npx convex import --table tasks sampleData.jsonl
Start the development server:
npm run dev
# or start and open in browser
npm run dev -- --open
The app will be available at http://localhost:5173
npm run dev - Start Vite dev servernpx convex dev - Start Convex backend in dev modenpm run build - Build for productionnpm run preview - Preview production buildnpm run check - Run svelte-check with TypeScriptnpm run lint - Run Prettier check + ESLintnpm run format - Auto-format with Prettiernpm test - Run all tests (unit + e2e)npm run test:unit - Run Vitest unit testsnpm run test:unit -- src/convex/tasks.spec.ts - Run specific test filenpm run test:e2e - Run Playwright e2e testsTotal: 21 tests (100% passing)
Tasks API (src/convex/tasks.spec.ts): 6 tests
Page Component (src/routes/page.svelte.spec.ts): 4 tests
Demo (src/demo.spec.ts): 1 test
Located in e2e/tasks-page.test.ts:
# Run all tests
npm test
# Run unit tests in watch mode
npm run test:unit
# Run e2e tests with UI
npx playwright test --ui
# Run specific e2e test
npx playwright test -g "should display the page title"
api.tasks.getFetches all tasks from the database and adds an assigner field to each task.
Returns:
Array<{
_id: string;
text: string;
isCompleted: boolean;
assigner: string;
_creationTime: number;
}>;
Example Usage:
import { useQuery } from 'convex-svelte';
import { api } from '../convex/_generated/api';
const query = useQuery(api.tasks.get, {});
// query.data contains the tasks array
// query.isLoading indicates loading state
// query.error contains any error
anyCreate a .env.local file with:
PUBLIC_CONVEX_URL=https://your-deployment.convex.cloud
This is automatically created when you run npx convex dev.
npm run build
# Deploy the .svelte-kit/output directory
npx convex deploy
You may need to install a SvelteKit adapter for your target environment.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')npm test)git push origin feature/amazing-feature)This project is open source and available under the MIT License.