How chumbi-dev/cita-backend works
Project type and purpose
• This is a serverless, event-driven backend for managing medical appointments across multiple countries (Peru “PE” and Chile “CL”).
• Its core function is to receive appointment requests via HTTP, route them by country, persist them in country-specific MySQL databases, and update a global status in DynamoDB.
File structure
• Top-level config:
• serverless.ts – Serverless Framework descriptor (Lambda definitions, environment variables, IAM, event sources).
• package.json / tsconfig.json – TypeScript setup and dependencies.
• src/handlers – AWS Lambda entry points:
• appointment.ts – “createAppointment” Lambda (API Gateway → SNS publish).
• appointment_pe.ts / appointment_cl.ts – country-specific processors (SQS → MySQL).
• eventbridge.ts – EventBridge listener (Event → DynamoDB update).
• getAppointments.ts – query endpoint (not detailed in README, likely DynamoDB read).
• src/application – business logic layer (AppointmentService).
• src/domain – domain model (Appointment).
• src/infrastructure – adapters:
• dynamo/AppointmentRepository.ts
• sns/SnsPublisher.ts
• src/utils – input validation, common utilities.
README for additional insights
• Confirms an event-driven pipeline: API Gateway → Lambda → SNS → SQS → Lambda → RDS → EventBridge → Lambda → DynamoDB.
• Technologies: AWS Lambda, API Gateway, SNS, SQS, RDS MySQL (per country), DynamoDB, EventBridge, Serverless Framework.
• Environment variables and config (serverless.ts) as sidecar notes if needed.
• Filter policy split (SNS → SQS_PE / SQS_CL).
• Event-propagation pattern (EventBridge → DynamoDB).
• Optional “getAppointments” read path for completeness.