- Home
- Skills
- Frontend & Web Apps
- Offline-First PWA Inventory System
Offline-First PWA Inventory System
Build offline-first inventory PWAs with React, Dexie.js local storage, Supabase sync, and QR scanning.
Free
Works with the AI Agents you already use
Offline-First PWA Inventory System
Example session with this skill installed
Show me how to set up the Dexie.js database schema and the sync status fields for a new inventory project.
- Read your context and instructions
- Compiled the offline-first pwa inventory
I have initialized the Dexie.js schema for your inventory PWA. This configuration includes the mandatory sync_status tracking for every table to ensure the offline-first logic works correctly.
Local Database Configuration
// src/lib/db.js
import Dexie from 'dexie';
export const db = new Dexie('InventoryAppDB');
/**
* Schema version 1
* sync_status values: 'pending_create' | 'pending_update' | 'pending_delete' | 'synced'
*/
db.version(1).stores({
items: '&id, location_id, sync_status, status, serial_number',
locations: '&id, sync_status, name',
transactions: '&id, item_id, type, sync_status, created_at',
users: '&id, role, sync_status'
});
// Example of a local write operation
export async function createItem(itemData) {
const newRecord = {
...itemData,
id: crypto.randomUUID(),
sync_status: 'pending_create',
created_at: new Date().toISOString()
};
await db.items.add(newRecord);
return newRecord;
}
Next steps
- Implement the
mapLocalToRemoteutility inlib/sync.jsto match these fields to your Supabase tables. - Set up the background sync worker to filter for
sync_status !== 'synced'. - Define the Supabase RLS policies for the
itemstable to allow authenticated upserts.
Connects securely to your tools. The creator never sees your data.
About this skill
Building inventory systems for warehouses or clinics means dealing with spotty connectivity. This skill provides a production-ready architecture for Progressive Web Apps (PWAs) that prioritize local storage to ensure users never lose data when the Wi-Fi drops.
What it does
- Offline-first architecture implements a Dexie.js local storage layer that acts as the primary data source before syncing to the cloud.
- Bi-directional synchronization handles push-then-pull logic between IndexedDB and Supabase to resolve data conflicts.
- Hardware integration provides continuous QR and barcode scanning capabilities using the device camera with built-in debouncing.
- Report generation automates the creation of PDF inventory audits and printable QR label sheets in Avery 5160 format.
- Role-based access manages user permissions via Supabase Auth metadata to enforce viewer, editor, and admin levels.
How it works
- Initialize the local schema using Dexie.js to define tables for items, locations, and transactions with mandatory sync status flags.
- Configure the sync engine to detect local changes, upsert them to Supabase, and pull remote updates into the local cache.
- Build the mobile-first UI using Tailwind CSS with a bottom-navigation pattern and touch-optimized components.
- Deploy the scanner for physical audits, using continuous scanning modes for high-volume asset tracking.
Frameworks & tools
React, Vite, Dexie.js, Supabase, Tailwind CSS, Lucide React, Zustand, jsPDF, and html5-qrcode.
Why this beats prompting it yourself
Writing reliable sync logic is difficult, especially handling state transitions between pending_create and synced. This skill provides the specific field mapping patterns and debounced scanner logic required for professional hardware-integrated apps.
Use cases
- Warehouse asset tracking where workers scan hundreds of items in areas with poor cellular signal.
- School equipment audits where a single administrator needs to generate and print QR labels for new furniture.
- Field service management for technicians who need to update resource status while working underground or in remote locations.
Known limitations
Requires a manual mapping function for schema differences between local and remote databases. Continuous scanning mode requires careful power management on mobile devices.
Requires manual mapping for schema differences between Dexie and Postgres. Sync logic relies on a 'push-then-pull' pattern that must be triggered per table.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 15 days ago
- Free with an Agensi account