Stop flipping through rulebooks. Get the ruling in seconds.
RulesGenie is an AI-powered board game rules assistant that answers natural-language questions with citation-backed answers. It supports 35 popular board games out of the box, works entirely in demo mode without any API keys, and optionally integrates with OpenAI for production-grade responses.
- π€ Rules Q&A β Chat-style answers with game-aware session memory and source citations
- π Game Library β Search and filter a curated catalog of popular board games
- β‘ Quick-Start Mode β Compressed rules summaries and setup guides for faster teaches
- π Saved Answers β Bookmark answers and revisit them on your personal dashboard
- π― Demo Mode β Works fully without API keys using intelligent keyword-scored mock responses
- π‘οΈ Confidence Scoring β Every answer includes a confidence level and citation status
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Next.js App Router β
β ββββββββββββ ββββββββββββ βββββββββββββββββ β
β β Pages β β API β β Middleware β β
β β (RSC + β β Routes β β (CSRF guard) β β
β β Client) β β β β β β
β ββββββ¬ββββββ ββββββ¬ββββββ βββββββββββββββββ β
β β β β
β ββββββ΄βββββββββββββββ΄ββββββ β
β β src/lib/ β β
β β βββββββ ββββββββββ β β
β β β AI β β DB β β β
β β βmock β β SQLite β β β
β β β+GPT β β(better β β β
β β β β βsqlite3)β β β
β β βββββββ ββββββββββ β β
β βββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
Get running in under 2 minutes:
# 1. Clone and install
git clone <repo-url> && cd rulesgenie
npm install
# 2. (Optional) Configure environment
cp .env.example .env
# 3. Start development server
npm run devOpen http://localhost:3000 β the app works immediately in demo mode.
π‘ Tip: Try asking "Can I draw a face-up locomotive first?" on the Ask page to see citations and confidence scoring in action.
| Variable | Default | Description |
|---|---|---|
RULESGENIE_DEMO_MODE |
true |
Keep the app in mock mode with scripted answers |
OPENAI_API_KEY |
β | Your OpenAI API key for live AI responses |
OPENAI_MODEL |
gpt-4o-mini |
Override the default OpenAI model |
RULESGENIE_DB_PATH |
./rulesgenie.db |
Override the SQLite database location |
If no API key is present, the app automatically falls back to demo mode. No configuration required to get started.
The app stores data in SQLite. By default it uses ./rulesgenie.db, and you can override that path with RULESGENIE_DB_PATH. The production Docker image points that variable at /app/data/rulesgenie.db so data can live on a mounted volume. It stores:
- Supported game metadata (35 games in development)
- Development user personas, collections, bookmarks, sessions, and feedback
- Chat history by session
- Saved answers / bookmarks
- Answer feedback (thumbs up/down)
src/
βββ app/ # Next.js App Router pages & API routes
β βββ api/ # REST endpoints (ask, bookmarks, collection, feedback, session)
β βββ ask/ # Rules Q&A chat page
β βββ dashboard/ # Personal dashboard
β βββ games/ # Game library + detail pages
β βββ quick-start/ # Quick-start explorer
βββ components/ # React components (client + server)
β βββ hooks/ # Custom React hooks (useConversation, useRulesSession)
βββ data/ # Static game data and mock Q&A entries
βββ lib/ # Core business logic
β βββ ai/ # AI engine (mock + OpenAI)
β βββ db/ # Database layer (SQLite via better-sqlite3)
βββ types/ # TypeScript type definitions
| Layer | Technology |
|---|---|
| Framework | Next.js 15 (App Router) |
| Language | TypeScript 5.8 (strict mode) |
| UI | React 19 + Tailwind CSS 3 |
| Database | SQLite via better-sqlite3 |
| AI | OpenAI API (optional) |
| Validation | Zod on all API routes |
| Icons | Lucide React |
| Command | Description |
|---|---|
npm run dev |
Start the development server |
npm run build |
Create a production build |
npm run start |
Run the production server |
npm run lint |
Run ESLint |
npm run typecheck |
Run TypeScript type checking |
npm run format |
Format code with Prettier |
npm run format:check |
Check formatting without modifying files |
npm run validate |
Run all checks (lint + typecheck + format + build) |
npm run clean |
Remove build artifacts |
In non-production environments, RulesGenie reseeds SQLite automatically on startup with a deterministic development dataset.
- 35 board games covering gateway, euro, co-op, party, and heavyweight titles
- 3 user personas: a power user (
demo-user), a casual player, and a brand-new account - 124 seeded Q&A rows sourced from a 100+ entry rules bank with realistic citations, bookmarks, collections, and feedback
- Multiple conversation sessions with short and long histories, plus edge cases like unicode names, long questions, null optionals, and varied confidence values
- Production-safe behavior: the development seed routine is skipped entirely when
NODE_ENV=production
If you want a fresh development dataset, stop the app, delete rulesgenie.db, and start npm run dev again.
Contributions are welcome! Please read our Contributing Guide for details on how to get started.
Build and run the production container:
docker build -t rulesgenie .
docker run -p 3000:3000 -v rulesgenie-data:/app/data rulesgenieThe container runs a standalone Next.js server with minimal footprint (~150 MB) and persists SQLite data in /app/data.
This project is licensed under the MIT License β see the LICENSE file for details.
RulesGenie Β· Built for fast mid-game rulings π²