mockforge-cli
v1.0.0
Published
Dynamic API mocking framework for frontend developers
Maintainers
Readme
🚀 MockForge-CLI
MockForge-CLI is a dynamic API mocking framework for frontend developers, rapid prototyping, and testing.
It instantly generates realistic mock REST APIs with fake data, CRUD operations, delay simulation, and error handling using a simple configuration file.
Perfect for:
- Frontend development
- UI/UX testing
- API prototyping
- Hackathons
- Backend simulation
- Learning REST APIs
✨ Features
✅ Dynamic API generation
✅ Config-based endpoints
✅ Fake realistic data generation
✅ Full CRUD operations
✅ Delay simulation
✅ Error simulation
✅ Self-documenting API system
✅ In-memory database
✅ Scalable architecture
✅ Developer-friendly setup
✅ CLI command support
🧠 Why MockForge-CLI?
Frontend developers often get blocked because:
- backend APIs are not ready
- databases are incomplete
- authentication systems are unfinished
MockForge-CLI solves this by creating instant mock APIs that behave like real backend services.
⚡ Quick Start
Clone Repository
git clone https://github.com/YOUR_USERNAME/mockforge.git
cd mockforgeInstall Dependencies
npm installStart Development Server
npm run devServer runs at:
http://localhost:5000📦 Install as CLI Tool
Install globally:
npm install -g mockforge-cliRun MockForge-CLI:
mockforge-cli startInitialize default config:
mockforge-cli init🖥 CLI Commands
Start Server
mockforge-cli startStarts the MockForge API server.
Initialize Config File
mockforge-cli initCreates:
mockforge.config.jsonShow Help
mockforge-cli helpmeDisplays available commands.
Show Version
mockforge-cli --versionDisplays current package version.
⚙️ Configuration
MockForge-CLI uses a configuration file:
mockforge.config.jsonExample:
{
"users": 10,
"products": 20
}This automatically generates:
/api/users
/api/products📚 Available API Endpoints
Documentation Route
GET /api/docsReturns all available routes and examples.
👥 Users API
Get Users
GET /api/usersGet Limited Users
GET /api/users?count=5Simulate Delay
GET /api/users?delay=3000Simulates a 3-second network delay.
Simulate Server Error
GET /api/users?error=trueReturns:
{
"success": false,
"error": "Internal Server Error 💥"
}🛠 CRUD Operations
Create User
POST /api/usersBody:
{
"name": "Charan",
"email": "[email protected]"
}Update User
PUT /api/users/:idDelete User
DELETE /api/users/:id🏗 Project Structure
mockforge/
│
├── src/
│ ├── cli/
│ ├── config/
│ ├── database/
│ ├── generator/
│ ├── routes/
│ ├── server/
│ └── utils/
│
├── mockforge.config.json
├── package.json
└── README.md⚙️ Tech Stack
- Node.js
- Express.js
- Faker.js
- JavaScript (ES Modules)
- Commander.js
📸 Example Response
{
"success": true,
"route": "users",
"count": 2,
"data": [
{
"id": "a1b2c3",
"name": "John Doe",
"email": "[email protected]"
},
{
"id": "d4e5f6",
"name": "Jane Smith",
"email": "[email protected]"
}
]
}🤝 Contributing
Contributions are welcome.
Ideas, improvements, bug fixes, and feature requests are appreciated.
📄 License
MIT License
🚀 MockForge-CLI
Build frontend applications without waiting for backend APIs.
