This file provides context for AI agents working on this codebase.
SkateHive is a React Native/Expo mobile app for a skateboarding community built on the HIVE blockchain. Users post skateboarding content (photos, videos, text), vote on posts, comment, follow each other, and earn crypto rewards (HIVE/HBD).
┌─────────────────────────────────────────────────┐
│ Expo Router │
│ app/_layout.tsx (providers) -> app/(tabs)/* │
├─────────────────────────────────────────────────┤
│ React Components │
│ components/Feed/ components/auth/ components/ui/ │
├─────────────────────────────────────────────────┤
│ Business Logic (lib/) │
│ auth-provider hive-utils secure-key upload/ │
├─────────────────────────────────────────────────┤
│ Data Layer │
│ React Query | HIVE RPC Nodes | REST API │
├─────────────────────────────────────────────────┤
│ Native Layer │
│ expo-secure-store expo-camera expo-video │
└─────────────────────────────────────────────────┘
| File | Purpose | Lines |
|---|---|---|
lib/auth-provider.tsx |
Authentication context, session mgmt, multi-account, biometric/PIN | ~490 |
lib/hive-utils.ts |
ALL blockchain operations (vote, comment, follow, power-up, etc.) | ~1200 |
lib/secure-key.ts |
AES encryption of private keys with PBKDF2 key derivation | ~150 |
lib/types.ts |
TypeScript interfaces for Post, AuthSession, etc. | ~130 |
lib/theme.ts |
Complete design system (colors, spacing, fonts, radii) | ~65 |
lib/constants.ts |
API URLs, community tag, app name | ~25 |
app/_layout.tsx |
Root layout wrapping all context providers | — |
app/(tabs)/_layout.tsx |
Tab bar configuration (5 visible + 1 hidden tab) | — |
- Create file in
app/(orapp/(tabs)/for tabbed screens) - Expo Router auto-registers routes from file names
- Protected routes check
useAuth()session inapp/_layout.tsx - Import theme from
lib/theme.tsfor consistent styling
- Add function in
lib/hive-utils.ts - Use
hiveClient(pre-configured with failover nodes) - Require
decryptedKeyfromuseAuth()session - Wrap in try/catch — blockchain ops can fail on any node
- Create in
lib/hooks/ - Use
useQuery/useMutationfrom@tanstack/react-query - Follow existing patterns in
useQueries.tsfor cache keys and stale times - Export and use in components
- Feed data flows:
useSnaps()->getSnapsContainers()->getContentReplies() - Each post is rendered by
components/Feed/PostCard.tsx - Media parsing happens inside PostCard (extracts images/videos from markdown body)
- Voting UI uses
components/ui/VotingSlider.tsx
- Images:
lib/upload/image-upload.ts(HEIC conversion + HIVE image hosting) - Videos:
lib/upload/video-upload.ts(dynamic transcoder discovery + IPFS) - Post assembly:
lib/upload/post-utils.ts(permlink, tags, metadata, broadcast)
- Dark theme only — never add light mode
- All colors come from
lib/theme.ts(primary=#32CD32, bg=#000000) - Use
StyleSheet.create()— no inline styles, no NativeWind in practice - Font: FiraCode (monospace) for all text
- For bold text with FiraCode, set
fontFamily: theme.fonts.boldexplicitly —fontWeight: 'bold'does not render the bold variant for custom fonts
- Server state: React Query (
@tanstack/react-query) - Auth state: React Context (
lib/auth-provider.tsx) - Notifications: React Context (
lib/notifications-context.tsx) - Toasts: React Context (
lib/toast-provider.tsx) - Local state:
useState/useReducer
- Use
~/path alias (maps to project root via tsconfig) - Example:
import { theme } from '~/lib/theme'
- NEVER store private keys in plaintext
- NEVER log private keys or decrypted values
- Always use
expo-secure-storefor sensitive data - Blockchain writes require
AuthSession.decryptedKey
QueryClientProvider
└── AuthProvider
└── NotificationProvider
└── ToastProvider
└── ViewportTrackerProvider
└── <Slot /> (screens)
-
Version drift: app.json, Info.plist, project.pbxproj, and package.json all have independent version numbers that must be synced manually before builds.
-
Android versionCode: Must be incremented in
app.jsonbefore each Play Store release (eas.jsonusesappVersionSource: "local", so it is never auto-bumped). -
newArchEnabled:
app.jsonandios/Podfile.properties.jsonare bothtrue(New Arch is required by Expo 54 / RN 0.81 / reanimated 4).app.jsonis the source of truth —ios/is regenerated from it by prebuild, so do not edit the Podfile value directly. -
Test account in auth-provider: Hardcoded credentials in
lib/auth-provider.tsxlet Apple reviewers log in with a simple password instead of a HIVE posting key. Remove immediately after Apple approves the app:- Delete the "APPLE REVIEW TEST ACCOUNT CONFIGURATION" block (
TEST_USERNAME,TEST_POSTING_KEY,TEST_SIMPLE_PASSWORDconstants). - Delete the "APPLE REVIEW TEST ACCOUNT LOGIC" block inside the login function.
- Delete the "APPLE REVIEW TEST ACCOUNT CONFIGURATION" block (
-
HIVE RPC nodes: Multiple fallback nodes configured in
hive-utils.ts. If one fails, the client retries on the next. Don't hardcode a single node. -
Video autoplay: Uses viewport tracking (
lib/ViewportTracker.tsx). Videos auto-play when 60%+ visible, pause when scrolled away. -
No test suite: There are no automated tests in the project currently. The
scripts/directory is empty.
# Prerequisites
node >= 18
pnpm
# Install & run
pnpm install
cp .env.example .env # Configure API_BASE_URL
pnpm dev # Start Expo dev server
# Build for production
eas build --platform ios --profile production
eas build --platform android --profile productionhttps://api.skatehive.app/api/v2— SkateHive backend (feed, profile, balance, leaderboard, etc.). The app uses v2; v1 is deprecated.https://api.skatehive.app/api/userbase/*— server-custody auth + Hive actions for email/lite accountshttps://api.skatehive.app/api/instagram/post+/api/userbase/profile/instagram— Instagram cross-post + handle (signature-auth)https://api.skatehive.app/api/transcode/status— Video transcoding servicehttps://images.hive.blog— HIVE image CDN- HIVE RPC nodes (multiple, with failover)