reactnativehexagen
v1.0.2
Published
Enterprise-Grade Hexagonal Architecture Scaffolding for React Native (Expo/CLI)
Maintainers
Readme
📱 ReactNativeHexaGen
Enterprise-Grade Hexagonal Architecture Scaffolding for React Native
ReactNativeHexaGen is a powerful CLI tool designed by Vortex Solutions to jumpstart high-performance, testable, and maintainable React Native applications. It enforces a strict separation of concerns, allowing your core business logic to remain agnostic of infrastructure, frameworks, and UI.
🚀 Features
- 🛡️ Hexagonal Architecture: Enforces Domain, Application, and Infrastructure layers out of the box.
- 💉 Flexible DI: Choose between Awilix (Proxy-based), TSyringe (Decorators), or Manual Dependency Injection.
- 📦 Managed & Bare: Optimized for Expo (Managed Workflow + Expo Router) but supports Bare CLI.
- ⚡ High Performance: Native integration with MMKV for lightning-fast storage.
- 🧪 Automated Testing: Generates Jest unit tests automatically for every entity and use case.
- 🛑 Enterprise Error Handling: Global
AppErrorandDomainExceptionhierarchy. - 🔍 Validation: Integrated with Zod for bulletproof DTO validation.
🛠️ Installation
Use directly with NPX (Recommended)
You don't need to install anything. Just run:
npx reactnativehexagen init MyAwesomeAppGlobal Installation
If you prefer to have the command available everywhere:
npm install -g reactnativehexagen
reactnativehexagen init MyAwesomeAppLocal Development (Contributing)
If you want to contribute to the CLI:
git clone ...
cd ReactNativeHexaGen
npm install
npm run build
npm link📖 Usage
Initialize a new project
reactnativehexagen init MyAwesomeAppThe CLI will guide you through selecting your environment (Expo/Bare), DI Strategy, and Storage engine.
Generate a new Resource (Feature)
reactnativehexagen gen:resource UserThis will automatically scaffold:
src/domain/entities/User.tssrc/domain/entities/User.test.tssrc/domain/repositories/IUserRepository.tssrc/application/usecases/GetUserUseCase.tssrc/application/usecases/GetUserUseCase.test.ts
🏗️ Architecture Overview
The "Thin Wrapper" Pattern
When using Expo Router, ReactNativeHexaGen implements a "Thin Wrapper" to prevent navigation logic from leaking into your core. The app/ folder contains only minimal entry points that instantiate the dependency container and import the actual screens from src/presentation/.
Dependency Injection Context
We provide a React Context bridge (DIContext) to access your services cleanly:
const getUserUseCase = useDependency<GetUserUseCase>('getUserUseCase');📜 License
Distributed under the MIT License. See LICENSE for more information.
Developed with ❤️ by rbaezc (Raul Baez Camarillo). "Architecture is the art of making the complex simple."
