This document provides a comprehensive guide for AI agents and developers working on the Skatehive 3.0 repository. Adhering to these guidelines is crucial for maintaining code quality, consistency, and project velocity.
Skatehive 3.0 is a Next.js application for the Skatehive community on the Hive blockchain. It integrates with Farcaster and Ethereum, and features include content posting, a skate spot map, bounties, and leaderboards.
- Primary Goal: Assist in developing and maintaining the Skatehive 3.0 application.
- Key Interaction: Read and understand this document,
RULES.md, andAGENTS.mdto inform all actions.
- Framework: Next.js 15.3.2
- Language: TypeScript
- Package Manager: pnpm 9.x (
pnpm install,pnpm dev,pnpm lint,pnpm build) - UI: Chakra UI 2.10.9 (primary), Tailwind CSS 4 (utilities)
- Data Fetching: React Query
- Blockchain:
- Hive: Aioha (auth/wallet)
- Ethereum: Wagmi, Viem
- Deployment: Vercel
- Environment: Copy
.env.local.exampleto.env.local. For a minimal setup, you only need to setHIVE_POSTING_KEY. Other defaults are inconfig/app.config.ts. - Dependencies: Run
pnpm install. - Run Dev Server: Run
pnpm dev. The app will be available athttp://localhost:3000.
This repository is configured for GitHub Codespaces. Launch a new codespace from the "Code" menu. The container will automatically install dependencies. Run pnpm dev to start the application.
Userbase features require manual database migrations located in sql/migrations/.
- Supabase: Run
0001_userbase.sql, then0002_userbase_rls_supabase.sql. - Self-hosted Postgres: Run
0001_userbase.sql. - Follow the sequence in
README.mdto enable features like magic-link auth and app-only posting.
- Language: Use TypeScript for all new code.
- Formatting: Indent with 2 spaces. Keep line length around 100 characters.
- Imports: Order imports: external modules first, then internal project paths.
- Validation: Always run
pnpm lintandpnpm buildbefore committing.
- Pages & Layouts:
app/<segment>/page.tsxandapp/<segment>/layout.tsx. - Components:
- Feature-specific:
components/<feature>/ - Shared:
components/shared/
- Feature-specific:
- Hooks:
hooks/, prefixed withuse. - Contexts:
contexts/. - Utilities:
lib/utils/. - Types:
types/.
- Follow All Rules: Adhere strictly to all guidelines in this document.
- Single-Responsibility Commits: Group related changes into a single, clear commit.
- No Hardcoded Colors: Crucial. Never hardcode color values. Always use Chakra UI theme tokens.
- Verify Dependencies: Use
pnpm info <pkg>andpnpm auditbefore adding new dependencies.
- Primary System: Chakra UI is the source of truth for all styling. Use Chakra components (
Box,Flex,Text, etc.) and their style props (bg,color,p,m). - No Hardcoded Colors: All colors must come from the theme. Use semantic tokens like
background,primary,border.- Correct:
<Box bg="panel" color="text"> - Incorrect:
<div style={{backgroundColor: '#FFF'}}>or<Box color="white">
- Correct:
- Tailwind CSS: Use only for simple utilities not covered by Chakra's props.
- Custom CSS: Avoid custom CSS files (
*.css). Useapp/globals.cssonly for third-party library overrides or global resets that are impossible to handle otherwise.
The app has a multi-theme system managed by ThemeProvider. Themes are in /themes/.
Every theme file in /themes/ must export a Chakra theme object with a specific set of required color tokens (e.g., background, text, primary, panel, border, etc.). See AGENTS.md for the full list.
- DO: Use semantic tokens:
bg="background",color="primary". - DON'T: Hard-code hex values or assume a light/dark mode.
All user-facing strings must be added to the translation system to support multiple languages.
- Use the Hook: In client components, use
const t = useTranslations('namespace');. - Add Keys to All Files: When adding a new string, add the key and translation to all language files simultaneously:
lib/i18n/locales/en.tslib/i18n/locales/pt-BR.tslib/i18n/locales/es.tslib/i18n/locales/lg.ts
- No Hardcoded Strings: Never write user-facing text directly in a component.
This system allows users without Hive accounts (e.g., email-only) to post and vote. Content is published under a default Hive account (skateuser), and an overlay system attributes it back to the "lite" user.
- Key Hook:
useSoftPostOverlayfetches and displays the correct user profile (e.g., email user's name) instead of the default account's. - Key Logic:
extractSafeUserfromlib/userbase/safeUserMetadata.tsreads the user hash from post metadata. - API Endpoint:
app/api/userbase/soft-posts/route.tsserves the overlay data.
When working with posts or user profiles, always check if the useSoftPostOverlay hook should be used to display the correct author information. See docs/USERBASE_SOFT_POSTS.md for more details.