A powerful web application for analyzing Backpack Brawl combat logs, providing detailed insights into player performance, item usage, and combat statistics. Built with Next.js, TypeScript, Cloudflare D1, and AG Charts.
- π Real-time Combat Analysis - Parse and analyze combat logs instantly
- π Interactive Charts - Visualize damage over time, player comparisons, and item usage with AG Charts
- πΎ D1 Database Storage - Persist combat sessions in Cloudflare D1 for historical analysis
- β‘ Edge Computing - Deploy to Cloudflare Workers for global low-latency access
- π¨ Modern UI - Beautiful, responsive interface with dark mode support
- π± Mobile-Friendly - Works seamlessly on all devices
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
- Charts: AG Charts React
- Database: Cloudflare D1 (SQLite) with Drizzle ORM
- ORM: Drizzle ORM for type-safe database access
- Deployment: Cloudflare Workers via OpenNext
- Package Manager: pnpm
- Node.js 18+
- pnpm 10+
- Cloudflare account
- Wrangler CLI
pnpm installCreate a D1 database:
pnpm wrangler d1 create combat-logs-dbCopy the database ID from the output and update wrangler.jsonc:
Using Drizzle ORM migrations:
pnpm db:migrateFor local development:
pnpm db:migrate:localNote: Migrations are auto-generated from the schema using pnpm db:generate
Generate Cloudflare environment types:
pnpm cf-typegenStart the development server:
pnpm devOpen http://localhost:3000 in your browser.
Build the application:
pnpm buildPreview the production build locally:
pnpm previewpnpm deployThis will:
- Build your Next.js application
- Optimize it for Cloudflare Workers using OpenNext
- Deploy to Cloudflare's global network
- Paste Combat Log: Copy your combat log from Backpack Brawl and paste it into the text area
- Load Sample: Click "Load Sample 1" or "Load Sample 2" to see example analysis
- Analyze: Click "Analyze Combat Log" to process the log
- View Results: Explore the charts, statistics, and detailed breakdowns
βββ src/
β βββ app/
β β βββ api/
β β β βββ analyze/ # Combat log analysis API (Drizzle ORM)
β β β βββ sessions/ # Session history API (Drizzle ORM)
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Main page
β βββ components/
β β βββ DamageChart.tsx # Damage over time chart
β β βββ PlayerStatsChart.tsx # Player comparison chart
β β βββ ItemUsageChart.tsx # Item usage chart
β β βββ StatsTable.tsx # Detailed statistics table
β β βββ LogInput.tsx # Log input form
β βββ db/
β β βββ schema.ts # Drizzle ORM schema
β β βββ index.ts # Database initialization
β βββ lib/
β β βββ logParser.ts # Combat log parser utility
β βββ types/
β βββ combat.ts # TypeScript type definitions
βββ drizzle/
β βββ migrations/ # Auto-generated SQL migrations
βββ public/
β βββ sample_log1.txt # Sample combat log 1
β βββ sample_log2.txt # Sample combat log 2
βββ drizzle.config.ts # Drizzle Kit configuration
βββ wrangler.jsonc # Cloudflare Workers configuration
βββ open-next.config.ts # OpenNext configuration
βββ package.json # Dependencies and scripts
The application uses Drizzle ORM with four main tables:
- combat_sessions - Store session metadata
- combat_events - Store individual combat events
- player_stats - Store aggregated player statistics
- item_usage - Store item usage statistics per player
See src/db/schema.ts for the Drizzle schema definition.
β
Type-safe queries with full TypeScript support
β
Auto-generated migrations from schema
β
Batch insert operations for performance
β
Built-in indexes for optimized queries
β
Drizzle Studio for visual database exploration
See DRIZZLE_SETUP.md for detailed ORM usage.
Analyze a combat log and return detailed insights.
Request:
{
"logText": "0.0s\tGuest 72981\tDanger Candle gained +33% speed\n..."
}Response:
{
"session": { ... },
"playerStats": [ ... ],
"itemUsage": [ ... ],
"timeline": [ ... ]
}Retrieve recent combat sessions.
Response:
{
"sessions": [
{
"sessionId": "session_...",
"playerNames": ["Player1", "Player2"],
"totalDuration": 13.3,
"totalEvents": 105,
"createdAt": "2025-10-02T12:00:00.000Z"
}
]
}pnpm dev- Start development server with Turbopackpnpm build- Build the Next.js applicationpnpm start- Start production server (for testing)pnpm lint- Run ESLint
pnpm deploy- Build and deploy to Cloudflare Workerspnpm preview- Build and preview locally with Wranglerpnpm cf-typegen- Generate Cloudflare environment types
pnpm db:generate- Generate migrations from schemapnpm db:migrate- Apply migrations to productionpnpm db:migrate:local- Apply migrations to local databasepnpm db:studio- Open Drizzle Studio (visual database browser)
For local development, create a .dev.vars file:
# Add any environment variables here if needed
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
This project is not affiliated with, endorsed by, or sponsored by Rapidfire Games or Azur Games. Backpack Brawl is a trademark and property of Rapidfire Games and Azur Games. This tool is an independent fan-made project created for educational and analytical purposes.
- Backpack Brawl - The game (Google Play | App Store)
- Next.js - React framework
- AG Charts - Charting library
- Cloudflare Workers - Edge computing platform
- OpenNext - Next.js adapter for Cloudflare