The constants module centralizes timing, thresholds, and configuration values used throughout the application. These values control interactive behaviors, network detection, and animations.
Using a single source of truth for magic numbers provides:
- Easier Tuning: Change behavior across the app by editing one file
- Testability: Constants can be imported and verified in tests
- Maintainability: No hunting through components to find timing values
- Documentation: Descriptive names make values self-explanatory
The module exports four const objects, each grouping related values, plus a standalone MAX_STARS value:
Debounce delays and timing values in milliseconds:
CONSOLE_LOGO_DEBOUNCE(1000ms) - Prevents duplicate ASCII logo prints in consolePROJECT_HOVER_VIDEO(1000ms) - Delay before showing video on project card hoverAVATAR_SNEEZE_DEBOUNCE(100ms) - Debounce for avatar hover interactionsSTAR_ANIMATION_INITIAL(1000ms) - Delay before StarsBackground starts the forced shooting-star loop
Usage: Import to control debouncing and timing in components.
Trigger thresholds for interactive features:
SNEEZE_TRIGGER_INTERVAL(5) - Number of hovers before avatar sneeze animationAAAAHHHH_TRIGGER_COUNT(6) - Number of sneezes before Easter egg activationMIN_STARS_FOR_ANIMATION(15) - Unused stars StarsBackground requires before shooting another; below it, the field regenerates
Usage: Import to control when interactions trigger animations or Easter eggs.
Network performance thresholds for adaptive loading:
SLOW_NETWORK_TYPES(['slow-2g', '2g', '3g']) - Network types considered slow
Usage: Import in isNetworkFast() to determine whether to autoplay videos.
Multi-stage animation durations in milliseconds:
SNEEZE_STAGE_1(500ms) - First frame of avatar sneezeSNEEZE_STAGE_2(300ms) - Second frame of avatar sneezeSNEEZE_STAGE_3(1000ms) - Final frame of avatar sneeze
Usage: Import to sequence the avatar sneeze animation in Avatar component.
A standalone value (600) capping the number of stars StarsBackground renders. The component derives its star count from the window width but limits it to MAX_STARS to bound rendering cost.
Usage: Import to change the upper bound on rendered stars.
Implementation: src/constants/index.ts
src/constants/routes.ts holds the site's paths, named once for proxy.ts and the Markdown builders:
ROUTES- the home page (/), its Markdown form (/index.md),/llms.txt, and/sitemap.xmlMAIN_CONTENT_ID- the ID of the<main>element, which receives focus when a closing overlay has nowhere better to return itSECTION_IDS- the home page fragments a redirect or link targets:contact,privacy(opens the policy dialog), andcookie-settings(reopens the consent banner)POLICY_HREFandPOLICY_PATHS- the link that opens the policy dialog and the conventional paths that redirect to itREDIRECTSandREWRITES- the tables the proxy answers before negotiating a representation; see Agent Readiness
Implementation: src/constants/routes.ts
- Utils Documentation - Utility functions that use these constants
- Helpers Documentation - Helper functions that use these constants
- Components Documentation - Components that consume constants