Technical Documentation
Architecture, data flows, data models, geospatial zones, and search engine for the MaxLeadsNow platform.
01 Overview
MaxLeadsNow is a B2B territorial intelligence platform that combines real-time business search with geospatial analysis. Designed for sales teams that need systematic territorial reconnaissance.
The platform allows sales representatives and managers to identify business opportunities in any geographic area, analyze the density and quality of existing businesses, and convert that data into actionable leads for their sales pipeline.
02 Architecture
The system is built on a modern web application architecture with hybrid rendering (server and client).
- Progressive web application (Next.js + React 19)
- Strict TypeScript
- 35+ UI components (native dark-mode)
- Interactive map renderer
- PostgreSQL database with modern ORM
- JWT authentication with HTTP-only cookies
- Search engine (index of millions of businesses)
- Server-side geospatial processing
Geospatial processing includes geodesic area calculation, point-in-polygon detection, and real-time density metric generation.
03 Search Engine
The business search engine allows querying an up-to-date index with millions of registered establishments. The advanced search accepts the following parameters:
| Parameter | Type | Description |
|---|---|---|
keyword |
string | Business type + search terms |
location |
string | City or metropolitan area |
language |
string | Language code (default: es) |
device |
string | Device type for contextual results |
Response structure
Each result from the engine returns the following fields:
{
"title": "Farmacia San Pablo Reforma",
"address": "Av. Paseo de la Reforma 222, Juarez, CDMX",
"phone": "+52 55 1234 5678",
"website": "https://ejemplo.com",
"rating": 4.6,
"reviewsCount": 312,
"category": "Farmacia",
"latitude": 19.4326,
"longitude": -99.1332
}
Preconfigured categories
The system is extensible to any business category available in the index.
04 Tactical Zones
Tactical zones are geographic regions defined by the user through polygon drawing tools on the map. Each zone is stored as a GeoJSON Polygon.
Zone data
| Field | Description |
|---|---|
geometry |
Array of lat/lng coordinates defining the polygon |
name |
Name assigned by the user |
color |
Hexadecimal color for map visualization |
assignedRep |
Assigned representative (optional) |
Metrics calculated per zone
- Area: km2 calculated with geodesic algorithm
- Density: businesses/km2
- Average rating: weighted average
- Contactability: % phone, % web, % email
- Excellent: rating ≥ 4.5
- Good: 4.0 – 4.4
- Average: 3.0 – 3.9
- Low: < 3.0
- No rating
- Top 5 businesses: ranking by composite score
- Workload: workday estimation
Composite score
The ranking of the best businesses per zone uses the formula:
score = rating * log10(reviewsCount + 1)
This calculation balances the business rating with its review volume, preventing businesses with few reviews but a perfect rating from dominating the ranking.
Workload estimation
time_per_visit = 20 min (constant)
travel_time = adjusted by density (min: 5 min, max: 20 min)
workday = 6 effective hours
visits_per_day = workday / (time_per_visit + travel_time)
05 Leads Pipeline
Each identified business can become a lead within the pipeline. Leads progress through defined states:
Lead data
Each lead stores: source, business type, contact data (name, phone, email, website, social media), full address, GPS coordinates, rating, operator notes, and creation and update timestamps.
Lead sources
Business types
06 CSV Import
The system allows bulk importing leads from CSV files. The process is fully automated with intelligent deduplication.
Import process
name businessName phone email address city state website socialUrl leadType
duplicate = (businessName + city) matches
OR (phone) matches
csv_import.07 Data Model
The system operates with 4 main entities stored in PostgreSQL:
Usuario {
id String @id
email String @unique
nombre String
activo Boolean @default(true)
createdAt DateTime
}
BusquedaGuardada {
id String @id
usuarioId String
nombre String
keyword String
resultados JSON // array of businesses found
zonas JSON // GeoJSON with drawn polygons
totalResultados Int
createdAt DateTime
}
Lead {
id String @id
usuarioId String
fuente String // search, scraping_web, scraping_social, manual, csv_import
estado String // nuevo, en_revision, aprobado, rechazado, exportado
tipo String // farmacia, odontologo, pediatra, etc.
nombre String?
negocio String?
direccion String?
ciudad String?
estado_geo String?
telefono String?
email String?
web String?
redesSociales String?
valoracion Float?
latitud Float?
longitud Float?
notas String?
createdAt DateTime
updatedAt DateTime
}
Importacion {
id String @id
usuarioId String
fuente String
archivo String
total Int
nuevos Int
duplicados Int
createdAt DateTime
}
08 Security
System security is implemented in multiple layers:
- JWT signed with HS256 algorithm
- HTTP-only cookies (not accessible from JavaScript)
- Session expiration: 30 days
- Authentication middleware on all protected routes
- Data isolation per user (every query filters by userId)
- Mandatory HTTPS in production
- No sensitive data storage on client
- Encrypted connections (SSL/TLS)
- Credentials managed via environment variables
Ready to get started?
Access the dashboard and start searching for businesses in your target zone.
Go to Dashboard arrow_forward