React Architecture Engine for scalable frontend applications
Generate, structure, and manage React application architecture directly from your terminal.
ForgeCLI is a developer tool for building scalable and maintainable React applications through a plugin-driven architecture and AST-based code transformation.
Instead of manually managing deeply nested providers, imports, and application configuration, ForgeCLI lets developers compose application-level features through plugins.
forge add auth
forge add theme
forge add stateForgeCLI then determines the correct provider order, updates the application through AST transformations, and rebuilds the provider tree deterministically.
Define architecture as plugins. Let ForgeCLI manage the composition.
As React applications grow, application-level providers can quickly become difficult to manage.
A typical application might evolve into:
<AuthProvider>
<ThemeProvider>
<Router>
<StateProvider>
<QueryProvider>
<App />
</QueryProvider>
</StateProvider>
</Router>
</ThemeProvider>
</AuthProvider>This creates several problems:
- ❌ Manual provider nesting
- ❌ Provider ordering becomes difficult to reason about
- ❌ Duplicate providers and imports
- ❌ Repetitive application configuration
- ❌ Fragile code modifications
- ❌ Difficult-to-maintain architecture
ForgeCLI addresses this by treating providers as composable architectural plugins.
| Feature | Description |
|---|---|
| 🔌 Plugin Architecture | Add application capabilities through modular plugins |
| 🧠 AST Transformation | Safely modify React source code using Babel AST |
| ⚡ Priority Resolution | Automatically determine provider nesting order |
| ♻️ Idempotent Execution | Re-running commands does not duplicate providers |
| 🔄 Deterministic Rebuilds | Provider trees are rebuilt from plugin configuration |
| 📦 Automatic Imports | Detect and inject required imports |
| 🛠️ CLI Workflow | Manage architecture directly from the terminal |
| 🧩 Extensible Design | Designed for future community plugins |
ForgeCLI separates what a feature is from how it is inserted into the application.
A plugin can describe:
{
name: "auth",
provider: "AuthProvider",
priority: 1,
imports: [
"@/providers/AuthProvider"
]
}ForgeCLI uses this metadata to determine how the feature should be composed into the application.
For example:
Plugin Configuration
│
▼
Priority Sort
│
▼
Provider Tree
│
▼
AST Transformation
│
▼
Updated React Application
This allows architecture to become declarative rather than manually maintained.
Features are represented as plugins.
Example:
forge add auth
forge add theme
forge add stateA plugin can define:
- Provider component
- Required imports
- Priority
- Configuration
- Dependencies
- Future compatibility metadata
AuthProvider
Priority: 1
ThemeProvider
Priority: 10
StateProvider
Priority: 20
ForgeCLI resolves the order automatically.
Generated structure:
<AuthProvider>
<ThemeProvider>
<StateProvider>
<App />
</StateProvider>
</ThemeProvider>
</AuthProvider>ForgeCLI uses Babel AST tooling instead of fragile string or regex manipulation.
Rather than searching for text such as:
<App />
and injecting code around it, ForgeCLI works with the actual structure of the JavaScript/TypeScript program.
React Source File
│
▼
Parse AST
│
▼
Analyze Application Tree
│
▼
Extract Providers
│
▼
Resolve Plugin Order
│
▼
Rebuild Provider Tree
│
▼
Inject Required Imports
│
▼
Generate Source Code
AST-based transformations provide:
- ✅ Structural code awareness
- ✅ Safer transformations
- ✅ Less fragile than regex
- ✅ Better handling of nested JSX
- ✅ Easier future extensibility
- ✅ Cleaner architectural manipulation
Provider order can matter.
For example:
AuthProvider → Priority 1
ThemeProvider → Priority 10
StateProvider → Priority 20
ForgeCLI sorts providers by priority before constructing the final tree.
<AuthProvider>
<ThemeProvider>
<StateProvider>
<App />
</StateProvider>
</ThemeProvider>
</AuthProvider>This removes the need for developers to manually remember provider ordering.
ForgeCLI follows a rebuild-oriented architecture.
Instead of continuously applying patches to an already modified provider tree, ForgeCLI can reconstruct the desired structure from the current plugin configuration.
Current Application
│
▼
Extract Existing Structure
│
▼
Identify Managed Providers
│
▼
Resolve Plugin Configuration
│
▼
Sort By Priority
│
▼
Rebuild Provider Tree
│
▼
Generate Source
This provides:
- Predictable output
- Easier debugging
- Reduced provider conflicts
- Cleaner transformations
- Better repeatability
ForgeCLI is designed to make repeated operations safe.
Running:
forge add auth
forge add authshould not result in:
<AuthProvider>
<AuthProvider>
<App />
</AuthProvider>
</AuthProvider>Instead, ForgeCLI recognizes that the provider already exists.
First execution
↓
Add AuthProvider
Second execution
↓
Detect existing provider
↓
No duplicate insertion
The same principle applies to imports.
ForgeCLI manages imports required by plugins.
For example, when adding authentication:
import { AuthProvider } from "@/providers/AuthProvider";ForgeCLI can:
- Detect existing imports
- Add missing imports
- Avoid duplicate imports
- Keep transformations consistent
This keeps generated application code clean.
Install ForgeCLI globally using npm:
npm install -g @shubham12568/forgecliVerify the installation:
forge --versionCreate a new application:
forge create my-appMove into the project:
cd my-appAdd application features:
forge add auth
forge add themeView available templates:
forge listInspect a template:
forge info react-tsInstall a plugin:
forge install plugin-name| Command | Purpose |
|---|---|
forge create <name> |
Create a new application |
forge add <plugin> |
Add a feature/plugin |
forge list |
List available templates or plugins |
forge info <name> |
Display template/plugin information |
forge install <plugin> |
Install a plugin |
forge --version |
Display installed ForgeCLI version |
┌─────────────────┐
│ User Command │
└────────┬────────┘
│
▼
┌─────────────────┐
│ ForgeCLI │
│ Engine │
└────────┬────────┘
│
┌─────────────┼─────────────┐
▼ ▼ ▼
┌──────────┐ ┌────────────┐ ┌─────────────┐
│ Plugin │ │ Config │ │ CLI │
│ System │ │ Loader │ │ Commands │
└────┬─────┘ └─────┬──────┘ └─────────────┘
│ │
└──────┬──────┘
▼
┌───────────────┐
│ AST Parser │
│ (Babel) │
└───────┬───────┘
│
▼
┌───────────────────┐
│ Provider Analysis │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ Priority Resolver │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ Provider Rebuild │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ Code Generator │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ React Application │
└───────────────────┘
ForgeCLI/
│
├── src/
│ ├── cli/
│ │ └── commands/
│ │
│ ├── core/
│ │ ├── astModifier.ts
│ │ ├── rebuildProviders.ts
│ │ └── providerResolver.ts
│ │
│ ├── plugins/
│ │
│ ├── templates/
│ │
│ └── utils/
│ ├── logger.ts
│ └── error-handler.ts
│
├── templates/
│ └── react-app/
│
├── plugins/
│
├── tests/
│
├── package.json
├── tsconfig.json
└── README.md
The exact structure may evolve as ForgeCLI grows. The architecture is intentionally modular so new commands, plugins, and transformation strategies can be introduced without tightly coupling the core engine.
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);Run:
forge add auth
forge add themeimport React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import { AuthProvider } from "@/providers/AuthProvider";
import { ThemeProvider } from "@/providers/ThemeProvider";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<AuthProvider>
<ThemeProvider>
<App />
</ThemeProvider>
</AuthProvider>
</React.StrictMode>
);The developer does not need to manually construct or reorder the provider tree.
Application capabilities should be composable through configuration rather than manually maintained boilerplate.
Feature → Plugin → Configuration → Generated Architecture
ForgeCLI operates on the structure of the source code rather than blindly modifying strings.
Regex
↓
Text Matching
↓
Fragile Transformations
versus:
AST
↓
Structural Analysis
↓
Intentional Transformation
↓
Predictable Output
ForgeCLI favors deterministic reconstruction of managed provider trees instead of accumulating fragile modifications.
Plugin State
↓
Resolve
↓
Rebuild
↓
Generate
Plugins should not need to know about every other plugin.
Each plugin declares its own priority and ForgeCLI handles composition.
Plugin A ──┐
Plugin B ──┼──> Priority Resolver ──> Provider Tree
Plugin C ──┘
Running the same operation multiple times should produce the same architectural result.
forge add auth
forge add auth
forge add auth
↓
One AuthProvider
One Import
Predictable Output
ForgeCLI is currently under active development.
The core architecture focuses on:
- Plugin-driven feature composition
- React provider management
- Babel AST transformations
- Priority-based provider resolution
- Deterministic rebuilds
- Idempotent CLI operations
APIs and plugin interfaces may evolve as the project develops.
Contributions are welcome.
If you have an idea, improvement, or bug fix:
- Open an issue
- Discuss the proposed change
- Fork the repository
- Create a feature branch
- Submit a pull request
For larger architectural changes, opening an issue first is recommended.
ForgeCLI is released under the MIT License.
Shubham Srivastava
Building developer tools, full-stack applications, and AI-powered systems.
⚒️ Forge your React architecture.
Built for developers who want architecture to scale with their applications.