A modern Vue.js application demonstrating how to use SQLite in the browser through WebAssembly. This project showcases building offline-capable applications with a real SQL database running entirely in the browser.
- 🗄️ Full SQLite database in the browser via WebAssembly
- 🚀 Vue 3.5 with Composition API
- ⚡️ Vite 5 for development
- 🎯 TypeScript 5.6 for type safety
- 💾 Persistent storage using Origin Private File System (OPFS)
- 🧵 Background processing with Web Workers
- 🎨 TailwindCSS 3 for styling
- SQLite Wasm: SQLite compiled to WebAssembly for browser execution
- Web Workers: Background thread for database operations
- OPFS: Persistent storage for database files
- @sqlite.org/sqlite-wasm: Official SQLite WebAssembly package
- Node.js (version 20.x or higher)
- Modern browser with WebAssembly and OPFS support
- npm (comes with Node.js)
-
Clone the repository:
git clone https://github.com/your-username/vue-sqlite-playground.git cd vue-sqlite-playground
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser and visit
http://localhost:5173
- Create and manage SQLite databases in the browser
- Execute SQL queries directly in the UI
- View query results in real-time
- Persistent storage across browser sessions
- Example CRUD operations
npm run dev
- Start development servernpm run build
- Build for productionnpm run preview
- Preview production buildnpm run lint
- Lint and fix filesnpm run type-check
- Check TypeScript types
This application requires a modern browser with support for:
- WebAssembly
- Web Workers
- Origin Private File System (OPFS)
- SharedArrayBuffer
The SQLite database is configured with a sample table structure:
CREATE TABLE IF NOT EXISTS test_table (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature
- Commit changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/your-feature
- Submit a pull request
For a detailed explanation of how this works, check out our blog post about implementing SQLite in Vue 3 applications.