**Electronic Documents Management Online System (EdMOS)** --- ## 1. Project Overview **EdMOS** is an enterprise-grade web application designed to streamline the creation, storage, retrieval, and auditing of electronic documents. It comprises: * A **Laravel** backend (PHP 8+, MySQL) * A **Vite + React + TypeScript** administration panel * A **Vite + React + TypeScript** public/portal frontend ### 1.1 Objectives * Centralize document storage with version control * Role-based access control (RBAC) * Audit trails and compliance reporting * Scalable, secure, and maintainable codebase --- ## 2. Architecture & Technology Stack | Layer | Technology | | --------------- | ---------------------------------------- | | API / Backend | Laravel 10, PHP 8.2, MySQL 8, Redis | | Auth & Security | Laravel Sanctum, OAuth2, HTTPS/TLS | | Admin Frontend | Vite, React 18, TypeScript, Tailwind CSS | | Public Frontend | Vite, React 18, TypeScript, Tailwind CSS | | DevOps & CI/CD | GitHub Actions, Docker, Kubernetes (EKS) | | Monitoring | Sentry, Prometheus + Grafana | --- ## 3. Folder Structure ### 3.1 Backend (Laravel) ``` edmos-backend/ ├── app/ │ ├── Console/ │ ├── Events/ │ ├── Exceptions/ │ ├── Http/ │ │ ├── Controllers/ │ │ ├── Middleware/ │ │ └── Requests/ │ ├── Models/ │ ├── Policies/ │ ├── Providers/ │ └── Services/ ├── bootstrap/ ├── config/ ├── database/ │ ├── factories/ │ └── migrations/ ├── resources/ │ └── lang/ ├── routes/ │ ├── api.php │ └── web.php ├── tests/ ├── .env.example ├── composer.json └── docker-compose.yml ``` ### 3.2 Admin Frontend ``` edmos-admin/ ├── public/ ├── src/ │ ├── api/ # Axios instance & endpoints │ ├── assets/ # Icons, logos │ ├── components/ # Reusable AntD-wrapped components │ ├── layouts/ # Ant Design Pro layout wrappers │ ├── models/ # Umi-models or Zustand slices for state │ ├── pages/ # Route-based pages (List, Detail, Reports) │ ├── services/ # React Query hooks & service functions │ ├── utils/ # Helpers: auth, date, formatting │ ├── socket/ # WebSocket (Reverb) client setup │ ├── pdf/ # PDF generation helpers (wkhtmltopdf wrappers) │ ├── search/ # Meilisearch client & hooks │ ├── App.tsx │ └── main.tsx ├── tsconfig.json ├── vite.config.ts # Configure proxy for Laravel Sanctum └── package.json ``` ### 3.3 Public Frontend ``` edmos-admin/ or edmos-portal/ ├── public/ # Static assets (favicon, index.html) ├── src/ │ ├── api/ # Axios instances & endpoint definitions │ ├── assets/ # Images, icons, fonts │ ├── components/ # Shared UI components (Buttons, Modals) │ ├── features/ # Domain modules (documents, users, workflows) │ │ ├── DocumentList/ # Colocated component, hook, tests, styles │ │ ├── DocumentViewer/ │ │ └── ... │ ├── hooks/ # Custom hooks unrelated to features │ ├── layout/ # Layout components (NavBar, Sidebar) │ ├── routes/ # React Router v6 route definitions │ ├── store/ # Redux Toolkit slices & store setup │ ├── styles/ # Tailwind config, theme tokens, globals.css │ ├── utils/ # Helper functions (date formatting, validations) │ ├── App.tsx │ └── main.tsx ├── tsconfig.json ├── vite.config.ts └── package.json ``` --- ## 4. Core Features 1. **User Management & RBAC** * Registration, login, password reset * Roles: Super Admin, Admin, Editor, Viewer 2. **Document Lifecycle** * Upload (PDF, DOCX, images) * Versioning and rollbacks * Metadata tagging and search 3. **Workflow & Approvals** * Customizable approval flows * Notifications & reminders (email, in-app) 4. **Audit & Reporting** * Immutable audit logs (Who, What, When) * Exportable compliance reports 5. **API & Integrations** * RESTful JSON endpoints * Webhooks for external systems * Optional GraphQL layer 6. **Search & Filtering** * Full-text search (MySQL/ElasticSearch) * Filter by metadata, tags, date ranges 7. **Security & Compliance** * Encryption at rest & in transit * File scanning (virus/malware) * GDPR / HIPAA audit trails --- ## 5. Implementation Guidelines ### 5.1 Backend Best Practices * **Service Layer**: Encapsulate business logic in `app/Services` * **Repositories**: Abstract DB queries for testability * **DTOs & Requests**: Use FormRequest for validation and Data Transfer Objects for service inputs * **Events & Listeners**: Decouple side-effects (notifications, logging) * **Policies & Gates**: Enforce RBAC in Controllers or via middleware ### 5.2 Frontend Best Practices * **Atomic Components**: Break UI into reusable, accessible components * **State Management**: Use React Query + Context or Zustand for global state * **API Layer**: Centralize HTTP calls in `services/api.ts` with Axios interceptors (token refresh) * **Styling**: Utility-first with Tailwind, consistent theme tokens * **Testing**: Jest + React Testing Library, focus on unit and integration tests ### 5.3 CI/CD & DevOps * **Dockerization**: Containerize backend and frontends * **Infrastructure as Code**: Terraform for AWS resources * **Pipelines**: GitHub Actions for lint, test, build, deploy * **Environments**: Separate configs for dev, staging, prod --- ## 6. Project Resource Document (PRD) ### 6.1 Introduction * **Purpose**: Define scope, stakeholders, success metrics * **Stakeholders**: Product Owner, Tech Lead, QA, UX, Security ### 6.2 Scope & Requirements * **Functional Requirements**: List of user stories / use cases * **Non-Functional Requirements**: Performance, availability (99.9%), scalability, security levels ### 6.3 Milestones & Timeline | Milestone | Description | ETA | | --------------------- | ---------------------------------- | ------------ | | Requirements & Design | Finalize wireframes & API spec | Jun 15, 2025 | | MVP Backend | Core CRUD + auth | Jul 15, 2025 | | Admin UI MVP | Dashboard + document listing | Aug 1, 2025 | | Portal UI MVP | Public document access | Aug 15, 2025 | | Testing & Hardening | Security audit & performance tests | Sep 1, 2025 | | Launch | Production deployment | Sep 15, 2025 | ### 6.4 Resources & Tools * **Design**: Figma, Storybook * **Project Management**: Jira or Asana * **Collaboration**: Confluence, Slack * **Version Control**: GitHub ### 6.5 Acceptance Criteria * All user stories implemented and tested * Security audit passed with zero critical findings * Performance: 95th percentile response < 300ms * Accessibility: WCAG AA compliance --- *This document serves as a living blueprint. Update as requirements evolve.*