Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
A production Next.js 14 + TypeScript application that creates a public, mobile-friendly leaderboard site for Dawn of War: Definitive Edition. Live data from Relic's Community API is enriched with Steam player names and stored in Supabase for advanced features like player profiles, match history, and replay uploads.
Status: ✅ Production site deployed at https://www.dow-de.com
Leaderboards (
/)
Player Profiles (
/profile/[profileId])
Replay System (Replays Tab)
.rec replay files (50MB limit)Player Search
Advanced Statistics Teaser (Premium Feature Mockup)
premium_interest_leads tableNEXT_PUBLIC_ENABLE_PREMIUM_TEASER env varData Collection Scripts
seed:leaderboards - Initial snapshot of all leaderboardsenrich:players - Steam ID/level/XP enrichmentcrawl:concurrent - Match history collectioncrawl:watch - Progress monitoringcrawl:cleanup - Stuck job recoveryRelic Community API (
https://dow-api.reliclink.com)
GetAvailableLeaderboards - 37 leaderboards (cached 24h)getLeaderBoard2 - Player rankings (cached 5 min)proxysteamuserrequest - Steam name resolutionSupabase Database
players - All discovered players with enrichmentleaderboards - Metadata for 37 laddersleaderboard_snapshots - Daily rank historymatches - Match history with player performancereplays - Uploaded replay metadatareplay_player_links - Match replays to profilespremium_interest_leads - Market research for premium tier// Ladder row (API + enrichment) type LadderRow = { rank: number profileId: string playerName: string rating: number wins: number losses: number winrate: number // (wins / (wins + losses)) * 100 streak: number country?: string lastMatchDate?: Date faction?: string level?: number rankDelta?: number | null // 24h change originalRank?: number // for multi-faction views leaderboardId?: number } // Player (database) type Player = { profile_id: string current_alias: string | null country: string | null steam_id64: string | null level: number | null xp: number | null first_seen_at: string last_seen_at: string }
Leaderboards
/api/leaderboards - Available leaderboards (24h cache)/api/cache/leaderboard/[id] - Top-200 ladder (5 min cache)/api/cache/leaderboard/[id]/[limit] - Extended ladder up to 1000/api/cache/combined-1v1 - Combined 1v1 deduplicated by player/api/cache/combined-1v1/[limit] - Extended combined (up to 500/faction)/api/cache/combined-1v1-multi - All faction placements (players may appear multiple times)/api/cache/combined-1v1-multi/[limit] - Extended multi-entry viewPlayers
/api/players/search - Autocomplete search via Supabase/api/players/profile - Profile + stats + recent matches/api/cache/player/by-alias/[alias] - Player lookup by exact aliasReplays
/api/replays - GET: list replays, POST: upload replayOther
/api/steam/players - Current player count (cached from Supabase edge function)/api/log-favorite - Analytics logging for favorite leaderboards/api/premium-interest - Premium feature interest tracking (advanced stats teaser)Core Logic
src/lib/relic.ts - Relic API wrapper with retry logicsrc/lib/supabase.ts - Supabase client setupsrc/lib/xp-levels.ts - XP to level calculation (fixes API bug)src/lib/rank-history.ts - Rank delta computationsrc/lib/replay-player-matching.ts - Replay parsing + player matchingsrc/lib/mapMetadata.ts - Map names/metadataUI Components
src/app/page.tsx - Main leaderboard view (large file ~42k tokens)src/app/profile/[profileId]/page.tsx - Player profilesrc/app/_components/ReplaysTab.tsx - Replay upload/download UIsrc/components/AutocompleteSearch.tsx - Player search widgetsrc/components/ClickablePlayer.tsx - Player name linksScripts (see
scripts/)
.env for Supabase credentialsforce-cache)revalidate: 300 for cached routes)title=dow1-de to Relic APIstatgroup_id, not by array positionGetAvailableLeaderboards# Development npm run dev # Start dev server (localhost:3000) npm run build # Production build npm run typecheck # TypeScript validation
Always run TypeScript checks before deploying:
npm run typecheck
This catches type errors that would cause build failures on Vercel.
Required for full functionality:
# Supabase (public - for client-side) NEXT_PUBLIC_SUPABASE_URL= NEXT_PUBLIC_SUPABASE_ANON_KEY= # Supabase (server-side - for scripts/admin routes) SUPABASE_URL= SUPABASE_SERVICE_ROLE_KEY= # Feature flags NEXT_PUBLIC_ENABLE_PREMIUM_TEASER=false # Enable advanced statistics teaser modal
page.tsx ~42k tokens) - use offset/limit when readingsupabase/migrations/supabase/functions/steam-player-count/)level: 1 for all players (bug) - we compute from XP locally