Offline-First PWA Inventory System

    1

    Build offline-first inventory PWAs with React, Dexie.js local storage, Supabase sync, and QR scanning.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    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 mapLocalToRemote utility in lib/sync.js to 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 items table 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

    1. Initialize the local schema using Dexie.js to define tables for items, locations, and transactions with mandatory sync status flags.
    2. Configure the sync engine to detect local changes, upsert them to Supabase, and pull remote updates into the local cache.
    3. Build the mobile-first UI using Tailwind CSS with a bottom-navigation pattern and touch-optimized components.
    4. 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Permissions

    Terminal / Shell
    Network Access
    Write Files
    Listed15 days ago

    What's inside

    Frequently Asked Questions

    This skill provides a complete architectural blueprint and boilerplate for building PWAs that remain fully functional without internet, specifically solving the data loss and latency issues common in warehouse and field environments.

    You will receive the full project structure, including the Dexie.js schema configuration, the Supabase sync engine logic, QR scanning components, and pre-configured PDF generation templates.

    Yes, the architecture is designed for mobile-first PWA deployment, utilizing the `html5-qrcode` library to access device cameras for continuous, high-speed scanning without requiring a native app.

    The skill is compatible with modern AI coding agents like Claude 3.5 Sonnet, GPT-4o, and tools like Cursor or GitHub Copilot, providing the structured context they need to generate robust offline-first code.

    While the sync engine is optimized for Supabase, the Dexie.js local layer can be adapted to other PostgreSQL-based backends with minor adjustments to the connection strings and auth hooks.

    Setting up requires an active Supabase project and a React environment; the skill guides the agent to initialize the IndexedDB tables and establish the real-time subscription listeners for you.

    New in Frontend & Web Apps