Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (infinite-realms) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Solo D&D Adventure
AI-powered solo Dungeons & Dragons 5th Edition experience.
Features
- AI Dungeon Master - GPT-4 powered DM with tool-calling for game mechanics
- Character Management - Create and manage D&D 5e characters
- D&D Beyond Sync - Import and sync characters from D&D Beyond
- Combat System - Initiative tracking, HP management, turn order
- Quest & NPC Tracking - Automatic tracking of encountered NPCs and quests
- Scene Image Generation - DALL-E 3 generated scene images
- Text-to-Speech - Browser-based voice narration for DM responses
- Rules Enforcement - Configurable RAW enforcement levels
Tech Stack
- Framework: Next.js 15 (App Router)
- Frontend: React 19, Tailwind CSS, Radix UI
- AI: OpenAI GPT-4o, DALL-E 3 (via Vercel AI SDK)
- Database: PostgreSQL
- Language: TypeScript
Getting Started
Prerequisites
- Node.js 18+
- PostgreSQL 15+
- OpenAI API key
Installation
Clone and install dependencies:
cd dndsolo-clean npm install
Set up environment variables:
cp .env.example .env.localEdit
.env.localwith your database URL and optionally your OpenAI API key.Set up the database:
# Create the database createdb dndsolo # Run the app and hit the "Setup DB" button, or: npm run db:setup
Start the development server:
npm run dev
Project Structure
dndsolo-clean/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ ├── campaigns/ # Campaign CRUD
│ │ ├── characters/ # Character CRUD
│ │ ├── chat/ # AI DM streaming
│ │ ├── game-state/ # Game state management
│ │ └── scene-image/ # Image generation
│ ├── game/ # Main game page
│ ├── setup/ # Campaign/character setup
│ └── page.tsx # Home/campaign list
├── components/
│ ├── ui/ # shadcn/ui components
│ ├── dm-chat.tsx # Chat interface
│ ├── character-sheet.tsx
│ └── game-state-panel.tsx
├── lib/
│ ├── dm-engine/ # AI DM with tools
│ ├── services/ # Database services
│ ├── db.ts # PostgreSQL connection
│ └── utils.ts # Dice rolling, formatters
├── hooks/
│ └── use-tts.ts # Text-to-speech hook
└── types/
└── index.ts # TypeScript typesConfiguration
Database
The app expects a PostgreSQL database. Set the connection string in .env.local:
DATABASE_URL=postgresql://username@localhost:5432/dndsoloOpenAI API
You can either:
- Set
OPENAI_API_KEYin.env.local(server-side) - Enter your API key in the app's Settings page (stored in localStorage)
Game Settings
Each campaign can be configured with:
- Difficulty: Easy, Normal, Hard, Deadly
- Rules Enforcement: Strict (RAW), Moderate, Loose (Rule of Cool)
- DM Personality: Customize the AI's narration style
Usage
- Create a Campaign - Give it a name, description, and world setting
- Add Characters - Create characters manually or import from D&D Beyond
- Configure Settings - Set difficulty, rules, and DM personality
- Play! - Chat with the AI DM to play your adventure
DM Commands
The AI DM automatically uses tools for:
- Rolling dice
- Tracking NPCs and quests
- Managing inventory and gold
- Running combat encounters
- Updating scene descriptions
- Flagging rule violations
License
MIT