How mordecai42/pwa works
Project type and purpose
• This is a full-stack Progressive Web App template built with React, TypeScript, and Vite plus a minimal Node.js server.
• It serves a React SPA, supports offline capabilities via a Service Worker (sw.js + workbox-config.js), and uses IndexedDB (via src/utils/idb.js) to queue/offline-store form submissions (OfflineForm.tsx).
File structure
• Top-level:
• src/ (React/TypeScript source: components, assets, CSS, utility libs)
• server/ (Node.js server: server.js, .env)
• config files: tsconfig.*, vite.config.ts, workbox-config.js, ESLint/Husky/GitHub workflows
• Patterns & responsibilities:
• src/components – UI components including OfflineForm
• src/utils/idb.js – client-side storage library for offline data
• public/sw.js & workbox-config.js – PWA caching strategies
• server/server.js – API endpoint(s) to receive submissions
README for additional insights
• Focus is on development setup (Vite + React + TS), ESLint configuration, Fast Refresh plugins.
Elements
• “React SPA”
• “Service Worker”
• “IndexedDB (idb.js)”
• “Network / Fetch API”
• “Node.js Server (server.js)”
• “External DB/Service”
• User input → React SPA → (if offline) → IndexedDB
• React SPA / SW → Network → Server
• Server → (external DB)
• Green for PWA/Cache
• Orange for server
• Gray for external systems