diff --git a/README.md b/README.md index f62e5a4..024d12d 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,14 @@ An admin dashboard for Wireguard — manage hosts, clients, tunnels, and IP rule - **Client Rules** — Define IP table rules per client (rule type, destination, ports, protocol) - **Media Management** — Upload and manage media assets (images, documents, etc.) with tagging, thumbnails, and RAG ingestion - **User Management** — Multi-user support with role-based access (user types) -- **Persistent Storage** — MariaDB-backed database with automatic schema generation +- **Persistent Storage** — SQLite database with automatic schema generation - **WebSocket Support** — Real-time updates via WebSocket connections - **Responsive UI** — Tailwind CSS v4 with twui design system components ## Prerequisites - **Bun** 1.3.1 or later ([install](https://bun.sh/install)) -- **MariaDB** (or compatible SQL database) +- **SQLite** (via `@moduletrace/bun-sqlite`) - **git** - **Linux** (Debian, Ubuntu, Fedora, Arch, Alpine, or similar) - Root access (for installation script and system service setup) @@ -83,12 +83,12 @@ The dev server runs on port **10752** by default. The `.env` file (gitignored) controls runtime behavior. It is auto-generated during installation if missing: -| Variable | Description | Default | -| ------------------- | ------------------------------------ | -------------------- | -| `NODE_ENV` | Environment (`development`/`production`) | `production` | -| `ENCRYPTION_KEY` | Encryption key for sensitive data | Auto-generated | -| `ENCRYPTION_SALT` | Encryption salt for sensitive data | Auto-generated | -| `DATA_DIR` | Application data directory | `$INSTALL_DIR/.data` | +| Variable | Description | Default | +| ----------------- | ---------------------------------------- | -------------------- | +| `NODE_ENV` | Environment (`development`/`production`) | `production` | +| `ENCRYPTION_KEY` | Encryption key for sensitive data | Auto-generated | +| `ENCRYPTION_SALT` | Encryption salt for sensitive data | Auto-generated | +| `DATA_DIR` | Application data directory | `$INSTALL_DIR/.data` | ### Database Configuration @@ -96,10 +96,10 @@ Edit `bun-sqlite.config.ts` to change database settings: ```typescript const config: BunSQLiteConfig = { - db_name: "wgui", // Database file name - db_dir: "./db", // Database directory - typedef_file_path: "./db/types/db.ts", // Generated types - db_schema_file_name: "schema.ts", // Schema definition + db_name: "wgui", // Database file name + db_dir: "./db", // Database directory + typedef_file_path: "./db/types/db.ts", // Generated types + db_schema_file_name: "schema.ts", // Schema definition }; ``` @@ -116,16 +116,12 @@ export const SiteData = { ## Available Scripts -| Command | Description | -| ------------------- | ------------------------------------------------ | -| `bun run dev` | Start development server (requires root) | -| `bun run start` | Start production server | -| `bun run build` | Build with bunext | -| `bun run db:schema` | Generate/update database schema and types | -| `bun run db:admin` | Open database admin interface | -| `bun run deploy:prod` | Deploy to production server | -| `bunx tsc --noEmit` | Type-check only (no emit) | -| `bun test ` | Run individual test files | +| Command | Description | +| ------------------- | ----------------------------------------- | +| `bun run dev` | Start development server (requires root) | +| `bun run start` | Start production server | +| `bun run db:schema` | Generate/update database schema and types | +| `bun run db:admin` | Open database admin interface | ## Project Structure @@ -175,16 +171,16 @@ wireguard-ui/ The database consists of the following tables: -| Table | Description | -| ---------------- | ---------------------------------------------- | -| `users` | User accounts (name, email, username, password) | -| `user_types` | User type assignments per user | -| `media` | Media assets (images, documents, etc.) | -| `media_paradigms`| Media paradigm classifications per media item | -| `clients` | WireGuard clients per host | -| `hosts` | WireGuard host configurations | -| `client_rules` | IP table rules for each client | -| `variables` | Application-wide key-value variables | +| Table | Description | +| ----------------- | ----------------------------------------------- | +| `users` | User accounts (name, email, username, password) | +| `user_types` | User type assignments per user | +| `media` | Media assets (images, documents, etc.) | +| `media_paradigms` | Media paradigm classifications per media item | +| `clients` | WireGuard clients per host | +| `hosts` | WireGuard host configurations | +| `client_rules` | IP table rules for each client | +| `variables` | Application-wide key-value variables | Generate types from the schema: @@ -209,7 +205,7 @@ This will: ### Docker Production -The Docker image (`Dockerfile`) is based on `oven/bun:1.3.1-debian` with MariaDB client tools installed: +The Docker image (`Dockerfile`) is based on `oven/bun:1.3.1-debian`: ```bash docker build -t bunext-mariadb . @@ -224,11 +220,11 @@ The server runs on the port defined in `SiteData.ServerPort` (default: **10752** ## Admin Route Hierarchy -| Route Pattern | Access | Features | -| ------------------- | ----------------------------- | ------------------------------------------- | -| `/admin/*` | Residents | Access booking, payments, chat, dependants, notifications, events, settings, support | -| `/admin/admin/*` | Admin / ExCo | User management, payment schemes, documents, chat group management | -| `/admin/security/*` | Security / ExCo / Manager / ACo | Gate control, guest access monitoring, dependant verification | +| Route Pattern | Access | Features | +| ------------------- | ------------------------------- | ------------------------------------------------------------------------------------ | +| `/admin/*` | Residents | Access booking, payments, chat, dependants, notifications, events, settings, support | +| `/admin/admin/*` | Admin / ExCo | User management, payment schemes, documents, chat group management | +| `/admin/security/*` | Security / ExCo / Manager / ACo | Gate control, guest access monitoring, dependant verification | ## Development diff --git a/package.json b/package.json index 1ef864d..54680bb 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "build": "bunx bunext build", "db:schema": "bunx bun-sqlite schema -t", "db:admin": "bunx bun-sqlite admin", - "deploy:prod": "./deploy/deploy-prod.sh", "start": "NODE_ENV=production bun src/server.ts" }, "devDependencies": {