How alecxcode/edm works
Project Type and Purpose
• Full-stack web application for electronic document, task, and project management.
• Single Go monolithic backend (cmd/edm → internal/ & pkg/) with a static front-end (HTML/CSS/JS/templates).
• Supports multiple RDBMS backends plus optional Redis for sessions/shared data.
• Exposes HTTP (and WebSocket) API endpoints, sends e-mails via an SMTP service.
File Structure and Key Components
• cmd/edm – entry point: HTTP server, CLI flags, Dockerfile, docker-compose.yml
• internal/ – core business modules:
– config: environment/config file parsing
– core: common helpers, SQL generation, theming, uploads
– docs, projs, tasks, team: domain sub-systems exposing handlers/views
– mail: mail template generation + DB logging
– filldata: seed data routines
• pkg/ – reusable libraries (datetime, currency, in-memory or Redis/SQL DB wrappers)
• static/, templates/ – frontend assets (CSS themes, JS modules, HTML templates)
• i18nserver/ & static/i18n/ – translation JSON files for backend and client
• sqlscripts/ – schema definitions for each supported RDBMS
• docker-related files – Dockerfile + compose orchestration
Extract Architectural Patterns
• Monolithic MVC-style backend:
– Model: internal/* + pkg/db
– View: HTML templates + static frontend
– Controller: HTTP handlers in internal/* packages
• Layered architecture: config → core → domain services → persistence
• Optional message channel: WebSocket handlers (internal/projs/wshandler.go & tasks/wsmsg.go)
• External integrations: SMTP server for notifications, Redis (optional)
Main Components
1. Client (Browser UI)
– Requests HTML templates + JS/CSS from static server
– Invokes REST/Fetch API calls + WebSocket connections
2. Web Server (Go Application)
– HTTP routing → handlers in internal/
– MVC pipeline: config loader → controllers → core logic → persistence
3. Persistence Layer
– Primary: RDBMS (SQLite, MySQL, PostgreSQL, Oracle, SQL Server)
– Secondary (optional): Redis as session store / counter store
4. External Services
– SMTP Mail Server for notifications
– (Optional) Docker network links among service containers
5. Supporting Utilities
– i18n server (JSON files)
– Static asset hosting
– Build scripts (build-release.sh, Dockerfile)
Relationships & Data Flows
• Browser → HTTP (GET / POST) → Go Server
• Browser ↔ WebSocket → Go Server (real-time task/project updates)
• Go Server → SQL driver → RDBMS
• Go Server → Redis client → Redis
• Go Server → SMTP port 25/587 → Mail Server
• Config file (.edm dir) read at startup