yarn dev- Start development server with HMRyarn build- Production buildyarn check- TypeScript + Svelte validationyarn lint- ESLint checkyarn lint:fix- Auto-fix ESLint issuesyarn format:fix- REQUIRED before every commit - Prettier formattingyarn typecheck- TypeScript type checkingyarn playwright test- Run all E2E testsyarn playwright test tests/home.spec.ts- Run single test fileyarn playwright test --headed- Run tests with browser UI
- Tabs for indentation, single quotes, no trailing commas
- 100 char line limit, TailwindCSS class sorting enabled
- TypeScript required - avoid
any, create types insrc/lib/types.ts - Svelte v4 conventions - use stores, reactive statements, proper lifecycle
- TailwindCSS v3 utility-first, custom Bitcoin orange/teal theme
- Imports: Barrel exports from
src/lib/comp.ts, absolute paths preferred
- SvelteKit file-based routing, SSR for SEO pages
- Leaflet + MapLibre for interactive maps with clustering
- LocalForage client-side caching, sync every 10min from API
- Mobile-first PWA with offline support via service worker
- Hybrid viewport + web worker loading: Only load markers visible in current viewport
- Lazy worker initialization: Web workers initialized only when needed with proper feature detection
- Viewport-based filtering: 20% buffer around visible area for smooth panning
- Memory management: Cleanup out-of-bounds markers when >200 markers loaded
- Debounced loading: 300ms debounce on map movement to prevent excessive API calls
- Batch processing: 25-marker batches for optimal performance in viewport
- MessageChannel yielding: Proper event loop yielding in workers (no setTimeout)
const MAX_LOADED_MARKERS = 200; // Memory cleanup threshold
const VIEWPORT_BATCH_SIZE = 25; // Worker batch size for viewport
const VIEWPORT_BUFFER_PERCENT = 0.2; // 20% buffer around viewport
const DEBOUNCE_DELAY = 300; // Map movement debounce (ms)- Use
@zerodevx/svelte-toastfor user notifications - Axios retry logic for API failures, graceful offline degradation
- Proper TypeScript error types, avoid silent failures
- Web worker fallback to synchronous processing when workers unavailable