How edinaldofcs/synexa-api works
1. Overall shape
- This is a NestJS / TypeScript backend API. The app is organized as a set of feature modules under src/, with a single bootstrap entry point in src/main.ts and a root composition module in src/app.module.ts.
2. Primary runtime boundary
- The process is a server-side Node.js service exposed through NestJS controllers. There is no sign of a frontend in this repo; the architecture is centered on request handling, business logic, and persistence/integration services.
3. Feature modules
- The main business areas are split into:
- admin — administrative API surface
- chat — conversations and messages
- imports — contact import flows
- painel-clients — client/admin configuration domain, with DTOs for agents, APIs, clients, and intentions
- tables — table-oriented data access plus export endpoints
4. Controller → service → infrastructure flow
- Each feature follows the NestJS pattern: HTTP controllers accept requests, delegate to services, and services call shared infrastructure. This creates a clear separation between transport, domain logic, and persistence/external systems.
5. Shared persistence layer
- src/common/prisma contains PrismaService and PrismaModule, indicating Prisma is the primary database access layer. The data model itself is defined in prisma/schema.prisma, so the schema is a major architectural boundary.
6. External service integration
- src/common/supabase contains SupabaseService and SupabaseModule, so the app also integrates with Supabase as an external backend service. Based on the repo structure, this is likely used for storage/auth/data exchange in one or more feature flows, rather than being the main application runtime.
7. Input contracts and boundaries
- Each domain uses DTOs under its own dto/ folder, such as create-* and update-* classes. That means request validation and payload shaping are part of the boundary between API clients and internal services.
8. Likely data domains
- From the naming, the application appears to manage:
- conversational data (chat)
- imported contacts (imports)
- client/agent/API/intention configuration (painel-clients)
- tabular records and exports (tables)
- administrative actions (admin)
- These are distinct subdomains, but they share the same persistence and service infrastructure.
9. Export and reporting path
- src/tables/export.controller.ts suggests a dedicated export endpoint separate from the normal tables API. That implies a read-heavy/reporting boundary where data is retrieved from the database and transformed for external consumption.
10. Deployment and packaging
- The repo is containerized with a Dockerfile plus docker-compose.yml and docker-compose.dev.yml, so it supports both local development and production-style runtime packaging. This is a single-service deployment model rather than a multi-service microservice layout.
11. CI/CD and quality gates
- GitHub Actions workflows exist for ci.yml and deploy.yml, so build/test/deploy automation is part of the architecture. Testing uses Jest, including e2e coverage under test/.
12. What is not present
- There is no evidence of message brokers, background job workers, or a separate cache layer in the file tree. The architecture appears to be a monolithic API service with modular internal boundaries, backed by Prisma-managed persistence and selective Supabase integration.
Main entry points: app.module.ts App module · prisma.service.ts Prisma service · tables.service.ts Tables service · admin.service.ts Admin service
Components 31
Runtime
Bootstrap and application composition
- Bootstrap · Starts the NestJS application
src/main.ts - App module · Composes the application feature modules
src/app.module.ts - App controller · Top-level application controller
src/app.controller.ts
Features
Domain modules exposed through Nest controllers
- Admin · Administrative API surface
src/admin/admin.module.ts - Admin API · Admin HTTP endpoints
src/admin/admin.controller.ts - Admin service · Admin business logic
src/admin/admin.service.ts - Chat · Conversation and message APIs
src/chat/chat.module.ts - Chat API · Conversation and message endpoints
src/chat/chat.controller.ts - Chat service · Conversation and message logic
src/chat/chat.service.ts - Chat DTOs · Payload contracts for chat requests
- Imports · Contact import flows
src/imports/imports.module.ts - Imports API · Import endpoints
src/imports/imports.controller.ts - Imports service · Import processing logic
src/imports/imports.service.ts - Painel clients · Client, agent, API, and intention configuration
src/painel-clients/painel-clients.module.ts - Painel API · Configuration endpoints
src/painel-clients/painel-clients.controller.ts - Painel service · Configuration and domain logic
src/painel-clients/painel-clients.service.ts - Painel DTOs · Contracts for clients, agents, APIs, and intentions
- Tables · Tabular data and export APIs
src/tables/tables.module.ts - Tables API · Table data endpoints
src/tables/tables.controller.ts - Export API · Dedicated export endpoint
src/tables/export.controller.ts - Tables service · Table querying and export preparation
src/tables/tables.service.ts
Shared
Common infrastructure modules
- Common module · Shared infrastructure composition
src/common/common.module.ts - Prisma module · Provides database access infrastructure
src/common/prisma/prisma.module.ts - Prisma service · Primary database service
src/common/prisma/prisma.service.ts - Supabase module · Provides Supabase integration
src/common/supabase/supabase.module.ts - Supabase service · Supabase-backed operations
src/common/supabase/supabase.service.ts
Data
Persistence schema and database boundary
- Prisma schema · Database schema definition
prisma/schema.prisma
Ops
Container and CI/CD packaging
- Container build · Dockerized service packaging
Dockerfile - Compose setup · Local and production compose definitions
docker-compose.yml - CI workflow · Continuous integration pipeline
.github/workflows/ci.yml - Deploy workflow · Deployment pipeline
.github/workflows/deploy.yml
Connections 34
- Bootstrap → App module: boots · Application starts by loading the root module
- App module → App controller: exposes · Root module includes the top-level controller
- App module → Common module: imports · Shares infrastructure across features
- App module → Admin: imports · Composes admin feature
- App module → Chat: imports · Composes chat feature
- App module → Imports: imports · Composes imports feature
- App module → Painel clients: imports · Composes painel clients feature
- App module → Tables: imports · Composes tables feature
- Admin API → Admin service: delegates · Controller passes requests to the service
- Chat API → Chat service: delegates · Controller passes requests to the service
- Imports API → Imports service: delegates · Controller passes requests to the service
- Painel API → Painel service: delegates · Controller passes requests to the service
- Tables API → Tables service: delegates · Controller passes requests to the service
- Export API → Tables service: delegates · Export endpoint reuses the tables service
- Chat service → Prisma service: reads/writes · Chat data is persisted through Prisma
- Imports service → Prisma service: reads/writes · Import flows persist data through Prisma
- Painel service → Prisma service: reads/writes · Configuration data is stored through Prisma
- Tables service → Prisma service: reads/writes · Tabular queries and exports use Prisma
- Tables service → Supabase service: integrates · Tables flows may use Supabase-backed operations
- Prisma module → Prisma service: provides · Prisma module exposes the database service
- Supabase module → Supabase service: provides · Supabase module exposes the integration service
- Common module → Prisma module: bundles · Common module bundles database access
- Common module → Supabase module: bundles · Common module bundles external integration
- Prisma service → Prisma schema: maps to · Database service is backed by the Prisma schema
- Admin service → Prisma service: reads/writes · Admin actions likely touch the database
- Admin service → Supabase service: integrates · Admin flows may call external Supabase services
- Chat service → Chat DTOs: accepts · Chat service is fed by request DTOs
- Imports service → Prisma service: uses · Import processing depends on database access
- Painel service → Painel DTOs: accepts · Configuration service uses feature DTOs
- Tables service → Prisma schema: queries · Tables and exports operate on the database model
- Container build → Bootstrap: packages · Container build packages the application entrypoint
- Compose setup → Container build: runs · Compose definitions run the containerized service
- CI workflow → Container build: builds · CI validates the containerized application
- Deploy workflow → Compose setup: deploys · Deployment workflow uses the composed service definition