LARC Examples
  Comprehensive examples and demo applications for the LARC/PAN messaging system
This repository contains a complete collection of examples, tutorials, and full-featured demo applications demonstrating the capabilities of the LARC (Lightweight Asynchronous Relay Core) framework.
๐ New: Core Lite Package
LARC now offers @larcjs/core-lite - just 9KB minified (3KB gzipped)! That's 94% smaller than React.
Perfect for:
- ๐ฆ Bundle-conscious projects
- โก Fast-loading pages
- ๐ฏ Simple pub/sub needs (no routing/debug)
๐ What's Inside
๐ Examples (/examples)
30+ progressive examples from basic concepts to advanced patterns:
...and more!
๐ฏ Featured Demo: Hybrid Dashboard
Hybrid Dashboard - React + Vue + LARC working togetherThis killer demo proves LARC's value proposition:
- Mix frameworks seamlessly - React chart, Vue filters, LARC components
- 60% bundle size reduction - 322 KB vs 837 KB traditional approach
- PAN coordination - All components communicate without tight coupling
- Real bundle comparison - See actual savings in the demo
๐ Demo Applications (/apps)
Full-featured applications showcasing real-world usage:
#### 1. Contact Manager (/apps/contact-manager)
Complete contact management system with CRUD operations.
- Add, edit, delete contacts
- Search and filtering
- Persistent storage
- Responsive UI
/apps/invoice-studio)
Professional invoice creation and management application.
Features:
- Create and edit invoices
- Line item management
- PDF export
- Client database
- Invoice templates
/apps/data-browser)
Generic data browsing and editing interface.
Features:
- Connect to any data source
- Grid view with sorting/filtering
- Inline editing
- Export capabilities
/apps/markdown-notes)
Simple note-taking app with Markdown support.
Features:
- Real-time Markdown preview
- Note organization
- Local storage
- Export to HTML/PDF
/apps/invoice)
Streamlined invoice creation tool.
Features:
- Quick invoice generation
- Client management
- Product catalog
- Payment tracking
๐ Quick Start
Running Examples Locally
git clone https://github.com/larcjs/examples.git
cd examples
npm install
npm run dev
# or use any static server
# python3 -m http.server 8000
# npx serve
http://localhost:8000/examples/
http://localhost:8000/apps/
Running with CDN (No Installation)
Most examples work directly with CDN links:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Option 1: Core Lite (9KB - recommended) -->
<script type="module" src="https://unpkg.com/@larcjs/core-lite@latest/src/pan.js"></script>
<!-- Option 2: Full Core (40KB - includes routing & debug) -->
<!-- <script type="module" src="https://unpkg.com/@larcjs/core@3.0.1/src/pan.js"></script> -->
</head>
<body>
<!-- Your PAN components here -->
</body>
</html>
๐ Learning Path
Beginner (Start Here)
Intermediate
Advanced
๐ง Backend Setup (Optional)
Some examples require backend services:
PHP Backend
cd apps
php -S localhost:8080
# Initialize demo database
sqlite3 pan_demo.db < setup-demo-db.sqlite.sql
Node.js Backend (Coming Soon)
Node/Express alternatives for PHP examples.
๐ Repository Structure
examples/
โโโ examples/ # Progressive examples (00-18)
โ โโโ 00-intro.html
โ โโโ 01-hello.html
โ โโโ ...
โ โโโ index.html # Examples index page
โ โโโ assets/ # Shared assets
โ
โโโ apps/ # Full demo applications
โ โโโ contact-manager/
โ โโโ invoice-studio/
โ โโโ data-browser/
โ โโโ markdown-notes/
โ โโโ invoice/
โ โโโ api.php # Shared backend API
โ โโโ README.md # Apps documentation
โ
โโโ test-*.html # Manual test pages
โโโ auth.php # Authentication backend
โโโ sse.php # Server-Sent Events endpoint
โโโ api-legacy.php # Legacy API (for reference)
๐ฏ Example Categories
By Topic
Core Concepts:- 00-intro, 01-hello, 02-todos-and-inspector
- 06-crud, 07-rest-connector, 09-schema-form, 17-indexeddb
- 10-sse-store, 13-sse-pan, 16-websocket
- 04-react-wrapper, 05-lit-wrapper
- 08-workers, 14-forwarder, 15-router
- 17-enhanced-security, 18-jwt-auth
By Difficulty
Easy: 00-03, 06 Medium: 04-05, 07, 09-10, 15 Advanced: 08, 11-14, 16-18๐ ๏ธ Using Examples as Templates
Each example is self-contained and can serve as a template:
Example:
# Start from CRUD example
cp examples/06-crud.html my-app.html
# Customize for your data model
# Edit topic names: "items.*" โ "products.*"
# Update schema to match your data
๐งช Testing
Run tests for examples:
npm test
Individual example tests:
npm run test:example -- 06-crud
๐ Requirements
Browser Requirements
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
Optional Backend Requirements
- PHP 7.4+ (for PHP examples)
- SQLite or MySQL (for database examples)
- Node.js 16+ (for build tools)
๐ Related Packages
- @larcjs/core โ Core PAN messaging bus
- @larcjs/ui โ UI components library
- @larcjs/devtools โ Chrome DevTools extension
- @larcjs/site โ Documentation website
๐ก Contributing
Have a great example to share?
examples/ or apps/XX-descriptive-name.htmlSee CONTRIBUTING.md for guidelines.
๐ License
MIT ยฉ Chris Robison
๐ Support
- ๐ Documentation
- ๐ฌ Discussions
- ๐ Issue Tracker
๐ Explore & Learn
Start with examples/00-intro.html and work your way up!
Each example builds on previous concepts, providing a comprehensive learning path for mastering LARC/PAN development.
Happy coding! ๐