Para visao completa do projeto, arquitetura e plano de implementacao, consulte AGENTS.md.
TypeScript SDK for unified access to 93+ Brazilian public data sources. Wraps REST APIs, CSV downloads, FTP archives and geospatial services behind a single import { ibge, bcb } from '@brazilvisible/sdk' interface.
npm install— install dependenciesnpm run build— build with tsup (ESM + CJS + declarations)npm run dev— watch mode for developmentnpm test— run tests (vitest)npm run test:watch— run tests in watch modenpm run lint— lint with biomenpm run format— format with biomenpm run typecheck— type check with tsc --noEmit
- Language: TypeScript >=5.5 (strict mode)
- Runtime: Node.js >=18 (native fetch)
- HTTP: native fetch (zero deps)
- Build: tsup (ESM + CJS + .d.ts)
- Test: vitest + msw (Mock Service Worker)
- Lint/Format: biome
- CSV: csv-parse (for download sources)
src/— main source codesrc/sources/— one module per source group (ibge.ts, bcb.ts, cgu.ts, etc.)src/client.ts— shared HTTP client (fetch + retry + rate limiting)src/types.ts— shared typessrc/errors.ts— error hierarchysrc/download.ts— download + decompression utilitiessrc/cache.ts— local response/download cachesrc/parsers.ts— format parsers (CSV, JSON, XML)src/config.ts— global configuration (API keys, timeouts)tests/— vitest test suiteREADME.md— usage examples and documentation
- Code language: English (function names, variables, JSDoc)
- Public docs language: PT-BR (README, examples, user-facing error messages)
- Commits: conventional commits in English (feat:, fix:, docs:, test:)
- Branches:
main= releases,develop= development - Code style: biome, double quotes, semicolons, 2-space indent
- Naming: camelCase functions/vars, PascalCase types/classes, kebab-case files
- Type safety: strict mode, no explicit
any - Every source module must implement the
Sourceabstract class frombase.ts - All API responses return typed arrays
T[]by default - Tests must use mocked fetch (msw), never real network calls in unit tests
- Integration tests use
.integration.test.tssuffix
- Create
src/sources/<name>.ts - Implement
Sourcesubclass with typed methods - Re-export from
src/index.ts - Add tests in
tests/sources/<name>.test.ts - Run:
npm run lint,npm run typecheck,npm test - Commit:
feat: add <source> module