|
| 1 | +# React Native Template - Claude Code Instructions |
| 2 | + |
| 3 | +## Project Overview |
| 4 | +This is a React Native + Expo SDK 54 template with TypeScript, NativeWind (Tailwind CSS), Drizzle ORM, and best practices for mobile development. |
| 5 | + |
| 6 | +## Tech Stack |
| 7 | +- **Framework**: React Native 0.81 + Expo SDK 54 |
| 8 | +- **Language**: TypeScript (strict mode) |
| 9 | +- **Routing**: Expo Router (file-based routing in `src/app/`) |
| 10 | +- **Styling**: NativeWind (Tailwind CSS) - configure in `tailwind.config.js` |
| 11 | +- **Database**: Drizzle ORM with PostgreSQL - schemas in `src/db/schema/` |
| 12 | +- **Navigation**: React Navigation v7 (native stack + bottom tabs) |
| 13 | +- **Testing**: Jest + React Testing Library |
| 14 | +- **Architecture**: React Native New Architecture enabled (required for Worklets/Reanimated) |
| 15 | + |
| 16 | +## Development Workflow |
| 17 | +Use the **Justfile** for all development commands: |
| 18 | + |
| 19 | +```bash |
| 20 | +just dev # Start Expo dev server |
| 21 | +just android # Build and run on Android device/emulator |
| 22 | +just ios # Build and run on iOS simulator |
| 23 | +just check # Run lint, format check, typecheck, and tests |
| 24 | +just format # Fix formatting issues |
| 25 | +just test # Run tests |
| 26 | +just clean # Clean build artifacts and caches |
| 27 | +``` |
| 28 | + |
| 29 | +## Key Files |
| 30 | +- `src/app/` - Expo Router screens (file-based routing) |
| 31 | +- `src/components/` - Reusable components |
| 32 | +- `src/db/` - Drizzle ORM client and schemas |
| 33 | +- `src/services/` - API and external service integrations |
| 34 | +- `src/utils/` - Utility functions (including `cn()` for class merging) |
| 35 | +- `Justfile` - Development commands |
| 36 | +- `app.json` - Expo configuration |
| 37 | + |
| 38 | +## Styling with NativeWind |
| 39 | +Use Tailwind classes directly in components: |
| 40 | +```tsx |
| 41 | +<View className="flex-1 items-center justify-center bg-white"> |
| 42 | + <Text className="text-2xl font-bold text-gray-900">Hello</Text> |
| 43 | +</View> |
| 44 | +``` |
| 45 | + |
| 46 | +Use `cn()` utility for conditional classes: |
| 47 | +```tsx |
| 48 | +import { cn } from '@/utils/cn'; |
| 49 | +<View className={cn("p-4", isActive && "bg-blue-500")} /> |
| 50 | +``` |
| 51 | + |
| 52 | +## Database (Drizzle ORM) |
| 53 | +Define schemas in `src/db/schema/`: |
| 54 | +```typescript |
| 55 | +import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core'; |
| 56 | + |
| 57 | +export const items = pgTable('items', { |
| 58 | + id: serial('id').primaryKey(), |
| 59 | + name: text('name').notNull(), |
| 60 | + createdAt: timestamp('created_at').defaultNow(), |
| 61 | +}); |
| 62 | +``` |
| 63 | + |
| 64 | +Run migrations with: `just migrate` |
| 65 | + |
| 66 | +## Testing with Waydroid (Linux) |
| 67 | +For testing on Linux without a physical device: |
| 68 | +1. Start Expo: `just dev` |
| 69 | +2. Set up ADB: `adb reverse tcp:8081 tcp:8081` |
| 70 | +3. Launch app: `adb shell am start -n com.template.app/.MainActivity` |
| 71 | + |
| 72 | +## EAS Build (Production) |
| 73 | +For production builds, see README.md for EAS setup instructions. |
| 74 | + |
| 75 | +## Important Notes |
| 76 | +- Always run `just check` before committing |
| 77 | +- The template uses Yarn Berry v4 with `node_modules` linker |
| 78 | +- New Architecture is enabled in `android/gradle.properties` (required for Worklets) |
| 79 | +- Keep dependencies updated to match Expo SDK version expectations |
0 commit comments