How drawleados-dotcom/drawleados works
Purpose and Shape
Drawlead is a full-stack internal business-management platform spanning CRM/leads, operations/projects/tasks, HR/payroll, finance/invoicing, marketing, documentation, BNI workflows, and client portals. The repository contains a React single-page frontend, a Python API backend, MongoDB backup data, and containerized deployment assets.
Entry Points and Delivery
The browser application starts at frontend/src/index.js and composes routing/application state in frontend/src/App.js. The backend API process is centralized in backend/server.py, which integrates the domain route modules. Production deployment is Docker Compose behind Nginx: deploy/docker-compose.yml, deploy/nginx.conf, deploy/backend.Dockerfile, and deploy/frontend.Dockerfile. GitHub Actions deployment is defined in .github/workflows/deploy.yml.
Frontend Application Shell and Access Boundary
The frontend uses page-level modules for major business areas, shared layout/navigation, and React contexts for cross-cutting state. Authentication-gated navigation is enforced by frontend/src/components/ProtectedRoute.js; auth state is owned by frontend/src/contexts/AuthContext.js; API calls are mediated through frontend/src/utils/api.js. The UI shell is represented by frontend/src/components/Layout.js, frontend/src/components/Sidebar.js, and frontend/src/components/TopNav.js.
Backend API and Domain Partitioning
The Python backend is organized as a route-module monolith: backend/server.py is the composition boundary, while modules expose domain APIs. Core business partitions include access/auth (backend/access.py), leads and clients (backend/leads_v2_routes.py, backend/clients_routes.py, backend/client_master_routes.py), and cross-domain notifications (backend/notification_service.py). This architecture places domain business logic and persistence-facing operations together in route files rather than a separate service layer.
Operations and Delivery Workflows
Operations manages clients, department projects, tasks, workflow boards, and website delivery work. Main backend boundaries are backend/operations_routes.py, backend/projects_routes.py, and backend/website_projects_routes.py; the user-facing operations hub is frontend/src/pages/OperationsPage.js. Detailed project work is surfaced through frontend/src/pages/ProjectDetailPage.js and board/list components such as frontend/src/components/operations/ProjectsKanbanView.js. Project-related Mongo collections include db_backup/drawlead_db/department_projects.bson, db_backup/drawlead_db/project_tasks.bson, and db_backup/drawlead_db/website_projects.bson.
HR, Finance, and Approval-Controlled Processes
HR covers employee profiles, attendance, leave/WFH, reviews, payroll, and organization structure through backend/hr_routes.py, backend/payroll_routes.py, and backend/org_tree_routes.py. Finance handles clients, banks, expenses, revenue, budgets, invoices, and payroll-linked processing via backend/finance_routes.py, backend/expense_routes.py, and backend/banks_routes.py; its principal frontend surface is frontend/src/pages/FinanceModule.js. Approval workflows form a separate control boundary in backend/approvals_routes.py and frontend/src/pages/ApprovalsPage.js. Persisted records include users, payroll settings/payslips, invoices, and expenses under db_backup/drawlead_db/.
Integrations, Automation, and External Systems
Integration-facing APIs are isolated in modules for Google Calendar/Sheets, Notion, LinkedIn, Meta reports, AI, and automation: backend/google_calendar_routes.py, backend/sheets_routes.py, backend/notion_routes.py, backend/linkedin_routes.py, backend/meta_reports_routes.py, backend/ai_routes.py, and backend/automation_routes.py. Corresponding frontend integration configuration is exposed through frontend/src/components/settings/IntegrationsTab.js. These modules are the boundary between internal records/workflows and external provider APIs.
Persistence and Data Flow
Requests flow from React pages/components through frontend/src/utils/api.js to domain API routes, which read and update MongoDB-backed entities; responses drive dashboards, boards, forms, and client-facing views. The checked-in db_backup/drawlead_db/ BSON files indicate MongoDB as the material data store and preserve collections for identity/session, HR, finance, leads, tasks, projects, and workspaces. Database migration/restore operations are operationally separated in deploy/migrate.sh and migrate_db.sh.
Main entry points: server.py API composition · department_projects.bson MongoDB collections · App.js App routing and state · operations_routes.py Operations and projects
Components 19
React frontend
- Browser entry
frontend/src/index.js - App routing and state
frontend/src/App.js - Auth and protected navigation · Owns auth state and gates page navigation.
frontend/src/contexts/AuthContext.js - Shared application shell · Layout, sidebar, and top navigation.
frontend/src/components/Layout.js - Business modules UI · Operations, project, finance, and approvals surfaces.
frontend/src/pages/OperationsPage.js - API client
frontend/src/utils/api.js
Python API monolith
- API composition · Central process that mounts domain route modules.
backend/server.py - Access and identity
backend/access.py - Leads and clients · Lead, client, and client-master workflows.
backend/leads_v2_routes.py - Operations and projects · Department projects, tasks, and website delivery.
backend/operations_routes.py - HR and payroll · Employees, attendance, leave, reviews, payroll, and org structure.
backend/hr_routes.py - Finance · Expenses, banks, revenue, budgets, invoices, and payroll-linked processing.
backend/finance_routes.py - Approval workflows
backend/approvals_routes.py - Integrations and automation · Calendar, Sheets, Notion, LinkedIn, Meta, AI, and automation APIs.
backend/google_calendar_routes.py - Notifications
backend/notification_service.py
Data and deployment
- MongoDB collections · Backup BSON files represent identity, HR, finance, leads, tasks, projects, and workspaces.
db_backup/drawlead_db/department_projects.bson - Container deployment · Serves frontend and API in production.
deploy/docker-compose.yml - Deployment automation
.github/workflows/deploy.yml
External providers
- Provider APIs · Google, Notion, LinkedIn, Meta, AI, and automation services.
Connections 25
- Browser entry → App routing and state: starts
- App routing and state → Auth and protected navigation: uses
- App routing and state → Shared application shell: renders
- App routing and state → Business modules UI: routes to
- Business modules UI → API client: requests
- Auth and protected navigation → API client: auth requests
- API client → API composition: HTTP API
- API composition → Access and identity: mounts
- API composition → Leads and clients: mounts
- API composition → Operations and projects: mounts
- API composition → HR and payroll: mounts
- API composition → Finance: mounts
- API composition → Approval workflows: mounts
- API composition → Integrations and automation: mounts
- Access and identity → MongoDB collections: reads and writes
- Leads and clients → MongoDB collections: reads and writes
- Operations and projects → MongoDB collections: projects and tasks
- HR and payroll → MongoDB collections: HR and payroll records
- Finance → MongoDB collections: financial records
- Approval workflows → MongoDB collections: approval state
- Operations and projects → Notifications: emits updates
- Integrations and automation → Provider APIs: provider calls
- Deployment automation → Container deployment: deploys
- Container deployment → API composition: runs backend
- Container deployment → App routing and state: serves frontend