Complete REST API that works 100% in the browser
A replacement for json-server without Node.js dependencies or external servers
RESTless is a simulated REST API with data persistence that works entirely in the browser. It provides all the functionality of json-server without requiring Node.js or any backend services.
Perfect for front-end development, prototyping, testing, and educational purposes.
- π₯ Complete REST API - Full support for GET, POST, PUT, PATCH, DELETE
- πΎ Built-in Persistence - Automatic data storage using localStorage/IndexedDB
- π Visual Interface - UI dashboard to explore and manipulate your data
- π€ Import/Export - Easy JSON data import and export
- π± Responsive Design - Works on desktop and mobile browsers
- π§ͺ Perfect for Testing - Ideal for prototypes and frontend development
- π No Backend Required - Everything runs client-side
- π Zero Dependencies - No npm installs needed for the runtime
# Clone the repository
git clone https://github.com/devalexanderdaza/RESTless.git
# Navigate to the project directory
cd RESTless
# Install dependencies
npm install
# Start the development server
npm run devOnce the development server is running, navigate to http://localhost:5173 (or the URL shown in your terminal) to access the RESTless interface.
<script type="module">
import { RESTless } from 'https://cdn.jsdelivr.net/gh/devalexanderdaza/RESTless@latest/dist/restless.es.js';
const api = new RESTless();
api.initialize({
users: [
{ id: 1, name: "John Doe", email: "john@example.com" },
{ id: 2, name: "Jane Smith", email: "jane@example.com" }
]
});
// Now you can use the API
const users = await api.get('/users');
console.log(users);
</script>npm install restless-apiimport { RESTless } from 'restless-api';
const api = new RESTless();
// Configuration and usageRESTless follows standard REST conventions:
GET /api- List all available collectionsGET /api/collection- Get all items in a collectionGET /api/collection?param=value- Filter items by propertyGET /api/collection/:id- Get a specific item by IDPOST /api/collection- Create a new itemPUT /api/collection/:id- Update an item (full replacement)PATCH /api/collection/:id- Partially update an itemDELETE /api/collection/:id- Delete an item
// Initialize with data
api.initialize({
users: [
{ id: 1, name: "John", role: "admin" },
{ id: 2, name: "Jane", role: "user" }
]
});
// Make requests
const users = await api.get('/users');
const filtered = await api.get('/users?role=admin');
const user = await api.get('/users/1');
const newUser = await api.post('/users', { name: "Alice", role: "editor" });
const updated = await api.put('/users/1', { name: "John Doe", role: "admin" });
const patched = await api.patch('/users/2', { role: "editor" });
const deleted = await api.delete('/users/1');// Initialize RESTless
const api = new RESTless();
// Set up initial data
api.initialize({
products: [
{ id: 1, name: "Laptop", price: 999, inStock: true },
{ id: 2, name: "Phone", price: 699, inStock: false }
]
});
// Get all products
const products = await api.get('/products');
// Filter products
const inStockProducts = await api.get('/products?inStock=true');
// Add a new product
const newProduct = await api.post('/products', {
name: "Tablet",
price: 499,
inStock: true
});
// Update a product
await api.put('/products/1', {
name: "Gaming Laptop",
price: 1299,
inStock: true
});
// Delete a product
await api.delete('/products/2');Contributions are welcome! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See the contributing guide for detailed instructions.
This project is licensed under the MIT License - see the LICENSE file for details.
Alexander Daza
- Website: alexanderdaza.com
- GitHub: @devalexanderdaza
- LinkedIn: in/devalexanderdaza
- json-server-vercel - RESTless server inspired on json-server and vercel
- json-server - RESTless was inspired by json-server
- miragejs - Another client-side API mocking library
Made with β€οΈ by Alexander Daza
