Universal React Native "LEGO Platform" CLI
Generate a clean Base App (Expo or Bare RN) and then install Capabilities (Plugins) safely β zero manual setup, permission-aware, conflict-aware, idempotent.
Quick Start β’ Key Features β’ Generated App Structure β’ Plugin Catalog β’ Docs β’ Contributing
CliMobile is a React Native project generator + expander built around a strict model:
- Base App:
rns initcreates a runnable project (Expo or Bare React Native) that boots immediately. - Plugins (Capabilities):
rns plugin add <id...>installs infrastructure capabilities endβtoβend (deps + runtime wiring + native/config patch ops + permissions + manifest update). - Modulator Engine: the deterministic installer pipeline (Plan β Apply β Verify) that makes installs repeatable.
React Native projects become brittle when infrastructure is added manually:
- "paste this provider into App.tsx"
- "edit AndroidManifest / Info.plist / Gradle / Podfile"
- "this package conflicts with that package"
- "upgrade broke wiring again"
CliMobile solves this by enforcing ownership zones and using data-driven plugin descriptors + idempotent patch operations.
| Traditional RN Setup | With CliMobile |
|---|---|
| β±οΈ Manual config edits | β‘ Automated generation |
| π§© Copy/paste glue code | π§± Plugins install end-to-end |
| 𧨠Native config conflicts | β Conflict-aware installs |
| π Repeating starter work | β»οΈ Reusable CORE + plugins |
| π΅ Late conflict discovery | π§ Slot-based conflict model |
| π Permission tribal knowledge | π Permission IDs β mapped |
- Base first, then plugins. Base App is always runnable.
- Zero manual setup for shipped plugins. If we ship it, the CLI installs it fully.
- Idempotent operations. Run the same command twice β NO duplicates.
- No user-zone edits. Your business code (
src/**) stays clean by default. - Block only real conflicts. Slot conflicts (single vs multi) prevent only true incompatibilities.
- Docs-first contracts. If code and
docs/cli-interface-and-types.mddiverge β treat as a bug.
npm i -g climobile
# or: pnpm add -g climobile
# or: yarn global add climobileVerify:
rns --help
rns --versionValidate your machine before generating a project:
rns doctor --envExpo:
rns init MyApp --target expo --lang ts --pm pnpm
cd MyApp
pnpm startBare RN:
rns init MyApp --target bare --lang ts --pm pnpm --platforms ios,android
cd MyApp
pnpm ios
pnpm androidrns plugin list
rns plugin add data.react-query storage.mmkv state.zustand --dry-run
rns plugin add data.react-query storage.mmkv state.zustand
rns doctorThe Base App is designed to be a stable foundation for any app archetype (online, offline-first, marketplace, chat, real-estate, etc.):
- Ownership zones (System vs User) enforced
- Workspace packages layout under
packages/@rns/** - Runtime composition layer under
packages/@rns/runtime/** - Kernel contracts + safe defaults under
packages/@rns/core/** - DX baseline: aliases (
@/), SVG, fonts, env pipeline (no manual setup) - Project manifest
.rns/rn-init.json(single source of truth) - Doctor tooling: environment + project validation gates
- Navigation infrastructure (Bare RN): React Navigation presets with registry-based screen registration (see
docs/navigation.md)
CORE provides contracts and defaults. Concrete capabilities (auth, adapters, payments, etc.) come from plugins.
Each plugin is a declarative blueprint (descriptor) that can express:
- support rules (Expo/Bare + Expo runtime constraints)
- slot conflicts (single vs multi)
- permission IDs (resolved via dataset)
- runtime contributions (ASTβonly; tsβmorph; symbol references)
- patch operations (native/config edits; anchored; idempotent; backed up)
- required npm deps (pm-aware install)
- Plan first (
--dry-run) β see exactly what will change - Backups before patching under
.rns/backups/<timestamp>/... - Re-run safe: apply twice is either a NOβOP or a clean reconcile
- Doctor gates to prevent halfβapplied / broken states
User Zone = your business code (
src/**)
System Zone = CLI-managed (packages/@rns/**+.rns/**)
MyApp/
βββ .rns/ # SYSTEM: manifest, logs, backups
β βββ rn-init.json # Project Manifest (source of truth)
βββ index.js # Bare only: Metro entry (main); imports App, AppRegistry
βββ src/ # USER: your business code (CLI must not edit)
βββ packages/ # SYSTEM: CLI-managed workspace packages
β βββ @rns/
β βββ core/ # kernel contracts + safe defaults
β βββ runtime/ # runtime composition + wiring (entry index.tsx)
β βββ plugin-*/ # installed plugins as local packages
βββ ... # Expo/Bare native scaffolding (target-specific)Bare entry: index.js is the Metro entry; package.json has "main": "index.js". Expo uses index.ts/index.js per template.
Key principle: plugins integrate via packages/@rns/runtime/**, not by patching your src/**.
Navigation (Bare RN): The CORE navigation system (packages/@rns/navigation/**) includes React Navigation with preset support (stack, tabs, drawer, modals). Users can register their own screens from User Zone via a registry file (src/app/navigation/registry.ts) without modifying System Zone. See docs/navigation.md for complete guide.
| Capability | Targets | Notes |
|---|---|---|
Workspace packages (packages/@rns/**) |
Expo + Bare | Isolation and maintainability |
Runtime composition (@rns/runtime) |
Expo + Bare | Single wiring hub |
Kernel contracts (@rns/core) |
Expo + Bare | Stable, additive contracts + defaults |
| Ownership zones | Expo + Bare | CLI edits System Zone only |
Manifest (.rns/rn-init.json) |
Expo + Bare | Project passport + migrations |
Doctor (doctor --env, doctor) |
Expo + Bare | Safety gate for changes |
| DX baseline (alias/SVG/fonts/env) | Expo + Bare | Zero manual setup |
| CI/CD Workflows (GitHub Actions templates) | Expo + Bare | |
| Theme System (dark/light) | Expo + Bare | Theme provider + tokens |
| Splash Screen | Expo + Bare | Boot splash screen |
| Feature Flags Registry | Expo + Bare | Local feature flags (extendable by plugins) |
| Code Quality Tools (Prettier, Husky, ESLint) | Expo + Bare | Formatting, git hooks, linting |
| Navigation Infrastructure | Expo + Bare | React Navigation presets (Bare RN). Registry-based screen registration (see docs/navigation.md) |
| Cache Engine | Expo + Bare | Snapshot cache contract + in-memory default |
| UI Components | Expo + Bare | Minimal UI components (MinimalUI, basic components) |
| Development Scripts | Expo + Bare | Clean, and other dev scripts (beyond doctor) |
This is a capability catalog. Concrete shipped plugin IDs and their exact support rules live in the plugin catalog & docs.
| Category | Examples (IDs) | Slot mode |
|---|---|---|
| Navigation root | nav.react-navigation, nav.expo-router |
single |
| UI framework | ui.paper, ui.tamagui, ui.nativebase |
single |
| Animations | animation.reanimated, animation.lottie |
multi |
| State | state.zustand, state.xstate, state.mobx |
multi |
| Data fetching / cache | data.react-query, data.apollo, data.swr |
multi |
| Network transport | transport.axios, transport.fetch, transport.graphql, transport.websocket, transport.firebase |
multi |
| Auth | auth.firebase, auth.cognito, auth.auth0, auth.custom-jwt |
multi |
| AWS Services | aws.amplify, aws.appsync, aws.dynamodb, aws.s3 |
multi |
| Storage | storage.mmkv, storage.sqlite, storage.secure, storage.filesystem |
multi |
| Firebase Products | firebase.firestore, firebase.realtime-database, firebase.storage, firebase.remote-config |
multi |
| Offline-first | offline.netinfo, offline.outbox, offline.sync |
multi |
| Notifications | notify.expo, notify.fcm, notify.onesignal |
multi |
| Maps / location | geo.location, maps.google |
multi |
| Camera / media | media.camera, media.vision-camera, media.picker |
multi |
| Payments | pay.stripe |
multi |
| Subscriptions / IAP | iap.revenuecat, iap.adapty, iap.app-store, iap.play-billing |
single |
| Analytics / observability | analytics.firebase, analytics.amplitude, obs.sentry, obs.bugsnag |
multi |
| i18n | i18n.i18next, i18n.lingui |
multi |
| Search | search.algolia, search.local-index |
multi |
| OTA Updates | ota.expo-updates, ota.code-push |
single |
| Background Tasks | background.tasks, background.geofencing, background.fetch |
multi |
| Privacy & Consent | privacy.att, privacy.consent, privacy.gdpr |
multi |
| Device / Hardware | device.biometrics, device.bluetooth |
multi |
| Testing | test.detox |
multi |
Every plugin declares support:
- Targets:
expo | bare | both - Expo runtime:
expo-go | dev-client | standalone(when relevant) - Platforms:
ios | android | web(optional)
The CLI must refuse incompatible installs early with clear errors.
Plugins declare permission IDs, not raw platform strings.
- Dataset:
docs/plugins-permissions.md - The CLI resolves IDs into:
- iOS
Info.plistkeys (+ notes) - Android
AndroidManifestpermissions/features (+ notes) - provider SDK notes (Expo module vs bare provider)
- iOS
When you run rns plugin add <id>, the engine executes:
- Doctor gate (project initialized + env sane)
- Plan (deps, slots, permissions, patch ops, runtime ops)
- Scaffold (ensure plugin packages exist in System Zone)
- Link (workspace + pm-aware installs)
- Wire runtime (AST edits only; ts-morph; symbol refs)
- Patch native/config (declarative ops; idempotent; backed up)
- Update manifest (single source of truth)
- Verify (no duplicates; markers/anchors intact)
rns init ShopApp --target expo --lang ts
rns plugin add pay.stripe auth.firebase storage.mmkv state.zustandResult: Full payment processing, authentication, fast storage, and state management β zero manual wiring.
rns init SocialApp --target bare --lang ts
rns plugin add notify.fcm media.camera geo.location data.react-queryResult: Push notifications, camera access, location services, and data fetching β all configured automatically.
rns init OfflineApp --target expo --lang ts
rns plugin add offline.netinfo offline.outbox storage.sqliteResult: Connectivity detection, offline queue, and local database β ready for sync logic.
- β Core Features: Base app generation (Expo/Bare), plugin system foundation, CORE baseline
- β Completed: CLI foundation, init pipeline, DX baseline, docs contract
- π§ In Progress: Template packs system, dynamic attachment engine, marker patcher
- π Roadmap: See
docs/TODO.mdfor detailed work order (23 sections total)
All canonical documentation lives under docs/:
docs/README.mdβ high-level product model + quick start (canonical version)docs/TODO.mdβ single work-order (execute top-to-bottom)docs/WORKFLOW.mdβ repo execution rules (run/verify/commit/no regressions)docs/AGENT.mdβ AI agent rules (scope control + acceptance checks)docs/cli-interface-and-types.mdβ canonical contracts/types (no duplicated schema elsewhere)docs/plugins-permissions.mdβ permission IDs dataset + platform mappingdocs/navigation.mdβ navigation registry system guide (Bare RN projects)
π Canonical Docs Contract (for maintainers)
The following six documents form the canonical, non-duplicated documentation set. This contract ensures work can be delegated safely without schema duplication or intent loss.
docs/README.mdβ high-level product model + quick startdocs/TODO.mdβ single work-order (execute top-to-bottom)docs/WORKFLOW.mdβ repo execution rules (run/verify/commit/no regressions)docs/AGENT.mdβ AI agent rules (scope control + acceptance checks)docs/cli-interface-and-types.mdβ canonical type names/shapes index (no duplicated schema elsewhere)docs/plugins-permissions.mdβ permission IDs dataset + platform mapping
Documentation Rules:
- Do not shrink or delete intent β if content is too long, move it to a dedicated doc instead of removing it
- No schema duplication β type definitions live in
cli-interface-and-types.md; other docs reference it - Cross-reference, don't duplicate β docs should reference each other, not copy content
- Source of truth β TypeScript code is authoritative; docs describe the contracts
Canonical dev runner (must behave like released CLI):
npm run cli -- --help
npm run cli -- doctor --env
npm run cli -- init MyApp --target expoWorkflow rules (mandatory):
- Work strictly topβtoβbottom from the first unchecked section in
docs/TODO.md - Unit of work = one TODO section = one commit
- No driveβby refactors, no scope creep, no regressions
See: docs/WORKFLOW.md.
ISC