feat: initial brainstorming app — Nuxt 3 + SQLite + admin auth

Nuxt 3 app with:
- SQLite (better-sqlite3) for persistence
- Anonymous idea submission and voting
- Admin auth with session cookies
- AI analysis via Gemini API
- Nuxt UI components + Tailwind

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alejandro Martinez
2026-04-07 14:15:45 +02:00
commit e7de636cf2
25 changed files with 9114 additions and 0 deletions

39
server/utils/db.ts Normal file
View File

@@ -0,0 +1,39 @@
import Database from 'better-sqlite3'
import { mkdirSync } from 'fs'
import { dirname } from 'path'
const config = useRuntimeConfig()
const dbPath = config.dbPath as string
mkdirSync(dirname(dbPath), { recursive: true })
const db = new Database(dbPath)
db.pragma('journal_mode = WAL')
db.pragma('foreign_keys = ON')
db.exec(`
CREATE TABLE IF NOT EXISTS ideas (
id INTEGER PRIMARY KEY AUTOINCREMENT,
text TEXT NOT NULL,
category TEXT NOT NULL DEFAULT 'General',
votes INTEGER NOT NULL DEFAULT 0,
hidden INTEGER NOT NULL DEFAULT 0,
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE TABLE IF NOT EXISTS vote_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
idea_id INTEGER NOT NULL REFERENCES ideas(id) ON DELETE CASCADE,
voter_hash TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT (datetime('now')),
UNIQUE(idea_id, voter_hash)
);
CREATE TABLE IF NOT EXISTS sessions (
token TEXT PRIMARY KEY,
created_at TEXT NOT NULL DEFAULT (datetime('now')),
expires_at TEXT NOT NULL
);
`)
export default db