Skip to content

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

  1. Data Isolation: Each sync token creates an isolated namespace in KV
  2. HTTPS Only: All API communication over encrypted connections
  3. No Sensitive Data: No passwords or auth credentials stored
  4. Admin Protection: Admin panel requires password authentication

Performance Optimizations

  1. Lazy Loading: Route-based code splitting
  2. Asset Caching: Service Worker caches static resources
  3. Batch Operations: Multiple KV operations combined
  4. Local Cache: Reduces API calls to cloud storage

Next Steps