-
Notifications
You must be signed in to change notification settings - Fork 1
Quick Start Guide
Christopher Robison edited this page Dec 12, 2025
·
1 revision
Choose your adventure: 9KB to 40KB depending on your needs
npm install @larcjs/core-liteYou get:
- Pub/sub messaging
- Retained messages
- Request/reply
- Auto-loading components
- 94% smaller than React
| Package | Size | Install | When to Use |
|---|---|---|---|
| @larcjs/core-lite | 9KB | npm i @larcjs/core-lite |
Start here! Most apps |
| @larcjs/core | 40KB | npm i @larcjs/core |
Full-featured, rapid prototyping |
| @larcjs/core-routing | +8KB | Add to lite | Need message routing |
| @larcjs/core-debug | +3KB | Add to lite (dev) | Debugging & tracing |
npm install @larcjs/core-lite<script type="module" src="https://unpkg.com/@larcjs/core-lite@latest/src/pan.js"></script>
<script>
document.addEventListener('pan:publish', { detail: { topic: 'hello', data: 'world' } });
</script>npm install @larcjs/core-lite @larcjs/core-routing<pan-bus enable-routing="true"></pan-bus>
<script type="module">
import '@larcjs/core-lite';
import '@larcjs/core-routing';
window.pan.routes.add({
match: { type: 'user.login' },
actions: [{ type: 'EMIT', message: { type: 'analytics.track' } }]
});
</script>npm install @larcjs/core-lite
npm install --save-dev @larcjs/core-debugimport '@larcjs/core-lite';
if (process.env.NODE_ENV === 'development') {
await import('@larcjs/core-debug');
window.pan.debug.enableTracing();
}npm install @larcjs/core<pan-bus enable-routing="true" debug="true"></pan-bus>
<script type="module" src="https://unpkg.com/@larcjs/core@latest/src/pan.js"></script>// Simple publish
bus.publish('user.login', { userId: 123 });
// With retained message (like state)
bus.publish('theme.current', { theme: 'dark' }, { retain: true });// Subscribe to specific topic
bus.subscribe('user.login', (msg) => {
console.log('User logged in:', msg.data);
});
// Subscribe with wildcard
bus.subscribe('user.*', (msg) => {
console.log('Any user event:', msg);
});
// Unsubscribe
const unsub = bus.subscribe('topic', handler);
unsub(); // Clean up later// Responder
bus.subscribe('user.get', async (msg) => {
const user = await fetchUser(msg.data.id);
return { ok: true, user };
});
// Requester
const response = await bus.request('user.get', { id: 123 });
console.log(response.user);React (140KB) ████████████████████████████████████████
Vue (90KB) █████████████████████████
@larcjs/core (40) ████████████
@larcjs/core-lite ███ (9KB) ← You are here!
Downgrade to save 31KB:
npm uninstall @larcjs/core
npm install @larcjs/core-liteNo code changes needed! Same API.
Add it à la carte:
npm install @larcjs/core-routing # +8KB
npm install @larcjs/core-debug # +3KB- API-Reference - Full API documentation
- Migration-Guide - Version migration guides
- Full Docs - Complete documentation
- Start small - Begin with core-lite, add features later
- Dev vs Prod - Use debug in dev only
- Measure first - Profile before adding routing
- Stay modular - Don't pay for what you don't use
A: Yes! Same API as full version. Drop-in replacement.
A: Yes, just npm install @larcjs/core. Zero code changes.
A: Add @larcjs/core-routing (8KB) to core-lite (9KB) = 17KB total.
A: 9KB minified, ~3KB gzipped. Load time is based on gzipped.
TL;DR: Use @larcjs/core-lite unless you know you need more. 9KB of pure messaging goodness.