15 - Master Dev Help

A single lookup sheet: "I want to change X — which file do I open?" Pick a category from the index below, scan the table, click through to the file or to the detailed page that explains the pattern.

How to use this page

This is a cheat-sheet, not a tutorial. Every row answers one question: where does this live? For the why and the how of a topic, click the "see also" link in each section to jump to the full guide.

HTTP & Entry Point

I want to change…Open this fileNotes
DI registration, Hangfire, Swagger, auth wiringsrc/MO.Ekyc.Api/Program.csSingle top-level file; all builder.Services.Add* calls live here.
Dev-only / prod-only configsrc/MO.Ekyc.Api/appsettings.json
src/MO.Ekyc.Api/appsettings.Development.json
Env-specific overrides merge over the base file.
Manually fire requests against the APIsrc/MO.Ekyc.Api/MO.Ekyc.Api.httpVS / Rider HTTP client format; Swagger is at /swagger in dev.

Controllers & Routes

Controllers are grouped by stage under src/MO.Ekyc.Api/Controllers/<StageN>/. The Admin and WarRoom subfolders host admin-only endpoints. See 07 - Controllers for the full list.

I want to…Open this fileNotes
Add a new customer-facing endpointControllers/Stage<N>/<Thing>Controller.csCopy an existing controller in the same stage. Add [RequiresStage(<N>)].
Add an admin/WarRoom endpointControllers/Admin/*.cs
Controllers/WarRoom/*.cs
Use [AdminAuthorize(Roles="...")].
Change the URL of an existing endpointsrc/MO.Ekyc.Shared/Constants/ApiRoutes.csAll routes are constants here so the Flutter app and backend stay in sync.
Change the stage unlock ordersrc/MO.Ekyc.Shared/Constants/StageDefinitions.csSource of truth for the current/minimum stage numbers.
Enforce a stage gate on an endpointsrc/MO.Ekyc.Api/Filters/StageValidationFilter.csFilter reads the lead's current_stage from DB.

Services (business logic)

Services live in src/MO.Ekyc.Infrastructure/Services/<StageN>/. Common/ hosts cross-cutting services like HashingService, JourneyTracker, OtpGeneratorService, SmsTemplateService, NameMatchService, StpDecisionService. See 08 - Services.

I want to…Open this fileNotes
Add a new business-logic serviceServices/Stage<N>/<Thing>Service.csRegister it in Program.cs (or the Service Extensions file if present).
Change name-match scoringServices/Common/NameMatchService.csFuzzy match used by Stages 6, 7, 11.
Change STP decision rulesServices/Common/StpDecisionService.csBased on cumulative reason codes stored on the Lead row.
Change OTP length / expiry / cooldownsServices/Common/OtpGeneratorService.cs
Services/Stage2/OtpVerificationService.cs
Services/Stage3/EmailVerificationService.cs
Constants at the top of each verification service.
Add a new stage-specific service methodServices/Stage<N>/<Thing>Service.csControllers should call only one service per request; service calls providers.
Trigger a downstream CRM / CDP / Kafka eventServices/Common/DownstreamEventPublisher.csFans out to Kafka + Zoho CRM + Clevertap via PublishToAllAsync.
Write a journey activity log entryServices/Common/JourneyTracker.csWrites to lead_state_transitions and journey_stage_events.

External Providers

All outbound HTTP, SOAP, Kafka and SDK integrations live under src/MO.Ekyc.Infrastructure/ExternalProviders/. Each category is a folder (Pan, Bank, Face, Esign, Liveness, Kra, …). See 09 - External Providers.

I want to…Open this fileNotes
Change how a PAN is verifiedExternalProviders/Pan/ (Ndml, Nsdl, CvlKra, Hyperverge, Uti, Zintlr)Chain order comes from provider_configurations table (see DB section).
Change bank penny-drop providerExternalProviders/Bank/ (HypervergeRpd, SetuReversePenny, YesBankImps, Decentro, KarzaBank, DigitapOcr)Provider chain executor picks based on priority + circuit breaker.
Change face-match / liveness providerExternalProviders/Face/
ExternalProviders/Liveness/
Hyperverge, AINXT, Digio variants exist for both.
Change Aadhaar / DigiLocker integrationExternalProviders/Aadhaar/AinxtDigilockerProvider.csCallback URL is configured per env in appsettings.
Change eSign providerExternalProviders/Esign/ (NsdlEsign, HypervergeEsign, EmudhraEsign)Multi-provider fallback via ProviderChainExecutor.
Add a new provider categoryExternalProviders/<NewCategory>/I<New>Provider.cs + <Vendor>Provider.csRegister in Program.cs. Add a row in provider_configurations with priority.
Change circuit breaker thresholds / windowsExternalProviders/Common/CircuitBreaker.cs
provider_configurations.circuit_breaker_threshold
Runtime thresholds come from the DB row, not code.
Change provider chain fallback behaviourExternalProviders/Common/ProviderChainExecutor.csHandles priority ordering, circuit-open skip, and AllProvidersFailedException.

Database & Persistence

See 10 - Database & Sync Tables for the full entity map (75 tables across the ekyc schema).

I want to…Open this fileNotes
Add a new table / entitysrc/MO.Ekyc.Domain/Entities/<Thing>.cs
src/MO.Ekyc.Infrastructure/Persistence/Configurations/<Thing>Configuration.cs
Pure POCO + Fluent API config. Then add DbSet in EkycDbContext.
Change an existing entity schemasrc/MO.Ekyc.Domain/Entities/<Thing>.csAdd EF migration via dotnet ef migrations add <Name> in the Api project.
Change the DbContext or add a Setsrc/MO.Ekyc.Infrastructure/Persistence/EkycDbContext.csSchema name ekyc is set here.
Add a migrationsrc/MO.Ekyc.Infrastructure/Persistence/Migrations/Run dotnet ef migrations add from the Api project.
Change the connection stringappsettings*.json → ConnectionStrings:EkycDbAlso set in the CI env. PostgreSQL only.
Seed reference data (lookup tables)src/MO.Ekyc.Infrastructure/Persistence/SeedData/*.csRuns on startup in dev.
Run a raw SQL query safelyUse ExecuteSqlInterpolatedAsync, not ExecuteSqlRawAsyncEF1002: raw + string interpolation is a SQL-injection finding (see Sonar analysis).

Auth, Filters & Middleware

I want to…Open this fileNotes
Change JWT issuance / validationsrc/MO.Ekyc.Api/Program.cs (AddJwtBearer)
src/MO.Ekyc.Api/Controllers/WarRoom/WarRoomAuthController.cs
Secret key comes from Jwt:SecretKey config (min 32 chars).
Gate an endpoint behind a stage[RequiresStage(N)] attribute → Filters/StageValidationFilter.csReturns 409 if the lead's current_stage < N.
Gate an admin endpoint by role[AdminAuthorize(Roles="...")] → Filters/AdminAuthorizationFilter.csRoles come from the JWT claim.
Change request-level loggingMiddleware/RequestLoggingMiddleware.cs
Middleware/CorrelationIdMiddleware.cs
Correlation ID is attached here and flows to Serilog + DB audit.
Change global exception handlingMiddleware/ExceptionHandlingMiddleware.csReturns structured ApiResponse.Fail on any unhandled exception.
Change session sliding-refresh rulesMiddleware/SessionRefreshMiddleware.csExtends JWT expiry on every authenticated call.

Background Jobs

Hangfire-backed jobs live under src/MO.Ekyc.Infrastructure/BackgroundJobs/. Dashboard at /hangfire in dev.

JobFileWhat it does
Dropoff detection + nudge SMSBackgroundJobs/DropoffDetectionJob.csMarks stale leads as DROPPED, sends one-time nudge SMS.
CS journey retry (agent hand-off)BackgroundJobs/CsJourneyRetryJob.csRetries CS_* trigger codes with cooldown.
Downstream event publisherBackgroundJobs/DownstreamEventPublisherJob.csFlushes queued downstream_events to Kafka / CRM / CDP.
Analytics snapshotBackgroundJobs/AnalyticsSnapshotJob.csHourly rollup into analytics tables.
Session cleanupBackgroundJobs/SessionCleanupJob.csExpires sessions past their timeout.
Aadhaar deletion (compliance)BackgroundJobs/AadhaarDeletionJob.csPurges raw Aadhaar data after retention window.
Human-readable activity log writerBackgroundJobs/ActivityLogWriterService.csConsumer side of journey_activity_logs.

Config & Environment

SettingLocationNotes
Global mock modeappsettings.Development.json → MockMode:GlobalMockEnabledWhen true, every provider returns canned data. See 02 - Mock Mode.
Per-provider mock modeDB: provider_configurations.mock_modeOverrides the global flag for one provider at a time.
SMS mode (REAL / FIXED_OTP)appsettings → Sms:ModeFIXED_OTP logs the OTP instead of sending.
JWT signing keyappsettings → Jwt:SecretKey (min 32 chars)Hard-fails at startup if missing or too short.
Provider endpoints & credentialsappsettings → ExternalProviders:<Vendor>Do not commit real creds — use env vars / secret store.
Stage unlock thresholds / timeoutsappsettings → Journey:*E.g. MaxBankAttempts, PanReverifyDaysThreshold, FaceMatchStpMinScore.
Kafka topics / brokersappsettings → Kafka:*See Infrastructure/Kafka/KafkaProducer.cs.

Logging, Audit & Telemetry

I want to…Open this file / tableNotes
Change Serilog sinks / levelsProgram.cs (UseSerilog)
appsettings → Serilog:*
Console sink in dev, file sink in prod.
See external API call historyQuery table ekyc.api_audit_logEvery provider call is logged here by ApiAuditLogger.
See the user-facing journey timelineQuery table ekyc.journey_activity_logsWritten by ActivityLogWriterService → used by WarRoom UI.
See state transitionsQuery table ekyc.lead_state_transitions
ekyc.journey_stage_events
Written by JourneyTracker.
See EF-generated SQL in consoleappsettings → Logging:Microsoft.EntityFrameworkCore.Database.Command:InformationDev only. See 11 - Debugging.
Inspect correlation IDs across servicesMiddleware/CorrelationIdMiddleware.csHeader: X-Correlation-Id. Flows to Serilog + audit log.

Testing

Test typeProjectNotes
Unit tests (services, mocks, fast)tests/MO.Ekyc.UnitTests/xUnit + Moq + FluentAssertions + InMemory EF.
Integration tests (real DB via EF InMemory, multi-service flows)tests/MO.Ekyc.IntegrationTests/FullJourneyFlowTests runs Stages 11 → 15 end-to-end.
Api-level tests (WebApplicationFactory)tests/MO.Ekyc.Api.Tests/Uses CustomWebApplicationFactory<Program> — that's why Program is public partial class not static.
Run all testsdotnet test MO.Ekyc.slnFrom the backend/ folder.

Build, Analysis & CI

I want to…Open this fileNotes
Add a global MSBuild propertybackend/Directory.Build.propsCurrently registers SonarAnalyzer.CSharp + SARIF error log for every project.
Run Sonar static analysis locallydotnet build + node scripts/aggregate-sonar.jsSee 14 - Sonar Analysis for the full HTML report workflow.
Apply bulk Sonar auto-fixersbackend/scripts/fix-*.jsS2139, S6667, unused logger/field, IDisposable. Each script is self-documenting.
Build the whole solutiondotnet build MO.Ekyc.sln -c DebugFrom the backend folder. Stop any running Api first to avoid file locks.
Publish a release builddotnet publish src/MO.Ekyc.Api -c Release -o out/Self-contained publish is not enabled by default.

Common "Where do I add…"

These are the questions that come up most in code review:

New thingAdd it hereDon't forget
A new HTTP routeApiRoutes.cs constant → Controllers/Stage<N>/<Name>Controller.cs → service method → optional [RequiresStage]Swagger picks it up automatically; update frontend ApiService.
A new Stage serviceServices/Stage<N>/<Name>Service.csRegister in Program.cs; inject IJourneyTracker + IDownstreamEventPublisher if it transitions state.
A new external providerExternalProviders/<Category>/I<Name>Provider.cs + <Vendor><Name>Provider.csRegister + insert row in provider_configurations.
A new DB tableDomain/Entities/<Name>.cs → Persistence/Configurations/<Name>Configuration.cs → DbSet in EkycDbContextGenerate migration with dotnet ef migrations add.
A new downstream event typeServices/Common/DownstreamEventPublisher.cs + event classAdd subscriber in the consumer (Kafka / CRM handler).
A new Hangfire jobBackgroundJobs/<Name>Job.csRegister with RecurringJob.AddOrUpdate in Program.cs.
A new admin roleAdminAuthorizationFilter.cs + update WarRoomAuthController loginRoles are plain strings in the JWT.
A new SMS / email templateServices/Common/SmsTemplateService.cs (or email equivalent)Templates live in the service; placeholders replaced at send time.
Still lost?

Open 03 - Project Tour for the folder-by-folder walkthrough, 06 - Stage Walkthrough for an end-to-end HTTP→DB trace, or 12 - How-To Guides for task-oriented recipes.