Battlemap
Google Earth for Companies - A viral, visually stunning 3D map of the business world.
π Overview
Battlemap is a free-to-explore, competitive intelligence tool that visualizes the entire business landscape in stunning 3D. Users can:
- Explore industries as glowing galaxy clusters
- Drill down into categories with smooth 3D transitions
- Discover companies visualized as buildings with real-time data
- Generate battle cards for competitive analysis (soft-gated)
- Share beautiful visual snapshots across social media
Live Demo: battlemaps.io (coming soon)
π― Key Features
Visual Architecture
π Galaxy View (Zoomed Out)
- Industries rendered as particle nebulae using InstancedMesh
- Golden spiral layout algorithm for natural distribution
- Background star field (2,000 particles)
- Bloom post-processing for glow effects
- Idle auto-rotation with dampened user controls
ποΈ Landscape View (Drilled In)
- Companies as 3D buildings with logos (BrandFetch integration)
- Building height scales logarithmically with market cap
- Category zones with color-coded boundaries
- Spring physics animations for building transitions
- OrbitControls for pan/zoom/rotate
π Smooth Transitions
- Galaxy β Landscape: ~1.5s choreographed animation
- Cluster glow (200ms)
- Other clusters fade (300ms)
- Camera fly-to (500ms, easeInOutCubic)
- Particles coalesce (300ms)
- Buildings rise (staggered 50ms each, spring physics)
- Labels fade in (200ms)
Progressive Enhancement
π± 2D Mobile Fallback
- Automatic device capability detection (3 tiers: high/mid/low)
- Graceful fallback for:
- No WebGL support
- Low-end mobile devices
- Users preferring reduced motion
- IndustryGrid: Card-based industry browser
- CompanyList: Searchable company list with metrics
βΏ Accessibility
- Keyboard navigation (Escape to close panels)
- Reduced motion support
- ARIA labels and semantic HTML
- Screen reader friendly
ποΈ Architecture
Technology Stack
| Layer | Technology | Purpose |
|---|---|---|
| Framework | Next.js 16 (App Router) | SSR, routing, optimization |
| 3D Rendering | React Three Fiber 9.1 | Declarative Three.js |
| 3D Helpers | @react-three/drei 10.5 | Camera controls, loaders, HTML |
| Post-processing | @react-three/postprocessing 3.0 | Bloom effects |
| 3D Engine | Three.js 0.177 | WebGL rendering |
| Styling | Tailwind CSS | Utility-first CSS |
| Icons | Lucide React | Consistent iconography |
| Database | Supabase | PostgreSQL with RLS |
| Auth | Supabase Auth | Email/OAuth |
| Analytics | PostHog | Product analytics |
| OG Images | @vercel/og | Dynamic social cards |
Project Structure
apps/battlemap/
βββ app/
β βββ layout.tsx # Root layout, metadata
β βββ page.tsx # Landing page with BattlemapView
β βββ industry/[slug]/
β β βββ page.tsx # Industry detail page
β βββ company/[slug]/
β β βββ page.tsx # Company profile page
β βββ compare/[slugs]/
β β βββ page.tsx # Company comparison page
β βββ alternatives/[slug]/
β βββ page.tsx # Alternatives page
β
βββ components/
β βββ BattlemapView.tsx # Main orchestrator (3D/2D, galaxy/landscape)
β βββ CompanyDetailPanel.tsx # Slide-in company detail
β β
β βββ GalaxyView/
β β βββ GalaxyCanvas.tsx # Galaxy scene container
β β βββ IndustryCluster.tsx # Particle-based industry clusters
β β βββ StarField.tsx # Background stars
β β βββ TransitionManager.tsx # GalaxyβLandscape choreography
β β βββ types.ts # Galaxy view types
β β βββ index.ts
β β
β βββ MobileView/
β βββ IndustryGrid.tsx # 2D industry cards
β βββ CompanyList.tsx # 2D company list
β βββ index.ts
β
βββ utils/
β βββ deviceCapability.ts # Device tier detection
β
βββ next.config.js # Next.js config, image domains
βββ package.json # Dependencies, scripts
βββ tsconfig.json # TypeScript config
Shared UI Components
Located in packages/ui/src/modules/battlemap/:
packages/ui/src/modules/battlemap/
βββ types.ts # Shared types (BattlemapCompany, etc.)
βββ index.ts # Barrel exports
β
βββ landscape/
βββ PublicLandscape3D.tsx # 3D landscape scene
βββ CompanyBlock3D.tsx # Company building blocks
βββ CategoryZone3D.tsx # Category zone overlays
π Getting Started
Prerequisites
- Node.js 22.x (or compatible version)
- pnpm 10.x
- Supabase account (for database)
- BrandFetch API key (optional, for company logos)
Installation
# From monorepo root
pnpm install
# Build all dependencies
pnpm build
Environment Variables
Create .env.local in monorepo root:
# Supabase (required)
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
# BrandFetch (optional, for logos)
NEXT_PUBLIC_BRANDFETCH_CLIENT_ID=your-client-id
# PostHog (optional, for analytics)
NEXT_PUBLIC_POSTHOG_KEY=your-posthog-key
NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com
Database Setup
Run the Supabase migration:
# Apply migration
supabase db push
# Or if using Supabase CLI
supabase migration up
This creates the battlemap schema with:
industries- Industry metadatasectors- Sector groupingscategories- Category groupingscompanies- Company profilesuser_profiles- User contribution trackinglive_views- Real-time viewer countsreport_generations- Battle card usage tracking
Development
# Run battlemap app only
pnpm --filter @hivebase/battlemap dev
# Or from apps/battlemap directory
cd apps/battlemap
pnpm dev
Visit http://localhost:3002
Build
# Build battlemap
pnpm --filter @hivebase/battlemap build
# Build entire monorepo
pnpm build
π Data Model
Core Entities
Industry
interface Industry {
id: string;
slug: string;
name: string;
color: string; // Hex color for cluster
companyCount: number;
position: { x: number; y: number; z: number };
}
Company (Battlemap)
interface BattlemapCompany {
id: string;
slug: string;
name: string;
website?: string;
logoUrl?: string;
// Positioning (0-100 percentage scale)
position: { x: number; y: number };
// Grouping
categoryId?: string;
industryId?: string;
// Public profile
pitch?: string;
targetMarket?: string;
// Visual weight
marketCap?: number;
employeeCount?: number;
fundingStage?: string;
// Competitive intel
strengths?: string[];
weaknesses?: string[];
}
Category
interface BattlemapCategory {
id: string;
slug: string;
name: string;
color?: string;
// Visual grouping (0-100 percentage scale)
position?: { x: number; y: number };
width?: number;
height?: number;
}
π¨ Design System
Color Palette
const INDUSTRY_COLORS = {
technology: "#6366f1", // Indigo
finance: "#22c55e", // Green
healthcare: "#ec4899", // Pink
consumer: "#f59e0b", // Amber
energy: "#14b8a6", // Teal
industrials: "#8b5cf6", // Purple
materials: "#78716c", // Stone
utilities: "#06b6d4", // Cyan
realestate: "#f97316", // Orange
telecom: "#3b82f6", // Blue
};
Interaction Patterns
| Element | Hover | Click | Timing |
|---|---|---|---|
| Industry cluster | Glow 1.3x, scale 1.05 | Fly to landscape | 150ms ease-out |
| Company building | Rise 10%, show tooltip | Open detail panel | 200ms spring |
| Company card (2D) | Lift shadow, scale 1.02 | Open detail panel | 150ms ease-out |
Animation Philosophy
"Awe First, Utility Second"
- Prioritize visual impact over information density
- 60fps animations always (degrade quality before frame rate)
- Reward exploration with satisfying micro-interactions
- Never use jarring transitions
π API Integration
Data Sources
1. HiveBase Deep Research API
Primary source for initial data seeding (200-500 companies).
// Future implementation
const companies = await deepResearch({
industry: "technology",
category: "crm",
limit: 50,
});
2. Community Contributions
Users can add companies with AI verification.
// POST /api/companies
{
name: "Acme Corp",
website: "https://acme.com",
industry: "technology",
// AI verifies legitimacy via Tavily/Exa
}
3. Self-Submission
Companies can claim and enhance their profiles.
// POST /api/companies/claim
{
companyId: "comp-123",
verificationMethod: "domain", // DNS TXT record
}
Battle Card Generation
// POST /api/reports/generate
{
companyId: "comp-123",
competitors: ["comp-456", "comp-789"],
}
// Soft-gated: Free account required
// Rate limit: 3 reports/month for free users
π§ͺ Testing
Device Capability Detection
Test different tiers by forcing view mode:
// Force 3D view
<BattlemapView forceViewMode="3d" />
// Force 2D fallback
<BattlemapView forceViewMode="2d" />
Performance Targets
| Metric | Target | Notes |
|---|---|---|
| Initial load | < 3s | 4G connection |
| Galaxy view FPS | 60fps | Desktop, 30fps mid-range mobile |
| 2D fallback FPS | 60fps | All devices |
| Lighthouse (mobile) | > 80 | Performance score |
| Transition duration | ~1.5s | Perceived as "instant" |
π’ Deployment
Vercel (Recommended)
# Deploy to production
vercel --prod
# Preview deployment
vercel
Domain: battlemaps.io
Environment Variables (Production)
Set in Vercel dashboard:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYNEXT_PUBLIC_BRANDFETCH_CLIENT_IDNEXT_PUBLIC_POSTHOG_KEYNEXT_PUBLIC_POSTHOG_HOST
CDN & Caching
- Static assets: Vercel Edge Network
- BrandFetch logos:
cdn.brandfetch.io - OG images:
@vercel/og(edge function)
π Analytics & Metrics
Viral Metrics (Primary)
| Metric | Target |
|---|---|
| Shares per visitor | > 0.05 (1 in 20) |
| K-factor | > 1.0 (organic growth) |
| Time on site | > 3 min average |
| Return rate (7-day) | > 20% |
Conversion Metrics
| Metric | Target |
|---|---|
| Visitor β Free account | > 5% |
| Free account β Battle card | > 40% |
| Free account β Company added | > 10% |
| Free account β HiveBase trial | > 2% |
Tracking Events
// PostHog events
posthog.capture('industry_clicked', { industry: 'technology' });
posthog.capture('company_viewed', { company: 'salesforce' });
posthog.capture('report_generated', { company: 'hubspot' });
posthog.capture('share_clicked', { type: 'company_card' });
π£οΈ Roadmap
Phase 1: Foundation β
- Next.js app scaffold
- Database schema
- Galaxy view with particle clusters
- Landscape view with buildings
- Galaxy β Landscape transitions
- Company detail panel
- 2D mobile fallback
Phase 2: Data & Auth (In Progress)
- Supabase Auth setup
- Company verification API (AI-based)
- Seed initial company data (200+ companies)
- Battle card generation API
Phase 3: Viral Mechanics
- OG image generation for sharing
- Social proof indicators (live viewers)
- Contributor leaderboards
- Company claim flow
- Embeddable widgets
Phase 4: SEO & Growth
- Programmatic page generation (ISR)
- Comparison pages (
/compare/x-vs-y) - Alternatives pages (
/alternatives/x) - Industry trend pages
- Email alerts for followed companies
Phase 5: Monetization
- Soft-gate battle card generation
- HiveBase upsell integration
- API access for power users
- White-label licensing
π€ Contributing
Code Style
- Follow existing patterns in the codebase
- Use TypeScript for all new code
- Follow CLAUDE.md conventions
- Use meaningful variable names (
isTransitioning, notflag) - Add comments for complex logic
Component Guidelines
3D Components:
- Use
useFramefor animations - Clean up on unmount (timeouts, subscriptions)
- Optimize with
useMemofor expensive calculations - Use
Suspensefor lazy-loaded assets
2D Components:
- Use Tailwind utility classes
- Avoid inline styles unless dynamic
- Follow accessibility best practices
- Test on mobile devices
Performance
- Lazy load 3D components with
Suspense - Use
React.memofor pure components - Debounce search inputs
- Implement infinite scroll for long lists
- Monitor bundle size with
next/bundle-analyzer
π Troubleshooting
Common Issues
"WebGL not supported"
- Ensure device has WebGL capabilities
- Check if hardware acceleration is enabled
- Fallback to 2D view should be automatic
"Logos not loading"
- Check
NEXT_PUBLIC_BRANDFETCH_CLIENT_IDis set - Verify domain is whitelisted in BrandFetch
- Check CORS configuration in
next.config.js
"Transition feels janky"
- Check FPS in DevTools (should be 60fps desktop, 30fps mobile)
- Reduce particle count for mid-tier devices
- Disable bloom for low-tier devices
"Build fails"
- Run
pnpm installto sync dependencies - Check Node.js version (should be 22.x)
- Clear
.nextfolder and rebuild - Check TypeScript errors with
pnpm type-check
Debug Mode
Enable debug logging:
// In BattlemapView.tsx, uncomment:
console.log('[BATTLEMAP] Device capability detected:', recommended);
console.log('[BATTLEMAP] Generate report for:', company.name);
π License
Proprietary - HiveBase Inc.
For licensing inquiries: contact@hivebase.com
π Acknowledgments
- Three.js - Amazing 3D library
- React Three Fiber - Declarative Three.js wrapper
- Vercel - Deployment platform
- Supabase - Database & auth
- BrandFetch - Company logos
π Support
- Documentation: battlemaps.io/docs (coming soon)
- Issues: GitHub Issues
- Discord: HiveBase Community
- Email: support@battlemaps.io
Built with β€οΈ by the HiveBase team