Loading repository dataβ¦
Loading repository dataβ¦
kuraydev / repository
π€ AI-Ready React Native + TypeScript Boilerplate OpenAI Β· Anthropic Β· Gemini built in. New Architecture, streaming chat, typed themes, path aliases & more β production-ready from day one.
AI-Ready. Production-grade React Native + TypeScript boilerplate with a built-in, provider-agnostic AI service layer. Wire up OpenAI, Anthropic Claude, Google Gemini β or any LLM β in minutes, not days.
[!TIP] Works great with AI coding assistants. This repo ships with purpose-built guidance files so Cursor, Claude Code, GitHub Copilot, Windsurf, and Gemini CLI all understand the project conventions out of the box:
File Used by CLAUDE.mdClaude Code AGENTS.mdWindsurf Β· Codex CLI Β· Gemini CLI .cursor/rules/Cursor .github/copilot-instructions.mdGitHub Copilot
[!NOTE] All screens, components, and mock data included in this boilerplate are for demonstration purposes only. They exist to showcase the architecture, theming, navigation, and AI service layer β not to be kept as-is. Feel free to delete any screen, component, or piece of mock data and replace it with your own.
useAIChat hook β multi-turn conversations with streaming support, zero boilerplateuseAICompletion hook β single-shot completions for text generation, classification, summarizationRNAIMessage component β role-aware chat bubble with live streaming cursorCLAUDE.md, AGENTS.md, .cursor/rules/, .github/copilot-instructions.md so every AI coding assistant understands this codebase@hooks path alias β clean imports for all custom hooksnewArchEnabled=true, Bridgeless / JSI)react-native-reanimated v4 + react-native-workletsprettier + lint on every commit, commitlint on commit message)| Feature | Description |
|---|---|
| AI Service | Provider-agnostic sendAIMessage() + streamAIMessage() β works with OpenAI, Anthropic, Gemini, or any compatible API |
useAIChat | Multi-turn conversation hook with history, streaming, error state, and system prompt management |
useAICompletion | Single-shot completion hook β perfect for generation, summarization, translation, classification |
RNAIMessage | Role-aware chat bubble component (user / assistant / system) with streaming cursor |
| AI Chat Screen | Live demo screen with provider selector, API key input, model name field, streaming toggle |
| AI Guidance Files | CLAUDE.md Β· AGENTS.md Β· .cursor/rules/ Β· .github/copilot-instructions.md |
| Feature | Library |
|---|---|
| Navigation | @react-navigation/native Β· @react-navigation/stack Β· @react-navigation/bottom-tabs |
| Navigation helpers | react-navigation-helpers β push/pop/navigate without component refs |
| HTTP | axios + axios-hooks |
| Animations | react-native-reanimated v4 + react-native-gesture-handler |
| Icons | react-native-vector-icons + react-native-dynamic-vector-icons |
| Localization | i18next + react-i18next |
| Safe Area | react-native-safe-area-context |
| Splash Screen | react-native-splash-screen |
@screens, @services, @hooks, @fonts, @theme, β¦)h1βh6, bold, italic props, global font swap in one filegit clone https://github.com/kuraydev/react-native-typescript-boilerplate.git my-app
cd my-app
npm install
cd ios && pod install && cd ..
Create android/local.properties:
# macOS / Linux
sdk.dir=/Users/<your-username>/Library/Android/sdk
# Windows
sdk.dir=C:\\Users\\<your-username>\\AppData\\Local\\Android\\Sdk
# iOS
npm run ios
# Android
npm run android
| Command | Description |
|---|---|
npm start | Start Metro bundler |
npm run start:fresh | Start Metro with cache reset β use this after adding path aliases |
npm run ios | Run on iOS simulator |
npm run android | Run on Android emulator |
npm run lint | ESLint |
npm run prettier | Prettier β auto-format all files in src/ |
npm test | Jest |
npm run prepare | Initialize Husky hooks (runs automatically after npm install) |
npm run clean:showcase | Remove showcase/demo content and replace screens with minimal stubs |
The included screens (Home, Search, Notifications, Settings) are demo UIs that showcase the architecture. Once you've explored the boilerplate, run:
npm run clean:showcase
This will:
src/screens/home/mock/ (FeatureCards, UtilityItems, StackItems)src/screens/home/components/ (CardItem)npx react-native-rename <YourAppName>
For a custom Android bundle identifier:
npx react-native-rename <YourAppName> -b com.yourcompany.appnameFor iOS, change the bundle identifier in Xcode.
All aliases are defined in babel.config.js and tsconfig.json. Always prefer aliases over relative imports.
| Alias | Resolves to |
|---|---|
@screens/* | src/screens/* |
@services/* | src/services/* |
@hooks | src/hooks/index |
@shared-components | src/shared/components |
@shared-constants | src/shared/constants |
@fonts | src/shared/theme/fonts |
@font-size | src/shared/theme/font-size |
@theme/* | src/shared/theme/* |
@colors | src/shared/theme/colors |
@models | src/services/models |
@utils | src/utils |
@assets | src/assets |
@event-emitter | src/services/event-emitter |
@api | src/services/api/index (stub) |
@local-storage | src/services/local-storage (stub) |
Example:
// Instead of: ../../../../shared/components/text-wrapper/TextWrapper
import Text from "@shared-components/text-wrapper/TextWrapper";
// Instead of: ../../hooks/useAIChat
import { useAIChat } from "@hooks";
After adding a new alias to both
babel.config.jsandtsconfig.json, runnpm run start:freshto reset Metro's cache.
The AI layer is provider-agnostic β the same API, types, and hooks work regardless of whether you're using OpenAI, Anthropic, Gemini, or any other LLM provider. Model names are never hardcoded; you supply whatever model string your API key supports.
src/services/ai/types.ts)interface AIConfig {
provider: "openai" | "anthropic" | "gemini";
apiKey: string;
model?: string; // you supply the model β no defaults enforced
temperature?: number; // defaults to 0.7
maxTokens?: number; // defaults to 1024
systemPrompt?: string;
baseURL?: string; // override for proxies or local LLMs (e.g. Ollama)
}
interface AIMessage {
id: string;
role: "user" | "assistant" | "system";
content: string;
timestamp: number;
}
useAIChat β multi-turn conversationsimport { useAIChat } from "@hooks";
const {
messages, // AIMessage[] β full conversation history
isLoading, // true while awaiting a full response
isStreaming, // true while tokens are arriving
error, // Error | null
sendMessage, // (content: string) => Promise<void> β full response
streamMessage, // (content: string) => Promise<void> β live tokens
clearMessages,
setSystemPrompt,
} = useAIChat({
config: {
provider: "openai", // or "anthropic" or "gemini"
apiKey: userApiKey,
model: "your-model", // you decide β e.g. "gpt-4o-mini"
},
});
// Full response β UI updates once reply is complete
await sendMessage("Explain React hooks in one paragraph");
// Streaming β the last assistant message updates token by token
await streamMessage("Write a React Native FlatList example");
// Inject a system instruction at any time
setSystemPrompt("You are a concise senior React Native engineer.");
useAICompletion β single-shot completionsimport { useAICompletion } from "@hooks";
const { complete, result, isLoading, error, reset } = useAICompletion({
config: { provider: "anthropic", apiKey: key, model: "your-model" },
systemPrompt: "Classify sentiment as: positive, neutral, or negative.",
});
const sentiment = await complete(userReview);
import { sendAIMessage, streamAIMessage, buildUserMessage, buildSystemMessage } from "@services/ai";
const messages = [
buildSystemMessage("You are a helpful assistant."),
buildUserMessage("Hello!"),
];
// Full response
const response = await sendAIMessage(messages, config);
console.log(response.message.content);
console.log(response.usage?.totalTokens);
// Streaming
awai