# Architecture Overview ## System Architecture ``` ┌─────────────────────────────────────────────────────────────────────┐ │ License Authority Platform │ ├─────────────────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ Presentation Layer │ │ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │ │ │ Citizen │ │ Department │ │ Admin │ │ │ │ │ │ Portal │ │ Portal │ │ Console │ │ │ │ │ │ (Angular) │ │ (Angular) │ │ (Angular) │ │ │ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ Application Layer │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────────────┐ │ │ │ │ │ API Gateway (NestJS) │ │ │ │ │ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ │ │ │ │ │ │ │ Auth │ │Applications│ │ Documents │ │ │ │ │ │ │ │ Module │ │ Module │ │ Module │ │ │ │ │ │ │ └───────────┘ └───────────┘ └───────────┘ │ │ │ │ │ └─────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ Data Layer │ │ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │ │ │ PostgreSQL │ │ Redis │ │ File Store │ │ │ │ │ │ (Primary) │ │ (Cache) │ │ (Documents) │ │ │ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ Blockchain Layer │ │ │ │ ┌────────────────────────────────────────────────────┐ │ │ │ │ │ Hyperledger Besu Network │ │ │ │ │ │ ┌─────────────┐ ┌─────────────┐ │ │ │ │ │ │ │ NFT Smart │ │ Ledger │ │ │ │ │ │ │ │ Contract │ │ Storage │ │ │ │ │ │ │ └─────────────┘ └─────────────┘ │ │ │ │ │ └────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────┘ ``` ## Key Design Decisions | Decision | Rationale | |----------|-----------| | Angular SPA | Rich interactive UI, offline capability | | NestJS Backend | TypeScript consistency, modular architecture | | PostgreSQL | ACID compliance, JSON support, proven reliability | | Hyperledger Besu | Ethereum-compatible, enterprise features, private network | | Docker Containers | Consistent deployment, scalability | ## Data Flow 1. **Application Submission**: User → Frontend → API → Database → Workflow Engine 2. **Document Upload**: User → Frontend → API → File Storage → Hash to Blockchain 3. **Certificate Issuance**: Approval → Smart Contract → NFT Minted → Certificate Generated ## Scalability - Horizontal scaling: Multiple API instances behind load balancer - Database scaling: Read replicas for query load - Caching: Redis for session and query caching - Async processing: Queue-based document processing