JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 22
  • Score
    100M100P100Q54617F
  • License MIT

AI-Powered Solo D&D 5e — full campaign engine with combat, spells, dice, and multiple AI providers

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

    1. Clone and install dependencies:

      cd dndsolo-clean
      npm install
    2. Set up environment variables:

      cp .env.example .env.local

      Edit .env.local with your database URL and optionally your OpenAI API key.

    3. Set up the database:

      # Create the database
      createdb dndsolo
      
      # Run the app and hit the "Setup DB" button, or:
      npm run db:setup
    4. Start the development server:

      npm run dev
    5. Open http://localhost:3000

    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 types

    Configuration

    Database

    The app expects a PostgreSQL database. Set the connection string in .env.local:

    DATABASE_URL=postgresql://username@localhost:5432/dndsolo

    OpenAI API

    You can either:

    1. Set OPENAI_API_KEY in .env.local (server-side)
    2. 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

    1. Create a Campaign - Give it a name, description, and world setting
    2. Add Characters - Create characters manually or import from D&D Beyond
    3. Configure Settings - Set difficulty, rules, and DM personality
    4. 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