Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CRUDREX - Mock JSON Server

A modern mock JSON server for testing HTTP requests and learning CRUD operations - Available in Python and JavaScript!

CRUDREX helps you quickly set up a mock REST API server for testing your applications, learning CRUD operations, or prototyping without needing a real backend.

πŸš€ Quick Start - Choose Your Version

🐍 Python Version (Original)

PyPI

cd crudrex-py
pip install -e .
crudrex

Installation

cd crudrex-py
pip install -r requirements.txt

Run Server

python crudrex/cli/cli.py
# or
crudrex

πŸ’» JavaScript/Node.js Version

Node.js

cd crudrex-js
npm install
npm start

Installation

cd crudrex-js
npm install

Run Server

npm start
# or
node src/cli.js

✨ Features (Both Versions)

  • πŸš€ Create collections dynamically on-the-fly
  • πŸ”„ Full CRUD operations (GET, POST, PUT, PATCH, DELETE)
  • πŸ’Ύ Automatic data persistence in JSON files
  • 🌐 CORS enabled for cross-origin requests
  • πŸ–₯️ Beautiful web interface with modern design
  • ⌨️ CLI interface for easy server management
  • πŸ“± Responsive design that works on all devices

πŸ“š Documentation

πŸ—‚οΈ Project Structure

crudrex/
β”œβ”€β”€ crudrex-py/          # Python version (Flask)
β”‚   β”œβ”€β”€ crudrex/         # Main package
β”‚   β”‚   β”œβ”€β”€ api/         # API server
β”‚   β”‚   └── cli/         # CLI interface
β”‚   β”œβ”€β”€ demo.py          # Demo script
β”‚   β”œβ”€β”€ README.md        # Python docs
β”‚   └── pyproject.toml   # Python config
β”‚
β”œβ”€β”€ crudrex-js/          # JavaScript version (Node.js)
β”‚   β”œβ”€β”€ src/             # Source code
β”‚   β”‚   β”œβ”€β”€ cli.js       # CLI interface
β”‚   β”‚   └── server.js    # API server
β”‚   β”œβ”€β”€ data/            # JSON data storage
β”‚   β”œβ”€β”€ README.md        # JavaScript docs
β”‚   └── package.json     # Node.js config
β”‚
β”œβ”€β”€ LICENSE              # MIT License
└── README.md            # This file

πŸ€” Which Version Should I Use?

Feature Python Version JavaScript Version
Best For Python developers Node.js/JavaScript developers
Framework Flask Express.js
Dependencies Lightweight npm ecosystem
Performance Fast for Python apps Better for JavaScript apps
Learning Understanding Python web Understanding Node.js web

πŸ”§ Configuration

Both versions support custom configuration:

  • Port: Default 3000
  • Data Directory: Auto-created for JSON storage
  • CORS: Enabled by default

πŸ“ Usage Examples

Create a Collection

# POST request to create a new collection
curl -X POST http://localhost:3000/api/users \
  -H "Content-Type: application/json" \
  -d '{"name": "John Doe", "email": "john@example.com"}'

Read Data

# GET all users
curl http://localhost:3000/api/users

# GET specific user
curl http://localhost:3000/api/users/1

Update Data

# PUT (replace)
curl -X PUT http://localhost:3000/api/users/1 \
  -H "Content-Type: application/json" \
  -d '{"name": "Jane Doe", "email": "jane@example.com"}'

# PATCH (partial update)
curl -X PATCH http://localhost:3000/api/users/1 \
  -H "Content-Type: application/json" \
  -d '{"email": "jane.new@example.com"}'

Delete Data

curl -X DELETE http://localhost:3000/api/users/1

🌐 Web Interface

Both versions come with a beautiful web interface available at:

http://localhost:3000

The interface allows you to:

  • View all collections and their data
  • Add, edit, and delete records
  • Test API endpoints interactively
  • Monitor request/response logs

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

Python Version:

cd crudrex-py
pip install -e .

JavaScript Version:

cd crudrex-js
npm install
npm run dev

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

TraxDinosaur

  • GitHub: @TraxDinosaur
  • Original Python Version & JavaScript Port

πŸ™ Acknowledgments


Note: Both versions (Python and JavaScript) offer identical functionality from a user's perspective. Choose the one that best fits your development environment and preferences.

About

A modern mock JSON server for testing HTTP requests and learning CRUD operations

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages