Turn any browser tab into a REST API server. Zero backend needed.
π¦ Install β’ π Docs β’ π― Examples β’ π¬ Community
import API from 'api-in-browser';
const api = new API();
api.get('/hello', (req, res) => {
res.json({ message: 'Hello from your browser!' });
});
api.listen(); // API running β no server neededA framework that transforms your browser into a fully functional REST API server using:
| Feature | Technology |
|---|---|
| π Request Handling | Polling / Service Workers |
| πΎ Storage | IndexedDB (60GB+) |
| π Cross-Tab | postMessage API |
| β‘ Concurrency | Web Workers |
Perfect for:
- π€ Telegram bots running in a browser tab
- πΌ Local-first apps with zero backend cost
- π§ͺ Prototyping APIs without servers
- π P2P applications
- β‘ Edge computing experiments
npm install api-in-browserOr via CDN:
<script type="module">
import API from 'https://cdn.jsdelivr.net/npm/api-in-browser/src/index.js';
</script>import API from 'api-in-browser';
const api = new API({
polling: true,
pollingInterval: 2000
});
api.get('/users', async (req, res) => {
const users = await api.storage.getAll('users');
res.json(users);
});
api.post('/users', async (req, res) => {
const user = req.body;
await api.storage.set('users', user.id, user);
res.json({ success: true, user });
});
api.listen(() => console.log('π API running in browser'));- GET, POST, PUT, DELETE, PATCH
- Query parameters & body parsing
- Response helpers:
json(),text(),setStatus()
- IndexedDB wrapper with dead-simple API
- 60GB+ quota (Chrome/Firefox)
- Persistent across sessions β no setup
- Long-polling built-in β no webhook server needed
- Message queue management
- Handler-based routing (
/start,/help, etc.)
- Broadcast updates via
postMessage - Shared state between tabs
- Event synchronization
import API from 'api-in-browser';
const api = new API();
let counter = 0;
api.get('/counter', (req, res) => {
res.json({ count: counter });
});
api.post('/counter/increment', (req, res) => {
counter++;
res.json({ count: counter });
});
api.listen();import API from 'api-in-browser';
const api = new API({ polling: true, pollingInterval: 2000 });
api.telegramBot('YOUR_BOT_TOKEN', {
'/start': (msg) => `Hello ${msg.from.first_name}!`,
'/help': () => 'Commands: /start, /help, /ping',
'/ping': () => 'Pong! π'
});
api.listen();import API from 'api-in-browser';
const api = new API();
api.get('/todos', async (req, res) => {
res.json(await api.storage.getAll('todos'));
});
api.post('/todos', async (req, res) => {
const todo = { id: Date.now(), ...req.body };
await api.storage.set('todos', todo.id, todo);
res.json(todo);
});
api.delete('/todos/:id', async (req, res) => {
await api.storage.delete('todos', req.params.id);
res.json({ success: true });
});
api.listen();| Aspect | Reality | Use Case |
|---|---|---|
| Uptime | Runs while tab is open | β Personal tools |
| Concurrency | ~10-50 req/sec | β Small groups |
| Storage | 60GB (Chrome/Firefox) | β Local-first |
| Mobile | May pause in background | |
| Security | Your IP = API IP | β Private use |
Perfect for: Personal bots, MVPs, local-first apps, P2P experiments.
Not suitable for: Production high-traffic APIs, apps requiring 24/7 uptime.
const api = new API(options);Options:
| Option | Type | Default | Description |
|---|---|---|---|
polling |
boolean | false | Enable polling mode |
pollingInterval |
number | 2000 | Polling frequency (ms) |
cors |
boolean | true | Enable CORS headers |
storage |
string | 'indexeddb' | Storage backend |
debug |
boolean | false | Debug logging |
api.get(path, handler)
api.post(path, handler)
api.put(path, handler)
api.delete(path, handler)
api.patch(path, handler)Handler: (req, res) => { } where:
req:{ method, path, params, query, body }res:{ json(), text(), setStatus() }
await api.storage.set(store, key, value)
await api.storage.get(store, key)
await api.storage.getAll(store)
await api.storage.delete(store, key)
await api.storage.clear(store)"The browser is the most distributed computer on Earth. Let's use it."
This framework embraces Informatique RΓ©alitaire (Reality Computing) β building systems that work with physical constraints rather than against them.
No pretense of being a server. It's a browser that behaves like a server when needed.
Daouda Abdoul Anzize β Computational Paradigm Designer
"I don't build apps. I build the clay others use to build apps."
24 ans β’ Cotonou, BΓ©nin β Global Remote
What I Create:
- Meta-Architectures β Systems that absorb multiple programming paradigms
- Universal Protocols β Standards for distributed systems reliability
- Emergent Computing β Solutions arising from simple physical laws
- AI Infrastructure β Collective intelligence platforms
Featured Research:
- NEXUS AXION β Universal computational framework
- Nexus Backpressure Protocol β 60%+ latency reduction in distributed systems
- Informatique RΓ©alitaire (IR) β Framework for artificial cognition
- Weak Hardware Booster β 95% CPU reduction via semantic collision convergence
- API in Browser β REST API server running inside a browser tab
Stack: Python Β· Rust Β· C++ Β· JavaScript Β· Go
π― Seeking: Research engineering Β· AI infrastructure Β· Protocol design (Q1 2026)
MIT Β© 2026 Daouda Abdoul Anzize β Use freely, attribution appreciated.
Inspired by the Local-First movement, CRDTs, Service Workers, and IndexedDB as underrated infrastructure.
Built with the philosophy that constraints breed creativity.