# database — Serverless SQLite Editor

**A Free Open Tools application.**

Build, edit, query, and export SQLite databases entirely in your browser. No server, no sign-up, no tracking — nothing leaves your machine.

## How It Works

This is a fully client-side web application powered by [sql.js](https://sql.js.org/) — SQLite compiled to JavaScript via WebAssembly. Everything runs in your browser.

## Features

- **Schema Designer** — Create tables, add/remove columns with types (INTEGER, TEXT, REAL, BLOB, etc.), set primary keys, NOT NULL constraints, and defaults
- **Relationship Builder** — Define foreign keys between tables with a visual editor
- **Data Editor** — View and edit data in an inline editable grid
- **SQL Console** — Run arbitrary SQL queries with results displayed in a table
- **Import/Export** — Open existing `.sqlite`/`.db` files; export as `.sqlite` (binary) or `.sql` (SQL dump)
- **Auto-save** — Session is saved to localStorage every 10 seconds, restored on page load
- **Dark/Light Mode** — Ecosystem theme toggle with system preference detection
- **Drag-and-drop** — Drop `.sqlite` files anywhere onto the app

## Usage

1. Open `index.html` in a browser (or visit the deployed site)
2. Click **New** to create a fresh database, or **Import** to open an existing `.sqlite` file
3. Click **Table** to create your first table
4. Use the **Schema** tab to add columns and foreign keys
5. Use the **Data** tab to insert and edit rows
6. Use the **SQL** tab for custom queries
7. Click the **Export** button (blue, right side of toolbar) to download

### The exported `.sqlite` file is a standard SQLite database

It can be opened with:
- Any SQLite client (DB Browser for SQLite, SQLite CLI)
- Python (`sqlite3` module)
- Node.js (`better-sqlite3`, `sql.js`)
- Any programming language with SQLite bindings

## Technical Notes

- sql.js is loaded from CDN: `https://cdn.jsdelivr.net/npm/sql.js@1.11.0/dist/sql-wasm.js`
- An internet connection is required only on first load (to fetch sql.js + WASM)
- After loading, everything runs offline
- All data stays in your browser's memory and localStorage
- This tool follows the [Free Open Tools Style Guide](https://github.com/your-org/freeopentools) conventions

## About This Project

This tool is part of the **Free Open Tools** suite — a collection of zero-cost, open-source, serverless web utilities. Each tool is a single-page application with no dependencies, no build step, and no tracking.

## License

MIT# database
