# NextSnap - Technical Architecture Documentation ## Executive Summary NextSnap is an offline-first Progressive Web Application (PWA) designed for mobile photo capture with seamless Nextcloud integration. Built specifically for field use in environments with poor or intermittent connectivity, the application ensures zero data loss through aggressive local caching, automatic background synchronization with verification, and comprehensive retry logic. ### Core Design Principles 1. **Offline-First**: Application functions fully without network connectivity 2. **Zero Data Loss**: Photos never deleted until server verification complete 3. **Mobile-Optimized**: Native camera integration, touch gestures, responsive design 4. **Multi-User**: Session-based authentication with complete user isolation 5. **Admin-Capable**: Full Nextcloud user management via OCS Provisioning API ## High-Level Architecture NextSnap follows a three-tier architecture: **Tier 1: Client Layer (Browser)** - HTML5 Camera API for native photo capture - IndexedDB for local photo queue storage - Service Worker for offline app shell caching - Vanilla JavaScript (ES6+) for application logic **Tier 2: Application Layer (Flask)** - REST API for frontend communication - WebDAV proxy to avoid CORS issues - Session management and authentication - OCS API integration for admin functions **Tier 3: Storage Layer (Nextcloud)** - WebDAV protocol for file operations - OCS API for user management - User authentication backend - Persistent file storage [See TECHNICAL.md for complete documentation]