Provider-agnostic AI generation orchestration for React Native with result preview components
npm install @umituz/react-native-ai-generation-content> Provider-agnostic AI generation orchestration for React Native
Comprehensive React Native library for AI-powered content generation. Support multiple providers with 25+ AI features including image generation, video creation, text-to-speech, face swap, and more.
Provider-agnostic AI generation orchestration layer. Focus on business logic and user experience while handling multiple AI providers seamlessly. Clean architecture with domain-driven design for maintainable, scalable AI features.
---
---
``bash`
npm install @umituz/react-native-ai-generation-content
`typescript
import { configureAppServices } from '@umituz/react-native-ai-generation-content';
configureAppServices({
networkService: {
baseUrl: 'https://your-api.com',
apiKey: 'your-api-key',
},
creditService: {
checkCredits: async (userId, cost) => true,
deductCredits: async (userId, cost) => {},
},
paywallService: {
showPaywall: async () => true,
},
});
`
`typescript
import { useTextToImageFeature } from '@umituz/react-native-ai-generation-content';
const feature = useTextToImageFeature({
config: {
model: 'imagen-3',
onProcessingComplete: (result) => {
console.log('Generated:', result.imageUrl);
},
},
userId: 'user-123',
});
// Use feature.state, feature.generate(), etc.
`
---
1. Configuration
- MUST configure app services before using features
- MUST provide valid userId for tracking
- MUST implement credit checking
- MUST handle errors properly
2. State Management
- MUST check isReady before enabling actions
- MUST handle isProcessing state
- MUST display progress to users
- MUST implement error handling
3. Performance
- MUST implement debouncing (300ms)
- MUST cache results locally
- MUST handle large files properly
- MUST NOT block main thread
4. Privacy & Ethics
- MUST obtain consent for person-based features
- MUST implement content moderation
- MUST comply with regulations
- MUST provide clear usage terms
---
ā NEVER:
- Skip configuration
- Use without userId
- Ignore error handling
- Process without user action
- Violate privacy/consent
- Block main thread
- Hardcode API keys
---
When implementing with AI code generation:
`
REQUIREMENTS:
1. Import from @umituz/react-native-ai-generation-content
2. Configure app services first
3. Use feature-specific hooks
4. Implement proper state management
5. Handle errors gracefully
6. Show progress to users
7. Implement cleanup on unmount
CRITICAL RULES:
- MUST configure before using features
- MUST provide valid userId
- MUST check isReady before actions
- MUST handle isProcessing state
- MUST implement error handling
- MUST respect user privacy
FEATURE HOOKS:
- useTextToImageFeature: Image generation
- useFaceSwapFeature: Face swapping
- useTextToVoiceFeature: Text-to-speech
- And 20+ more features
STRICTLY FORBIDDEN:
- No skipping configuration
- No missing userId
- No ignoring errors
- No auto-processing
- No privacy violations
- No blocked UI
- No hardcoded credentials
`
---
``
@umituz/react-native-ai-generation-content/
āāā src/
ā āāā features/ # 23 AI features (each with README)
ā ā āāā text-to-image/
ā ā āāā face-swap/
ā ā āāā ...
ā āāā domains/ # Shared domains
ā ā āāā content-moderation/
ā ā āāā prompts/
ā ā āāā creations/
ā ā āāā face-detection/
ā āāā features/shared/ # Shared functionality
āāā docs/ # Additional documentation
āāā ARCHITECTURE.md # Architecture details
āāā FAQ.md # Common questions
āāā MIGRATION_GUIDE.md # Migration guide
Each feature has comprehensive documentation:
- Import paths (only code in README)
- Usage strategy (when to use/not use)
- Critical rules (MUST follow)
- Prohibitions (MUST avoid)
- AI agent directions (prompt templates)
- Configuration strategy
- State management
- Best practices
- Common pitfalls
Example: See src/features/text-to-image/README.md
---
``
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Presentation Layer ā
ā (Components, Hooks) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Domain Layer ā
ā (Types, Interfaces) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Infrastructure Layer ā
ā (Services, Repositories) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
- Separation of Concerns: Each layer has specific responsibility
- Dependency Inversion: Depend on abstractions, not implementations
- Provider Agnostic: Support multiple AI providers
- Type Safety: Comprehensive TypeScript types
- Testability: Clean, testable code
---
---
---
Contributions welcome! Please:
- Follow code style
- Add tests
- Update docs
- Submit PR
See CONTRIBUTING.md
---
MIT
---
- Issues: GitHub Issues
- Docs: /docs` folder
- FAQ: FAQ.md
- Migration: MIGRATION_GUIDE.md
---
Version: 2.0.0 (Strategy-based Documentation)
Last Updated: 2025-01-08