š® AI-Powered Dungeon Adventure
A full-stack, cloud-native demo application showcasing modern AWS architecture, AI integration, and type-safe development practices.
Overview
This project demonstrates the integration of cutting-edge technologies to build a complete, production-ready application. It features AI-generated storytelling, real-time inventory management, and a fully serverless architecture deployed on AWS.
Live Demo: https://d5v0i8bfb0kz7.cloudfront.net/
š Key Features
AI-Powered Storytelling
- Dynamic Narrative Generation: Uses AWS Bedrock with Strands Agents to create unique dungeon stories
- Context-Aware Responses: AI adapts to player choices and inventory state
Model Context Protocol (MCP) Integration
- Natural AI Interaction: MCP server enables AI to query and modify game inventory seamlessly
- Real-time Database Access: AI agents interact with DynamoDB through standardized protocol
Type-Safe API Layer
- tRPC Implementation: Full end-to-end type safety between frontend and backend
- Zero Code Generation: Instant autocomplete and type-checking for all API calls
- Auto-mapped Lambda Functions: Each tRPC route automatically becomes an AWS Lambda function
Modern Frontend
- React 19: Latest React features with concurrent rendering
- TanStack Router & Query: Type-safe routing and efficient data fetching
- AWS Cloudscape Design: Professional UI components following AWS design patterns
- Cognito Authentication: Secure user authentication and authorization
šļø Architecture
This monorepo is organized into specialized packages:
packages/
āāā game-ui/ # React frontend with TanStack Router
āāā game-api/ # tRPC API layer with Lambda integration
āāā story/ # Python Strands Agent for AI storytelling
āāā inventory/ # TypeScript MCP Server for inventory management
āāā infra/ # AWS CDK infrastructure as code
āāā common/ # Shared types and utilities
Technology Stack
Frontend
- React 19
- TypeScript
- TanStack Router & Query
- AWS Cloudscape Design System
- Vite
Backend
- tRPC for type-safe APIs
- AWS Lambda (serverless functions)
- DynamoDB (NoSQL database)
- AWS Cognito (authentication)
AI & Agents
- AWS Bedrock (AI foundation models)
- Python Strands Agent (story generation)
- TypeScript MCP Server (inventory context)
Infrastructure
- AWS CDK (Infrastructure as Code)
- CloudFront (CDN)
- S3 (static hosting)
- API Gateway
Development Tools
- Nx (monorepo management)
- TypeScript
- ESLint & Prettier
- Vitest (testing)
š Getting Started
Prerequisites
- Node.js 22.12.0
- pnpm
- AWS CLI configured
- Python 3.x with uv
Installation
# Install dependencies
pnpm install
# Install Python dependencies
uv sync
Development
# Run the frontend dev server
pnpm exec nx serve @dungeon-adventure/game-ui
# Build all projects
pnpm exec nx run-many --target build --all
# Run tests
pnpm exec nx run-many --target test --all
Deployment
# Deploy infrastructure
pnpm exec nx deploy @dungeon-adventure/infra
# Load runtime configuration
pnpm exec nx run @dungeon-adventure/game-ui:load:runtime-config
š¦ Package Details
game-ui
React-based frontend with Cognito authentication, TanStack Router for navigation, and AWS Cloudscape components for a polished user experience.
game-api
tRPC API providing type-safe endpoints that automatically map to AWS Lambda functions. Includes integration with DynamoDB for persistent storage.
story
Python-based Strands Agent that generates dynamic dungeon narratives using AWS Bedrock. Responds to player actions with contextually appropriate story elements.
inventory
TypeScript MCP Server enabling AI agents to query and modify player inventory through a standardized protocol, bridging the gap between AI and application state.
infra
AWS CDK application defining the complete cloud infrastructure including Lambda functions, DynamoDB tables, CloudFront distribution, S3 buckets, and Cognito user pools.
šÆ What This Demo Showcases
- Full-Stack Type Safety: End-to-end TypeScript with tRPC eliminates API contract mismatches
- AI Integration Patterns: Real-world implementation of AI agents in production applications
- Serverless Architecture: Cost-effective, scalable infrastructure using AWS managed services
- Modern DevOps: Nx monorepo with efficient build caching and task orchestration
- Infrastructure as Code: Complete AWS environment defined in CDK with TypeScript
- Model Context Protocol: Cutting-edge AI context management for intelligent applications
š Learning Resources
This project was built following the AWS Nx Plugin tutorial:
š ļø Development Commands
# Build a specific project
pnpm exec nx build <project-name>
# Run lint with auto-fix
pnpm exec nx run-many --target lint --configuration=fix --all
# Update test snapshots
pnpm exec nx run-many --target test --all --update
# Sync TypeScript project references
pnpm exec nx sync
š License
MIT
Built with: AWS, React, TypeScript, Python, Nx, and ā