This project demonstrates a basic Todo list application built with SvelteKit, using the libsql-client directly to interact with a local SQLite database file (todos.db).
It serves as a minimal example of performing common database operations:
INSERT).SELECT).UPDATE).DELETE).cd path/to/your-project-directory
npm install
npm run dev
http://localhost:5173 (or the specified port) in your browser.The application will automatically create the todos.db SQLite database file in the project's root directory and set up the necessary todos table the first time the server starts, thanks to the initialization logic.
src/lib/server/db/index.ts:libsql-client (db).url (e.g., "file:./todos.db") for the database connection.initializeDb function that runs on server start to execute the CREATE TABLE IF NOT EXISTS statement.src/routes/+page.server.ts:load function fetches todos (SELECT) using db.execute.actions object contains functions (addTodo, toggleTodo, deleteTodo) that perform INSERT, UPDATE, and DELETE operations using db.execute based on form submissions.src/routes/+page.svelte:+page.server.ts to trigger database operations.