How konvex-jr/backendprojetoserp works
BackendProjetosERP is an Express/TypeScript API for an internal ERP. The principal workflow is a frontend request entering registered HTTP routes, passing authentication and permission checks, and invoking domain use cases that read or mutate repository-backed data. Major product branches include people and sessions, projects and tasks, training, knowledge, initiatives, documents, and attachments. PostgreSQL and filesystem attachment storage are production concerns; the repository factory also documents interchangeable in-memory repositories. Some subsystem links reflect README or source-index documentation because their implementation excerpts were not provided.
Main entry points: RepositoryFactoryInterface.ts Repository factory · registro.ts Route registry · UsuarioRoutes.ts User and auth routes · TarefaRoutes.ts Task routes
Components 24
HTTP entry
- Route registry
source/modulos/registro.ts - User and auth routes
source/infra/http/routes/UsuarioRoutes.ts - Task routes
source/infra/http/routes/TarefaRoutes.ts - Project routes
source/infra/http/routes/ProjetoRoutes.ts - Other feature routes
source/infra/http/routes - HTTP contract
source/infra/http/Http.ts
Business services
- Session use cases
source/useCases/auth - People use cases
source/useCases/pessoas - Project use cases
source/useCases/projetos - Task use cases
source/useCases/tarefas - Training management
source/useCases/capacitacoes/GerirCapacitacoes.ts - Knowledge base
source/useCases/conhecimento - Initiatives
source/useCases/iniciativas - Document management
source/useCases/documentos - Attachment management
source/useCases/anexos/GerirAnexos.ts
Access control
- Permission checks
source/shared/seguranca/permissoes.ts - Task visibility rules
source/shared/seguranca/regrasTarefa.ts
Persistence
- Repository factory
source/domain/interfaces/RepositoryFactoryInterface.ts - Database repositories
source/infra/repository/DatabaseRepositoryFactory.ts - Memory repositories
source/infra/repository/MemoryRepositoryFactory.ts - Task repository
source/infra/repository/database/TarefaRepositoryDatabase.ts - Attachment storage
source/infra/arquivos/ArmazenamentoAnexosDisco.ts
Other components
- ERP frontend
- PostgreSQL
Connections 24
- ERP frontend → Route registry: sends requests
README.md - Route registry → User and auth routes: registers
source/modulos/registro.ts - Route registry → Task routes: registers
source/modulos/registro.ts - Route registry → Project routes: registers
source/modulos/registro.ts - Route registry → Other feature routes: registers
source/modulos/registro.ts - User and auth routes → Session use cases: invokes
source/infra/http/routes/UsuarioRoutes.ts - User and auth routes → People use cases: invokes
source/infra/http/routes/UsuarioRoutes.ts - Task routes → Task use cases: invokes
source/infra/http/routes/TarefaRoutes.ts - Project routes → Project use cases: invokes
source/infra/http/routes/ProjetoRoutes.ts - Task routes → Permission checks: checks access
source/infra/http/routes/TarefaRoutes.ts - Task routes → Task visibility rules: checks visibility
source/infra/http/routes/TarefaRoutes.ts - User and auth routes → HTTP contract: uses
source/infra/http/routes/UsuarioRoutes.ts - Route registry → HTTP contract: registers routes
source/infra/http/Router.ts - Session use cases → Repository factory: obtains repositories
- People use cases → Repository factory: obtains repositories
- Project use cases → Repository factory: obtains repositories
source/useCases/projetos/Equipe.ts - Task use cases → Repository factory: obtains repositories
- Training management → Repository factory: obtains repositories
source/useCases/capacitacoes/GerirCapacitacoes.ts - Attachment management → Repository factory: obtains repositories
source/useCases/anexos/GerirAnexos.ts - Attachment management → Attachment storage: stores bytes
source/useCases/anexos/GerirAnexos.ts - Repository factory → Database repositories: implemented by
source/infra/repository/DatabaseRepositoryFactory.ts - Repository factory → Memory repositories: implemented by
source/infra/repository/MemoryRepositoryFactory.ts - Database repositories → Task repository: creates
source/infra/repository/DatabaseRepositoryFactory.ts - Task repository → PostgreSQL: reads and writes
source/infra/repository/database/TarefaRepositoryDatabase.ts