How wesleysemende133/buscador_juridico works
Buscador Jurídico is a public legal-search API for Mozambican and PALOP legislation, with article administration and automated law collection. The main workflow is a request reaching an HTTP handler, passing through a search or administration service, and reading or changing articles in the configured repository. Separate capabilities include the AI legal assistant, user authentication and plans, categorization, duplicate cleanup, and crawling. The repository supports JSON and PostgreSQL storage. Some subsystem links are documented or visible in entry-point wiring; unsampled implementation details are not inferred.
Main entry points: main.go API server · crawler.go Law crawler · artigo.go Legal articles · agente_service.go AI legal assistant
Components 33
HTTP API
- API server
main.go - API entrypoint
cmd/api/main.go - Search handlers
internal/handler/busca_handler.go - Admin handlers
internal/handler/admin_handler.go - Crawler handler
internal/handler/crawler_handler.go - Assistant handler
internal/handler/agente_handler.go - Auth handlers
internal/handler/auth_handler.go - OAuth handler
internal/handler/oauth_handler.go - Plans handler
internal/handler/planos_handler.go
Legislation workflows
- Legal search
internal/service/busca_service.go - Article management
internal/service/admin_service.go - Categorization
internal/service/categorizacao_service.go - Deduplication
internal/service/dedup_service.go - Duplicate cleanup
internal/service/limpeza_service.go - Legal articles
internal/domain/artigo.go
Assistant and accounts
- AI legal assistant
internal/service/agente_service.go - Usage limits
internal/service/limites_service.go - Authentication
internal/service/auth_service.go - JWT and passwords
internal/auth/jwt.go - Auth middleware
internal/auth/middleware.go
Law collection
- Law crawler
internal/crawler/crawler.go - Gemini extractor
internal/crawler/gemini_extractor.go - Regex extractor
internal/crawler/regex_extractor.go - Crawler sources
internal/crawler/fontes.go
Persistence
- JSON repository
internal/repository/json/json_repository.go - PostgreSQL repository
internal/repository/postgres/postgres_repository.go - Repository contracts
internal/repository/interfaces.go - Article data file
data/leis.json
Other components
- Public user
- Administrator
- PostgreSQL
- Gemini API
- Google identity
Connections 41
- Public user → API server: sends request
README.md - Administrator → API server: sends request
README.md - API server → Search handlers: routes search
main.go - API server → Admin handlers: routes admin
main.go - API server → Crawler handler: routes crawling
main.go - API server → Assistant handler: routes assistant
main.go - API server → Auth handlers: routes auth
- API server → OAuth handler: routes OAuth
- API server → Plans handler: routes plans
main.go - API entrypoint → Search handlers: routes search
cmd/api/main.go - API entrypoint → Admin handlers: routes admin
cmd/api/main.go - API entrypoint → Crawler handler: routes crawling
cmd/api/main.go - Search handlers → Legal search: calls
internal/handler/busca_handler.go - Admin handlers → Article management: calls
internal/handler/admin_handler.go - Crawler handler → Article management: calls
internal/handler/crawler_handler.go - Crawler handler → Law crawler: invokes
internal/handler/crawler_handler.go - Assistant handler → AI legal assistant: calls
internal/handler/agente_handler.go - Auth handlers → JWT and passwords: creates tokens
internal/handler/auth_handler.go - OAuth handler → JWT and passwords: creates tokens
internal/handler/oauth_handler.go - OAuth handler → Google identity: validates token
internal/handler/oauth_handler.go - Plans handler → Usage limits: checks usage
internal/handler/planos_handler.go - Legal search → Repository contracts: uses contract
internal/service/busca_service.go - Article management → Repository contracts: uses contract
internal/service/admin_service.go - AI legal assistant → Repository contracts: searches articles
internal/service/agente_service.go - AI legal assistant → Usage limits: checks quota
internal/service/agente_service.go - AI legal assistant → Gemini API: requests generation
- JSON repository → Article data file: reads and writes
- PostgreSQL repository → PostgreSQL: queries
internal/repository/postgres/postgres_repository.go - API server → JSON repository: configures fallback
main.go - API server → PostgreSQL repository: configures storage
main.go - JSON repository → Legal articles: loads and saves
internal/repository/json/json_repository.go - PostgreSQL repository → Legal articles: stores records
internal/repository/postgres/postgres_repository.go - Law crawler → Legal articles: extracts
internal/crawler/crawler.go - Law crawler → Gemini extractor: may use extractor
- Law crawler → Regex extractor: may use extractor
- Law crawler → Crawler sources: uses source list
- Categorization → Legal articles: categorizes
- Deduplication → Legal articles: checks duplicates
- Duplicate cleanup → Repository contracts: uses repository
internal/service/limpeza_service.go - API server → Categorization: initializes service
- API server → Duplicate cleanup: initializes service
main.go