How mateusz-bogacz-collegiumwitelona/spcrm_backend works
SPCRM is a backend CRM for a steel-trading business. The main workflow is an authenticated user request entering the REST API, being validated and mapped, handled by a domain service, and returned as a response; business operations also read and update CRM records. Distinct capabilities include sales and invoicing, product inventory, user and company management, tasks, analytics, and scheduled email/cleanup work. The sampled sources confirm representative controller-to-service calls, authentication, persistence in event handling, and SMTP delivery; many other subsystem links are omitted where their wiring was not sampled.
Main entry points: Program.cs API host · AppDbContext.cs CRM database · DealController.cs Deal endpoints · UserController.cs User endpoints
Components 25
API and identity
- API host
Api/Program.cs - User endpoints
Api/Controllers/UserController.cs - Company endpoints
Api/Controllers/CompanyController.cs - Deal endpoints
Api/Controllers/DealController.cs - Authentication
Services/Services/AuthServices.cs - Request validation
Api/Validators/Validators - Request mapping
Api/Mappers
CRM operations
- Company services
Services/Services/CompanyServices.cs - Contact services
Services/Services/ContactServices.cs - Deal services
Services/Services/DealServices.cs - Offer services
Services/Services/OfferServices.cs - Product inventory
Services/Services/ProductSevices.cs - Invoices and payments
Services/Services/InvoiceService.cs - Task services
Services/Services/TaskServices.cs - Analytics
Services/Services/AnalyticsService.cs
Domain workflow
- Deal and task states
Domain/State/DealStateMachine.cs - Deal completion event
Domain/Events/DealCompletedEvent.cs - Invoice event handler
Services/Handlers/DealCompletedEventHandler.cs
Persistence and reports
- CRM database
Infrastructure/AppDbContext.cs - PDF generation
Infrastructure/Pdf/AnalyticsPdfGenerator.cs
Async integrations
- Scheduled workers
Worker/Workers/InvoiceEmailWorker.cs - Email delivery
Email/SmtpEmailService.cs - SMTP server
- Redis cache
Other components
- CRM user
Connections 28
- CRM user → API host: sends requests
- API host → User endpoints: routes requests
- API host → Company endpoints: routes requests
- API host → Deal endpoints: routes requests
- API host → Request validation: validates requests
- User endpoints → Authentication: calls identity
- User endpoints → Request mapping: maps requests
- User endpoints → Company services: calls services
- Company endpoints → Request mapping: maps requests
- Company endpoints → Company services: calls services
- Company endpoints → Deal services: gets company deals
- Deal endpoints → Request mapping: maps requests
- Deal endpoints → Deal services: calls services
- Deal endpoints → Task services: adds deal task
- Deal endpoints → Deal and task states: changes status
- Deal services → Deal completion event: raises event
- Invoice event handler → Deal completion event: handles event
- Invoice event handler → CRM database: creates invoice
- Invoice event handler → Email delivery: sends invoice email
- Invoices and payments → CRM database: reads and writes
- Product inventory → CRM database: reads and writes
- Offer services → CRM database: reads and writes
- Task services → CRM database: reads and writes
- Analytics → CRM database: reads records
- Analytics → PDF generation: generates reports
- Scheduled workers → Email delivery: dispatches email
- Email delivery → SMTP server: sends mail
- API host → Redis cache: configures cache