How voronalk/ohs_manager_clone works
Project type and purpose
• This is a full-stack CRM web application (“OHS_manager”) designed to help occupational-health specialists manage employees, generate and store document templates, attach scanned documents, and seed large datasets from Excel.
• The README confirms that it features a React/Redux frontend (with React Beautiful DnD, modals, forms) and an Express-based Node.js backend (with file-templating, file storage, Excel parsing, RESTful routes and middleware).
File structure
a. Top-level:
• client/ – React UI
• server/ – Node/Express API and business logic
• excelTestSeed/ – sample Excel for bulk seeding
b. client/ breakdown:
• src/index.js, App.js
• src/components/ – feature UI (Login, Dashboard, Workers, Documents, ToDoList)
• src/api/ – HTTP client setup
• src/redux/ – state (actions, reducers), thunks & sagas for side effects
c. server/ breakdown:
• index.js – Express app entry point
• middleware/ (auth, error handling, file upload via multer)
• routes/ – REST endpoints: auth, workers, documents, download, todo
• models/ – data models (company, worker, docs, medical exams) plus a seed script
• xlParcer/ – Excel → JSON
• fileStore/ – persistent storage for uploaded notes/scans
• templater/ – .docx template engine (load .docx templates, fill, error handling)
d. Configuration:
• client/package.json, server/package.json – define dependencies, scripts
• server uses multer, possibly a DB connector (not shown) for models
• No Docker or CI files, but a yarn dev script orchestrates both client & server.
README for additional insights
• Describes “yarn seed” to pre-populate DB via Excel.
• Shows user flows: Login → Company list → Workers → Documents (standard & DnD) → Upload scans → Medical exams.
• Mentions generating .docx templates server-side, downloadable via API, then re-upload scanned PDFs.
a. Main components
1. Browser / Client UI
• React app, Redux store, Sagas → calls API
2. API Gateway / Backend
• Express server with middleware
• Route controllers for auth, workers, documents, downloads, todo
3. Business Logic Services
• Templater service (.docx generation)
• Excel Parser service (seed)
4. Data Models / Persistence
• A database (e.g., MongoDB or relational DB) for company, worker, docs metadata
• File storage (server/fileStore) for .docx templates and uploaded scans
5. External Dependencies
• Email or storage buckets (optional)
• Excel and docx node modules
b. Relationships & interactions
• User → React UI → Redux Saga → HTTP requests → Express routes
• Routes → middleware(auth, multer) → controllers → service layer → models (DB) or file operations
• Seed process: Excel Parser → model layer → DB & initial .docx template generation
• Document generation: templater loads .docx templates → populates fields → writes to fileStore → serves via download endpoint
• File uploads: multer middleware → writes scans to fileStore → update document status in DB
c. Architectural patterns
• Client: Redux for state, Redux-Saga for side effects (async flows)
• Backend: MVC-like separation (routes → controllers → services → models)
• File-centric micro-services within monolith: templater and parser modules
d. Key technologies/frameworks
• Frontend: React, React Router (implied), Redux, Redux-Saga, react-beautiful-dnd, Sass/CSS modules
• Backend: Node.js, Express, multer, docx templating libraries, xlsx parser, (presumed) Mongoose/Sequelize, file system
• Build tools: Yarn, Babel or Webpack (implied by create-react-app or custom config)