An enterprise document archiving platform integrating legacy SQL Server data with MongoDB and an external archive service through secure RBAC and API gateway architecture.
Gallery
No documented highlights yet.
Client Archive Server is an enterprise-grade document management and archiving platform designed for organizations operating across multiple branches and transitioning from legacy systems to modern infrastructure.
The platform acts as both a modern frontend and an API Gateway / Proxy Layer. Client records, document metadata, counters, and audit logs are maintained in MongoDB, while legacy branch and role information is retrieved from Microsoft SQL Server.
Physical document processing is delegated to an external Archive Service through secure upload and download proxy mechanisms, reducing the workload on the main application and separating file storage from application data.
Key Features 🔐 Secure JWT authentication using HttpOnly cookies. 🛡️ Role-Based Access Control with fine-grained permissions. 🏢 Branch-level data isolation. 🗃️ Client and document management. 📤 Secure proxy-based document uploads. 📥 Secure document downloads and retrieval. 🔄 Retry and exponential backoff for external archive service failures. 📊 Comprehensive audit logging for critical operations. 🗄️ Hybrid MongoDB and SQL Server integration. 📈 Branch and usage statistics. 🔢 Sequential document numbering and counters. 👑 Special access for Super Admins and Owners. Architecture
The system is built using Next.js App Router, combining the frontend and backend API layer into a unified application.
MongoDB is used for modern application data, while Microsoft SQL Server provides integration with the legacy organizational system. Physical documents are streamed through the application to an external Archive Service instead of being stored directly by the main application.
Security
The platform uses JWT authentication with HttpOnly cookies, Role-Based Access Control, branch-level isolation, and comprehensive audit logging to provide strong security, traceability, and governance for enterprise document operations.
Problem
The organization needed a modern and secure document archiving platform while continuing to depend on legacy SQL Server systems for branch and organizational data. Storing large physical documents directly within the main application would increase infrastructure load and complicate file management. The system also required strict branch-level access control and complete traceability of sensitive operations.
Solution
Client Archive Server was developed as a modern integration layer between users, legacy systems, and an external document archive service. MongoDB stores client data, document metadata, counters, and audit logs, while SQL Server remains the source for legacy branch information. Physical files are streamed through a secure proxy to the external Archive Service. The platform also implements RBAC, branch-level isolation, and comprehensive audit logging for operations such as creation, upload, deletion, and download.
Architecture
The system uses Next.js 15 and React 19 with the App Router, combining the frontend and API Gateway within a unified application. MongoDB with Mongoose handles modern application data, while a dedicated MSSQL connection pool integrates with the legacy system. A resilient proxy layer handles communication with the external Archive Service using retries, timeouts, and exponential backoff. Authentication, permissions, database connections, audit logging, and archive communication are separated into dedicated utility and service layers to improve maintainability and scalability.
Challenges
Integrating with a legacy SQL Server system without disrupting existing workflows. Implementing access control based on both user roles and organizational branches. Handling large document uploads and downloads without storing physical files in the main application. Maintaining reliability when the external Archive Service becomes temporarily unavailable. Creating detailed and auditable logs for sensitive operations. Maintaining performance as the number of branches, users, and documents grows.
Results
The result is a modern and scalable document archiving platform that bridges legacy infrastructure with a modern application layer without requiring a complete replacement of the existing system. Users can manage clients and documents through a unified interface with strict role and branch-based permissions, while physical files are handled by a dedicated external archive service. The platform also provides strong traceability through comprehensive audit logs and a flexible architecture that can support additional features and integrations in the future.