Architecture Overview
Imperium Maledictum Digital is built with a modern, flexible architecture that supports multiple deployment targets and storage strategies.
High-Level Architecture
Core Components
Frontend Layer
- Vue 3: Reactive UI framework with Composition API
- Vue Router: Client-side routing with HTML5 history mode
- Pinia: Type-safe state management
- Service Worker: Offline support and caching
Storage Layer
- Database Adapter: Unified interface for multiple storage backends
- Local Storage: Browser-based storage for web deployment
- SQLite: File-based database for Electron desktop app
- Cloudflare KV: Distributed key-value storage for cloud sync
Backend Services
- Cloudflare Worker: Serverless API endpoints
- Cloudflare KV: Global data storage and synchronization
- Static Hosting: CDN-delivered frontend assets
Data Flow
Key Design Decisions
1. Storage Abstraction
The database adapter pattern allows the application to work with different storage backends transparently:
- Web browsers use localStorage
- Desktop app uses SQLite for better performance
- Cloud sync uses Cloudflare KV for global distribution
2. Offline-First Design
- Service Worker caches all static assets
- Local storage always maintains a copy of data
- Cloud sync is optional and non-blocking
3. Token-Based Authentication
- Simple shared secret for cloud sync
- No user accounts or complex auth flows
- Token scopes all data in KV storage
4. UUID-Based Identifiers
- Prevents ID conflicts when syncing
- Enables reliable data merging
- Supports migration from legacy sequential IDs
Deployment Architecture
Security Considerations
- Data Isolation: Each sync token creates an isolated namespace in KV
- HTTPS Only: All API communication over encrypted connections
- No Sensitive Data: No passwords or auth credentials stored
- Admin Protection: Admin panel requires password authentication
Performance Optimizations
- Lazy Loading: Route-based code splitting
- Asset Caching: Service Worker caches static resources
- Batch Operations: Multiple KV operations combined
- Local Cache: Reduces API calls to cloud storage