Frontend
Backend & Data
Infrastructure & Automation
In the world of MarTech, lead data is often the most volatile asset. Traditional ingestion pipelines are brittle, frequently breaking when encountering malformed JSON, missing fields, or unexpected data types from diverse marketing sources.
LeadMend was built to solve the "Dirty Data" bottleneck. It implements a Self-Healing Architecture that:
- Normalizes incoming chaos into structured, reliable data.
- Enriches minimal inputs with deep firmographic insights.
- Prioritizes business value through algorithmic scoring.
- Routes leads to the right destination (Slack/CRM) based on real-time intelligence.
By shifting from "rejecting bad data" to "healing and valuing data," LeadMend ensures no high-value opportunity is lost to a technicality.
The system is designed as a modular suite of micro-services and specialized layers:
| Layer | Technology Stack | Responsibility |
|---|---|---|
| Edge/API | FastAPI (Python 3.11) | Resilient webhook ingestion & Pydantic validation. |
| Core Logic | Pydantic + Custom Services | Normalization, enrichment, deduplication, and scoring. |
| State | PostgreSQL (SQLAlchemy Async) | Persistent storage for leads and system state. |
| Orchestration | n8n | Complex CRM workflows and external API integrations. |
| Dashboard | Astro + React + Tailwind | High-performance, real-time visualization of lead flow. |
| Development | Docker Compose | Unified, reproducible environment for the entire stack. |
Ensure you have Docker and Docker Compose installed.
# Clone the repository
git clone https://github.com/murad/leadmend.git
cd leadmend
# Setup environment variables
cp .env.example .env
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.envmake devThis command initializes PostgreSQL, n8n, the Backend API, the Astro Frontend, and the Mock Enrichment service.
- Dashboard: http://localhost:3000
- API Documentation: http://localhost:8000/docs
- Workflow Automation (n8n): http://localhost:5678
├── .github/ # PR templates and strict CI workflow gates
├── backend/ # FastAPI application, business logic, and test suites
│ ├── app/ # Core source code (API, Services, Models)
│ └── tests/ # Pytest integration and unit tests
├── frontend/ # Astro + React + Tailwind CSS dashboard
├── mock_enrich/ # Simulated enrichment microservice for local testing
├── n8n/ # Pre-configured workflows for lead routing
├── db/ # Database initialization and migration scripts
├── docs/ # Sphinx-generated technical documentation
└── docker-compose.yml # Full-stack orchestration
We enforce a strict testing policy to maintain the integrity of the self-healing pipeline.
# Run the complete test suite
make testLeadMend is open-source software licensed under the MIT License.