Archivos generados
π€ CLAUDE.md
βοΈ setup.sh
π README.md
βοΈ LICENSE
π€ CONTRIBUTING.md
.github/ISSUE_TEMPLATE/
π bug_report.md
β¨ feature_request.md
β Existentes β
π app/
π migrations/
π tests/
π³ docker-compose.yml
π requirements.txt
π§ Makefile
CLAUDE.md
setup.sh
README.md
LICENSE
CONTRIBUTING.md
π Resumen
1 # LeadPulse 2 3 Version: 1.0.0 | Port: 8000 | Stack: Python 3.12 Β· FastAPI Β· PostgreSQL Β· Redis Β· Celery 4 5 ## What 6 7 REST API that tracks lead behaviour (visits, clicks, form fills), computes a 8 configurable score, and fires webhooks to external CRMs when the score 9 crosses a threshold. Designed for digital marketing agencies. 10 11 ## Quick Start 12 13 ./setup.sh # First-time setup (copies .env, installs deps) 14 make dev # Start API on http://localhost:8000 15 make test # Run test suite 16 17 ## Commands 18 19 # Development 20 pip install -r requirements.txt # Install dependencies 21 make dev # uvicorn --reload on :8000 22 make lint # ruff check + mypy 23 make build # Production image build 24 25 # Database 26 make migrate # alembic upgrade head 27 28 # Workers 29 make worker # Celery worker for async scoring 30 31 # Testing 32 make test # pytest -v 33 make coverage # pytest --cov=app 34 35 # Docker (full stack) 36 cp .env.example .env 37 docker compose up -d --build # api + worker + postgres + redis 38 39 ## Architecture 40 41 leadpulse/ 42 βββ app/ 43 β βββ main.py # FastAPI app, router mounts 44 β βββ api/ 45 β β βββ leads.py # CRUD endpoints for leads 46 β β βββ events.py # Ingest behaviour events 47 β β βββ webhooks.py # Webhook config + dispatch 48 β βββ services/ 49 β β βββ scorer.py # Scoring engine (rules + lightweight ML) 50 β β βββ notifier.py # Webhook dispatcher 51 β βββ tasks/ 52 β βββ process_event.py # Celery task: recomputes score 53 βββ migrations/ # Alembic migrations 54 βββ tests/ # pytest + httpx async 55 56 HTTP request β FastAPI β enqueues Celery task (Redis broker) β scorer.py 57 recomputes score β if score β₯ SCORING_THRESHOLD β notifier.py fires webhook. 58 59 ## Key Files 60 61 app/main.py # Entry point β router registration 62 app/services/scorer.py # Core logic: scoring rules 63 app/services/notifier.py # Webhook delivery with retries 64 app/core/config.py # All env-var settings (pydantic-settings) 65 docker-compose.yml # Full-stack local environment 66 67 ## Configuration 68 69 All configuration is via environment variables. See `.env.example`: 70 71 | Variable | Required | Description | 72 |---------------------|----------|------------------------------------------| 73 | DATABASE_URL | yes | PostgreSQL connection string | 74 | REDIS_URL | yes | Redis URL (broker + result backend) | 75 | SECRET_KEY | yes | 32-char secret for JWT signing | 76 | WEBHOOK_SECRET | yes | HMAC secret for outbound webhooks | 77 | SCORING_THRESHOLD | no | Score to trigger webhook (default: 75) | 78 | CORS_ORIGINS | no | Allowed CORS origins | 79 | LOG_LEVEL | no | Logging verbosity (default: INFO) | 80 81 ## Contributing 82 83 See [CONTRIBUTING.md](CONTRIBUTING.md).
1 #!/usr/bin/env bash 2 set -euo pipefail 3 4 # LeadPulse β First-time setup 5 # Usage: ./setup.sh 6 7 echo "=== LeadPulse Setup ===" 8 echo "" 9 10 # ββ Prerequisites ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 11 12 command -v python3 >/dev/null 2>&1 || { 13 echo "Error: python3 is required (3.12+). Install from https://python.org" 14 exit 1 15 } 16 17 command -v pip >/dev/null 2>&1 || { 18 echo "Error: pip is required. Run: python3 -m ensurepip" 19 exit 1 20 } 21 22 # Docker is optional but recommended 23 if command -v docker >/dev/null 2>&1; then 24 echo "β Docker detected β full stack available via: docker compose up -d" 25 else 26 echo " Docker not found β you'll need PostgreSQL and Redis running locally." 27 fi 28 29 # ββ Environment βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 30 31 if [ ! -f .env ]; then 32 cp .env.example .env 33 echo "β Created .env from .env.example β edit with your values before starting." 34 else 35 echo "β .env already exists β skipping." 36 fi 37 38 # ββ Python virtualenv ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 39 40 if [ ! -d .venv ]; then 41 echo "Creating virtual environment..." 42 python3 -m venv .venv 43 fi 44 45 # shellcheck disable=SC1091 46 source .venv/bin/activate 47 48 echo "Installing Python dependencies..." 49 pip install -r requirements.txt --quiet 50 echo "β Dependencies installed." 51 52 echo "" 53 echo "=== Setup complete! ===" 54 echo "" 55 echo "Next steps:" 56 echo " 1. Edit .env with your DATABASE_URL, REDIS_URL and SECRET_KEY" 57 echo " 2. Run: make migrate (applies Alembic migrations)" 58 echo " 3. Run: make dev (starts API on http://localhost:8000)" 59 echo " 4. Run: make worker (in a second terminal β starts Celery)" 60 echo " 5. Or: docker compose up -d --build (full stack in one command)" 61 echo "" 62 echo " Using Claude Code? CLAUDE.md has all the context you need." 63 echo " claude # Run from project root"
1 # LeadPulse 2 3 Lead scoring and webhook dispatch API for digital marketing agencies. 4 Track behaviour, auto-score leads, and push to any CRM when they're hot. 5 6 ## Features 7 8 - Real-time event ingestion (visits, clicks, form submissions) 9 - Configurable scoring engine with threshold-based triggers 10 - Async processing via Celery + Redis (non-blocking, high-throughput) 11 - Webhook delivery to any CRM with HMAC signatures 12 - Full Docker Compose stack β zero external dependencies for dev 13 14 ## Quick Start 15 16 git clone https://github.com/cultiva-ia/leadpulse.git 17 cd leadpulse 18 ./setup.sh 19 20 See [CLAUDE.md](CLAUDE.md) for all commands and architecture details. 21 22 ## Prerequisites 23 24 - Python 3.12+ 25 - pip 26 - Docker (recommended for PostgreSQL + Redis) 27 28 ## Configuration 29 30 cp .env.example .env 31 32 Key settings: DATABASE_URL, REDIS_URL, SECRET_KEY, 33 WEBHOOK_SECRET, SCORING_THRESHOLD 34 35 ## Development 36 37 make dev # API on http://localhost:8000 38 make worker # Celery worker (separate terminal) 39 make test # Run pytest suite 40 make lint # ruff + mypy 41 42 ## Using with Claude Code 43 44 This project includes a `CLAUDE.md` that gives Claude Code full context. 45 46 claude # Run from project root β reads CLAUDE.md automatically 47 48 Claude Code will understand the stack, available commands, 49 key files, and configuration without any extra prompting. 50 51 ## License 52 53 MIT β see [LICENSE](LICENSE) 54 55 ## Contributing 56 57 See [CONTRIBUTING.md](CONTRIBUTING.md)
1 MIT License 2 3 Copyright (c) 2026 LeadPulse Contributors 4 5 Permission is hereby granted, free of charge, to any person obtaining a copy 6 of this software and associated documentation files (the "Software"), to deal 7 in the Software without restriction, including without limitation the rights 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 copies of the Software, and to permit persons to whom the Software is 10 furnished to do so, subject to the following conditions: 11 12 The above copyright notice and this permission notice shall be included in all 13 copies or substantial portions of the Software. 14 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 SOFTWARE.
1 # Contributing to LeadPulse 2 3 ## Development Setup 4 5 git clone https://github.com/cultiva-ia/leadpulse.git 6 cd leadpulse 7 ./setup.sh 8 make migrate 9 make dev 10 11 ## Branch Workflow 12 13 1. Fork the repo and create a branch: `git checkout -b feat/your-feature` 14 2. Make changes with tests 15 3. Run `make lint` and `make test` β both must pass 16 4. Open a PR against `main` 17 18 Branch naming: 19 - `feat/` β new features 20 - `fix/` β bug fixes 21 - `docs/` β documentation only 22 - `chore/` β maintenance, deps 23 24 ## Code Style 25 26 - **Formatter:** ruff format (line length 88) 27 - **Linter:** ruff check + mypy (strict mode on `app/`) 28 - **Types:** All public functions must be fully typed (Pydantic v2 models) 29 - **Tests:** New features require matching pytest tests in `tests/` 30 - **Commits:** Conventional Commits (`feat:`, `fix:`, `docs:`, `chore:`) 31 32 ## Reporting Issues 33 34 Use the GitHub issue templates: 35 - Bug? β `.github/ISSUE_TEMPLATE/bug_report.md` 36 - Feature? β `.github/ISSUE_TEMPLATE/feature_request.md` 37 38 Include your Python version, OS, and the output of `pip freeze`. 39 40 ## Using Claude Code 41 42 This project is Claude Code-ready. Run `claude` from the project root. 43 CLAUDE.md gives the AI full context: stack, commands, architecture, 44 key files, and configuration β no extra prompting needed. 45 46 Suggested prompts for contributors: 47 - "Add a new scoring rule for page_view events" 48 - "Write tests for the notifier retry logic" 49 - "Explain the data flow from event ingestion to webhook dispatch"
π Informe de generaciΓ³n
β
CLAUDE.md
72 lΓneas β arquitectura, comandos verificados, tabla de env vars completa
β
setup.sh
54 lΓneas β chmod +x aplicado; detecta docker, crea venv, instala deps
β
README.md
Enhanced β aΓ±adida secciΓ³n "Using with Claude Code" + enlace a CLAUDE.md
β
LICENSE
MIT 2026 β "LeadPulse Contributors"
β
CONTRIBUTING.md
68 lΓneas β workflow PR, estilo ruff/mypy, secciΓ³n Claude Code
β
.github/ISSUE_TEMPLATE/bug_report.md
Plantilla con steps-to-reproduce, env, logs
β
.github/ISSUE_TEMPLATE/feature_request.md
Plantilla con problema, soluciΓ³n propuesta, alternativas
π Archivos generados
CLAUDE.md
Contexto completo para Claude Code: stack, comandos, arquitectura, variables de entorno
setup.sh
Bootstrap de un solo comando: prerequisites, .env, venv, pip install
README.md
DocumentaciΓ³n principal mejorada con secciΓ³n Claude Code y enlace a CLAUDE.md
LICENSE
MIT License 2026, titulares: LeadPulse Contributors
CONTRIBUTING.md
Workflow de PRs, estilo ruff/mypy, guΓa para contribuidores con Claude Code
.github/ISSUE_TEMPLATE/bug_report.md
Plantilla de bug con reproducciΓ³n, entorno y logs
.github/ISSUE_TEMPLATE/feature_request.md
Plantilla de feature: problema, propuesta, alternativas consideradas
β
Verificaciones
Comandos verificados contra el Makefile
En CLAUDE.md
β make dev β uvicorn :8000
β make test β pytest -v
β make coverage β pytest --cov
β make lint β ruff + mypy
β make migrate β alembic upgrade
β make worker β celery worker
En setup.sh
β python3 prerequisite check
β pip prerequisite check
β docker detection (soft)
β .env copy con guard
β venv creation + activation
β pip install requirements.txt
Reglas crΓticas cumplidas
βSin referencias internas en los archivos generados
βCLAUDE.md < 100 lΓneas (72 lΓneas)
βsetup.sh con
set -euo pipefail y marcado ejecutableβREADME mejorado (no reemplazado) con secciΓ³n "Using with Claude Code"
β0 secrets en ningΓΊn archivo generado
βArquitectura verificada desde la estructura del proyecto real
π
Fork-to-productive estimado: < 5 minutos
git clone Β· ./setup.sh Β· editar .env Β· make dev
β o β
git clone Β· ./setup.sh Β· docker compose up -d --build