Initial commit: Visigine (Vite client + Express/SQLite backend)

Container-ready via docker/ compose (frontend nginx + backend Node). Compose adjusted for Coolify on the prod server: frontend uses expose:80 (no host binding — host 8080 is taken by the Coolify proxy; Traefik routes visigine.de), backend ALLOWED_ORIGINS=https://visigine.de. Secrets stay in server/.env (git-ignored); see server/.env.example.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 10:06:48 +02:00
commit e344f1b7e7
88 changed files with 11764 additions and 0 deletions

21
server/db/index.js Normal file
View File

@@ -0,0 +1,21 @@
// Synchronous SQLite initialization. On startup ensure the data directory
// exists, open the DB, and run schema.sql (idempotent CREATE IF NOT EXISTS).
import Database from 'better-sqlite3'
import { readFileSync, mkdirSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const here = dirname(fileURLToPath(import.meta.url))
const defaultPath = resolve(here, '..', 'data', 'visigine.db')
const dbPath = process.env.DB_PATH ? resolve(process.env.DB_PATH) : defaultPath
mkdirSync(dirname(dbPath), { recursive: true })
export const db = new Database(dbPath)
db.pragma('journal_mode = WAL') // better concurrent reads
db.pragma('foreign_keys = ON') // enforce ON DELETE CASCADE
const schema = readFileSync(new URL('./schema.sql', import.meta.url), 'utf8')
db.exec(schema)
console.log(`[db] opened ${dbPath}`)