Mobile App Guidelines
See docs/AGENTS.md for the main guidelines document.
For global design direction, also follow docs/AGENTS_DESIGN.md and docs/AGENTS_FRONTEND.md.
CRITICAL RULE: Before implementing any mobile feature, review this file and AGENTS_DESIGN.md.
Target Repository
- This guide targets the React Native app located at
../aaperture-mobile(hyphen, not underscore). - Apply these rules in that repository's code and docs (
../aaperture-mobile/docs/).
Scope
Use this guide for:
- Mobile app screens and flows
- Typography, color, spacing, and logo decisions
- Navigation behavior, touch ergonomics, and accessibility
- Feature implementation constraints to pass to Codex
Codex Execution Contract
When this file is provided to Codex, the agent must:
- Define or update mobile design tokens first.
- Use only semantic tokens in UI code (no one-off visual values in screens).
- Use shared brand components for logo/name rendering.
- Implement loading/empty/error/success states.
- Validate safe areas, touch targets, and accessibility labels.
- Include test/verification notes in the PR summary.
Recommended Mobile Stack
Use the actual stack from aaperture-mobile:
- Runtime: React Native + Expo + TypeScript
- Navigation: Expo Router (
app/routes and layouts) - Styling: NativeWind + shared UI primitives (Gluestack-based components)
- Data fetching/cache: TanStack Query
- Validation: Zod
- Theme management:
src/theme/AppThemeProvider.tsx+ shared tokens
Component Parity Strategy (shadcn-like)
Goal: keep a consistent design language and developer API between web and mobile.
- Web keeps
shadcn/ui. - Mobile uses React Native primitives (
NativeWind+gluestack) with a shadcn-like API. - Do not try to share the exact same implementation files between web and mobile.
Rules:
- Keep the same semantic component names across platforms whenever possible:
Button,Input,Card,Badge,Avatar,Dialog,Sheet,Toast
- Keep token semantics aligned (
primary,success,warning,danger, spacing scale, type scale). - Keep variant naming aligned (
default,secondary,outline,ghost,destructive) when relevant. - If mobile platform constraints require divergence, document it in the component file header and in PR notes.
- New UI work should prefer extending shared primitives before adding feature-local one-off components.
Mobile Folder Conventions
Recommended structure:
aaperture-mobile/
app/ # expo-router routes (auth, tabs, stacks, layouts)
src/
api/ # generated/openapi client and api adapters
auth/ # auth and token handling
components/ui/ # gluestack/nativewind UI primitives
features/ # feature modules
i18n/ # translations
theme/ # runtime theme provider and palette switching
ui/ # app-level design tokens and wrappers
utils/ # shared helpers
Rules:
- Keep routing in
app/(do not move screen routing logic into random feature files). - Keep design tokens centralized in
src/ui/theme.tsand theme mode logic insrc/theme/AppThemeProvider.tsx. - Do not define raw colors or font sizes inside feature screens.
- Keep brand assets/components centralized (single source of truth).
Design Tokens (Source of Truth)
Create or maintain design tokens in ../aaperture-mobile/src/ui/theme.ts:
export const colors = {
bg: "#0F1115",
surface: "#171A21",
surfaceAlt: "#1E232D",
text: "#F3F5F8",
textMuted: "#A8B0BF",
border: "#2A3140",
primary: "#D9A441",
success: "#18A957",
warning: "#E69A2E",
danger: "#D64545",
neutral: "#8A93A5",
} as const;
export const spacing = {
0: 0,
1: 4,
2: 8,
3: 12,
4: 16,
5: 20,
6: 24,
8: 32,
10: 40,
12: 48,
} as const;
export const radius = {
sm: 8,
md: 12,
lg: 16,
xl: 20,
pill: 999,
} as const;
Rules:
- Tokenize every new visual decision before component usage.
- Keep semantic status colors aligned with
AGENTS_DESIGN.md. - Avoid per-screen token forks.
Typography Rules
Define typography in one place (../aaperture-mobile/src/ui/theme.ts) and consume via shared text primitives:
export const typeScale = {
xs: { fontSize: 12, lineHeight: 16 },
sm: { fontSize: 14, lineHeight: 20 },
base: { fontSize: 16, lineHeight: 24 },
lg: { fontSize: 18, lineHeight: 26 },
xl: { fontSize: 22, lineHeight: 30 },
"2xl": { fontSize: 28, lineHeight: 36 },
} as const;
Rules:
- Keep one UI family and one optional display family.
- No hardcoded
fontSizein screen components. - Use semantic text variants via shared
Textcomponent (src/ui/Text.tsxorsrc/components/ui/text).
Logo and Brand Rules
- Use shared components only:
BrandLogoBrandWordmarkBrandLockup
- Never hardcode app name in screen JSX.
- Keep logo clear space and scale consistent.
- Navigation headers, auth screens, and drawer headers must use shared brand components.
Example:
<BrandLockup variant="wordmark" size="lg" />
Layout, Touch and Safe Areas
- Minimum touch target:
44x44px. - Apply safe area insets on top-level screens.
- Use spacing tokens only for paddings/margins/gaps.
- Avoid fixed-width layout assumptions; support narrow and large phones.
Screen shell example:
import { SafeAreaView } from "react-native-safe-area-context";
export function ScreenContainer({ children }: { children: React.ReactNode }) {
return <SafeAreaView style={{ flex: 1 }}>{children}</SafeAreaView>;
}
Navigation and UX Rules
- Use shallow task flows for frequent actions.
- Keep navigation patterns consistent per feature area.
- Back behavior must be deterministic and platform-consistent.
- Each screen must include:
- Loading state
- Empty state
- Error state
- Success feedback state
Accessibility Baseline (Required)
- Support system font scaling.
- Add
accessibilityLabelto icon-only controls. - Keep contrast at WCAG AA minimum for text/actions.
- Ensure focus and reading order are logical for screen readers.
Motion and Performance
- Motion explains transitions, never decorative overload.
- Keep transitions short (150-250ms).
- Respect reduced-motion preferences.
- Use list virtualization and progressive rendering for heavy lists.
Mobile PR Checklist (Required)
Each mobile PR must include:
- Tokens changed/added (
src/ui/theme.ts,src/theme/AppThemeProvider.tsx, related UI primitives). - Screens affected and state coverage (loading/empty/error/success).
- Accessibility checks performed (labels, contrast, dynamic text).
- Device verification:
- One small iPhone/Android viewport
- One larger iPhone/Android viewport
- Visual proof for brand/logo consistency in affected screens.
Definition of Done
A mobile UI feature is done only if:
- Typography, colors, spacing, and radius use shared tokens.
- Logo/brand rendering uses shared brand components.
- All key UX states are implemented.
- Touch targets and safe areas are validated.
- Accessibility baseline is respected.
- Verification notes are included in the PR.