An offline-first, privacy-centric Progressive Web App for secure UPI payments using NFC and QR code fallback, compliant with NPCI UPI Lite specifications.
This project delivers a modern PWA that enables UPI payments in offline scenarios, leveraging NFC technology for tap-to-pay experiences with automatic synchronization when connectivity is restored. Built with Next.js 14+, Supabase, and deployed on Vercel's free tier.
- Offline-First Architecture: Full functionality without internet connectivity
- NFC Payments: Tap-to-pay using Web NFC API
- QR Code Fallback: Scan/generate QR codes when NFC unavailable
- Secure Authentication: Phone-based OTP login via Supabase Auth
- Wallet Management: UPI ID linking with NPCI-compliant limits
- Transaction Queue: Automatic sync when online
- PWA Capabilities: Installable, works offline, native app-like experience
- NPCI Compliance: Adheres to UPI Lite specifications
- Next.js 14+ - React framework with App Router
- React 18+ - UI library
- TypeScript - Type safety
- Tailwind CSS - Utility-first styling
- Shadcn/ui - Component library (Radix UI)
- Zustand - Global state management
- React Query - Server state synchronization
- Dexie.js - IndexedDB wrapper for offline storage
- Supabase - Auth, PostgreSQL database, real-time subscriptions
- Supabase SSR - Server-side auth helpers
- next-pwa - PWA configuration
- Workbox - Service worker strategies
- Zod - Runtime validation
- date-fns - Date manipulation
- qrcode - QR generation
- html5-qrcode - QR scanning
- nanoid - Unique ID generation
This application strictly enforces NPCI UPI Lite specifications:
- Maximum Transaction Amount: ₹1,000
- Maximum Wallet Balance: ₹5,000
- Maximum Daily Transactions: 20
- Maximum Offline Transactions: 5 (before mandatory sync)
- Sync Deadline: 4 days
UPI-Offline-Payment-PWA-NFC-Based/
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── auth/ # Authentication flows
│ │ ├── dashboard/ # Main dashboard
│ │ ├── pay/ # Payment flows (NFC/QR)
│ │ ├── transactions/ # Transaction history
│ │ ├── wallet/ # Wallet management
│ │ └── api/ # API routes
│ ├── components/ # React components
│ │ ├── ui/ # Shadcn/ui components
│ │ ├── auth/ # Auth-related components
│ │ ├── wallet/ # Wallet components
│ │ ├── payment/ # Payment components
│ │ ├── transaction/ # Transaction components
│ │ └── dashboard/ # Dashboard components
│ ├── lib/ # Utility libraries
│ │ ├── db/ # Database clients (Supabase, Dexie)
│ │ ├── auth/ # Auth helpers
│ │ ├── nfc/ # NFC manager
│ │ ├── qr/ # QR code utilities
│ │ ├── sync/ # Sync manager
│ │ ├── wallet/ # Wallet business logic
│ │ └── utils/ # Common utilities
│ ├── hooks/ # Custom React hooks
│ ├── types/ # TypeScript type definitions
│ └── styles/ # Global styles
├── public/ # Static assets
│ ├── icons/ # PWA icons
│ └── manifest.json # PWA manifest
├── supabase/ # Supabase migrations & seeds
├── __tests__/ # Test files
└── docs/ # Documentation
- Node.js 18.17 or later
- npm or yarn
- Supabase account (free tier)
- Vercel account (optional, for deployment)
- NFC-capable device for testing NFC payments
git clone https://github.com/iAn-P1nt0/UPI-Offline-Payment-PWA-NFC-Based.git
cd UPI-Offline-Payment-PWA-NFC-Basednpm install- Create a new project at Supabase
- Navigate to Settings → API and copy:
- Project URL
- Anon (public) key
- Service role key (keep this secret!)
cp .env.local.example .env.localEdit .env.local and fill in your Supabase credentials and other settings.
# Install Supabase CLI (if not already installed)
npm install -g supabase
# Link to your project
supabase link --project-ref your-project-ref
# Run migrations (coming in next steps)
# supabase db pushnpm run devOpen http://localhost:3000 in your browser.
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run type-check # Run TypeScript compiler check- Project scaffolding
- Dependencies installed
- Configuration files created
- Database schema setup
- Authentication flows
- Wallet management
- NFC payment implementation
- QR code fallback
- Transaction sync
- PWA configuration
- Deployment setup
See AGENTS.md for detailed implementation checklist.
This project implements multiple security layers:
- No PIN Storage: UPI PINs are NEVER stored
- End-to-End Encryption: Web Crypto API for sensitive data
- JWT Authentication: Secure token-based auth
- Row-Level Security: Supabase RLS policies
- Device Fingerprinting: Bind wallet to trusted devices
- Transaction Signing: Cryptographic signatures for all transactions
- Input Validation: Zod schemas for all user inputs
- HTTPS Only: Enforced in production
- Security Headers: CSP, HSTS, X-Frame-Options, etc.
- Service Workers: For offline functionality
- IndexedDB: For local data storage
- Web Crypto API: For encryption
- NFC (optional): For tap-to-pay (fallback to QR)
- Chrome/Edge 89+
- Safari 15.4+
- Firefox 90+
Note: NFC support requires Chrome/Edge on Android or Safari on iOS 13+.
- Install Vercel CLI:
npm install -g vercel- Deploy:
vercel- Set environment variables in Vercel dashboard
npm run build
npm run start# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Coverage
npm run test:coverage- CLAUDE.md: Project vision, architecture, and implementation guidelines
- AGENTS.md: Modular implementation checklist and conventions
- /docs: Additional technical documentation (coming soon)
This is an open-source project. Contributions are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Reference AGENTS.md and CLAUDE.md in your PR description
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
ISC License - see LICENSE file for details
- Core authentication
- Wallet setup
- NFC/QR payments
- Offline queue
- Basic sync
- Merchant mode
- Biometric auth
- Analytics dashboard
- Enhanced sync logic
- Fraud detection
- Wallet freeze
- Compliance audits
- Multi-device sync
- Plugin architecture
- Feature flags
- Custom hooks
- Extended documentation
For issues, questions, or contributions:
- GitHub Issues: Report bugs or request features
- Discussions: Share ideas and ask questions
Built with adherence to NPCI UPI specifications and modern web standards. Designed for privacy, security, and offline-first user experiences.
Built with ❤️ for the future of offline payments