IN PROGRESS
Technical summary
NEXUS plugin that automatically enriches CNPJs detected in tasks and comments with official Receita Federal registration data via OpenCNPJ — company name, registration status, CNAE, capital and size. The Intelligence Hub enricher queries the keyless public API with an instant local cache; the tab offers manual lookup with masked or digits-only CNPJ and cache management.
Executed scope
- Registration:
plugin.jsonv1.0.0,icon_bg #0284c7, lucidebuildingicon and customicon.svg(lens + cyan arc, nois_core— additional plugin);registerTab('opencnpj','OpenCNPJ','building',tab.php,'OSINT & Enrichment')andregisterDoc('opencnpj','OpenCNPJ','building',doc.md); no dedicated modals and no cronjob (no periodic routine). opencnpj_enrichmenttable viaopencnpj_install():cnpj VARCHAR(14)PK,razao_social(NOT NULL),nome_fantasia,situacao_cadastral,cnae_principal,uf,municipio,capital_social,porte_empresaandcreated_at DATETIME(InnoDB, utf8mb4).- Keyless public API via cURL (
https://api.opencnpj.org/{14 digits}):NEXUS OpenCNPJ Integration (SITE_URL)User-Agent, 3s connect / 6s response timeouts,IPRESOLVE_V4and configurableSSL_VERIFYvia a Core constant; response validated (requirescnpjorrazao_socialin the JSON). - CNPJ detection in text: masked format (
XX.XXX.XXX/XXXX-XX) and 14 consecutive digits, deduplicated and length-validated before lookup. - Instant local cache:
opencnpj_query()serves from cache (source: cache) before the remote call (source: api) and persists the record — sub-ms hits on tasks. - API with 3 actions:
opencnpj_query(manual, cache → API),opencnpj_stats(cache total + last 20 consultations +api_onlinepulse testing CNPJ00000000000191) andopencnpj_delete(removes one CNPJ from the local cache). - Intelligence Hub enricher:
nx_intel_register_enricher('opencnpj', ['cnpj'], 'opencnpj_intel_enrich', 47)— signals withok/error/skippedstatus,Company Name · Statussummary,severity5 (active status) or 40 (inactive), formatted CNPJ artifact, respects themax_live_lookupsbudget (slice ≤ min(5, budget × 2)) and flagscached. - Fast Responses:
fastr.jsonmanifest with/opencnpj(required CNPJ argument), actionopencnpj_query— direct slash lookup. - On demand: no
cronjob.json(no periodic routine needed); no CLI. - UI: Alpine.js tab (
tab.php, 334 lines) with "API Online/Offline" badge, indicators (Cached Total, Local Speed < 1ms, Trusted Source — Receita Federal), manual lookup with a quick test (Petrobras33.000.167/0001-01), result with status badge (emerald/rose), formatted CNPJ, CNAE, capital in BRL, location and size; "Cached Companies" table with search by name/trade name/CNPJ/city and confirmed deletion. - Legacy:
opencnpj_filter_task_read/opencnpj_filter_comment_readdisabled (commented out inplugin.php) — they appended a "### 🏢 Dados Cadastrais Enriquecidos (OpenCNPJ)" markdown table; automatic enrichment moved to the Intelligence Hub (core/intel.php).
Stack and tools
- PHP 8 backend (no framework) + MySQL 8 (
opencnpj_enrichmenttable) - OpenCNPJ public API via cURL (
api.opencnpj.org) — official Receita Federal data - Alpine.js + Tailwind CSS (panel tab) + internal Plugin API (tabs/actions +
fastr.json+ Intel Hub)
Tags
OpenCNPJ, CNPJ, Receita Federal, OSINT, Enrichment, Intelligence Hub, NEXUS Plugin
Operational result
- Automatic CNPJ enrichment: tasks and comments containing CNPJs become Intelligence Hub signals with Receita Federal data.
- No API key: free public API — enable the plugin and it enriches; zero configuration.
- Flexible format: accepts masked CNPJ (
XX.XXX.XXX/XXXX-XX) or plain 14 digits. - Instant cache: hits respond in < 1ms with no external traffic — handy for lists repeating the same vendor.
- Contextual severity: 5 for active companies, 40 for inactive — flags delisted/dormant vendors.
- No routines: purely on-demand plugin — no cron or CLI.
GitHub progress (issues)
Real-time panel with latest repository issues.
live feed
open issues on GitHubcarregando andamento...
não foi possivel carregar as issues agora. abra no github pelo link acima.
Real results
NEXUS plugin that automatically enriches CNPJs detected in tasks and comments with official Receita Federal registration data via OpenCNPJ — company name, registration status, CNAE, capital and size. The Intelligence Hub enricher queries the keyless public API with an instant local cache; the tab offers manual lookup with masked or digits-only CNPJ and cache management.
Architecture and organization
- PHP 8
- MySQL 8
- cURL
- OpenCNPJ API
- Alpine.js
- Tailwind CSS
- Plugin NEXUS
Execution and operations
The project follows reproducible execution flow with technical validation in production-like environments.
Screenshots
Talk about this project
Apply this implementation pattern in your environment and accelerate delivery with technical consistency.