This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Webditor is a StarCraft Remastered usemap editor built as a full-stack web application. It functions as both an editor and game engine for creating and managing StarCraft maps through a modern web interface.
# Install root dependencies
pnpm install
# Install frontend dependencies
cd frontend && pnpm install
# Install backend dependencies (uses uv - ultra-fast Python package manager)
cd backend && uv sync# Start both frontend and backend concurrently (recommended)
pnpm run dev
# Start individual services
pnpm run next-dev # Frontend only (Next.js on port 3000)
pnpm run fastapi-dev # Backend only (FastAPI on port 8000)# Build frontend for production
pnpm run build
# Start production frontend
pnpm run start
# Process StarCraft raw data assets
pnpm run build-rawdata
# Generate TypeScript types from backend schemas
pnpm run schema# Frontend linting
cd frontend && pnpm run lint
# Frontend testing (Vitest with Storybook integration)
cd frontend && pnpm test
# Storybook development
cd frontend && pnpm run storybook
# Backend linting (uses ruff - configured in pyproject.toml)
cd backend && ruff check
# Type checking
cd frontend && tsc --noEmit- Frontend: Next.js 15 + React 19 RC, TailwindCSS, Zustand state management
- Backend: FastAPI (Python), Firebase (Auth/Database/Storage), custom StarCraft engine
- Development: TypeScript, uv (Python), pnpm (Node.js), concurrently
webditor/
├── frontend/ # Next.js React application
│ ├── app/ # Next.js App Router pages and layouts
│ ├── components/ # React components organized by purpose
│ │ ├── layout/ # Layout components (sidebars, viewport)
│ │ ├── ui/ # Reusable UI components
│ │ └── core/ # Business logic components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities and API clients
│ ├── store/ # Zustand state management stores
│ ├── types/ # TypeScript type definitions
│ └── utils/ # Helper functions
├── backend/ # FastAPI Python backend
│ └── app/
│ ├── api/v1/ # API routes and endpoints
│ ├── core/ # Core utilities (logging, Firebase)
│ ├── models/ # Pydantic data models
│ └── services/ # Business logic and StarCraft processing
├── wengine/ # Custom StarCraft game engine package
├── preprocess/ # StarCraft asset preprocessing tools
└── scripts/ # Build and development scripts
Uses Zustand with Immer for immutable updates:
assetExplorerStore- Asset browser and file managementmapStore- Map data and editing operationsentityStore- Game entity managementmodalStore- UI modal state management
Each store follows the pattern of using Immer for complex state mutations while maintaining immutability.
- RESTful API organized under
/api/v1/ - Modular FastAPI routers by domain (maps, users, tilesets)
- Pydantic models for request/response validation
- Firebase integration for authentication and data persistence
- Custom StarCraft file format processing via
wengineandeudplib
- Layout components use resizable panels with
re-resizable - Drag & drop functionality via
@dnd-kit/core - UI components follow shadcn/ui patterns with custom Catppuccin theming
- Complex components separated by layout/ui/core concerns
- TypeScript strict mode enabled
- ESLint configuration allows
@typescript-eslint/no-explicit-any: "off"for StarCraft data flexibility - TailwindCSS for styling with custom color palette
- Python code follows ruff linting with 2-space indentation
// Zustand store with Immer example
const useMapStore = create<MapState>()(
immer((set) => ({
map: null,
updateMap: (updater) => set((state) => {
// Immer allows direct mutation syntax
updater(state.map);
}),
}))
);- Frontend uses Axios for HTTP requests
- Backend uses Firebase Admin SDK for authentication
- Type-safe API calls with generated TypeScript types from Pydantic models
- StarCraft CHK/SCX files processed via custom
wenginepackage - Asset preprocessing generates optimized terrain and sprite data
- Real-time map rendering in the browser viewport
- Vitest configured with browser testing using Playwright
- Storybook integration for component testing
- Setup file:
.storybook/vitest.setup.ts
- Run
pnpm run devto start both services - Frontend available at http://localhost:3000
- Backend API at http://localhost:8000
- Use Storybook for component development
- Generate types after backend schema changes with
pnpm run schema
The application requires Firebase setup for:
- Authentication (Email, Google, GitHub providers)
- Firestore database for user data and projects
- Storage for map file uploads
- Security rules for data protection
Configure environment variables for Firebase credentials in both frontend and backend.
- Supports CHK (StarCraft map) and SCX (StarCraft expansion map) formats
- Custom parsing via
wenginepackage built oneudplib - Real-time conversion between binary formats and JSON for web editing
- Terrain tilesets extracted from StarCraft data files
- Unit sprites and animations preprocessed for web display
- Trigger system supports raw trigger data processing
Use pnpm run build-rawdata to regenerate processed StarCraft assets when needed.