01 - Getting Started
Clone, restore, migrate, run. By the end of this page you'll have the backend running on http://localhost:5000 with Swagger, Hangfire dashboard, and an empty PostgreSQL database ready to accept requests from the Flutter app.
Prerequisites
| Tool | Version | Why |
|---|---|---|
| .NET SDK | 8.0+ | ASP.NET Core runtime and build toolchain |
| PostgreSQL | 14+ | Primary database (snake_case via EF Core naming conventions) |
| Visual Studio 2022 / Rider | Latest | Recommended IDE with C# debugger (VS Code also works) |
| Postman / Insomnia | Any | Optional - for hitting endpoints directly |
BashVerify .NET installation
dotnet --version
# Should show 8.0.x or higher
dotnet --list-sdks
# Expected: 8.0.xxx [C:\Program Files\dotnet\sdk]
Step 1 - Clone & Restore
BashClone and restore NuGet packages
git clone <repo-url> D:\MO_Project\ekyc
cd D:\MO_Project\ekyc\backend
dotnet restore MO.Ekyc.sln
Step 2 - Set up PostgreSQL
Create a database named ekyc3 and a schema named ekyc. Default credentials are postgres/root123 (change in appsettings.Development.json if yours differ).
SQLDatabase + schema
CREATE DATABASE ekyc3;
-- Connect to ekyc3
CREATE SCHEMA ekyc;
The project currently has no EF Core migration files. The schema is managed via EntityTypeConfiguration classes applied in OnModelCreating. Use one of these approaches for initial setup:
- Run a one-time
dbContext.Database.EnsureCreatedAsync()from a dev controller (DevControllerhas purge endpoints) - Check DB Actions Checklist for the full schema setup steps
- Run DDL scripts from the
backend/database/folder if present
Step 3 - Configure appsettings
Development settings live in backend/src/MO.Ekyc.Api/appsettings.Development.json. The defaults should work for local PostgreSQL with mock mode enabled.
backend/src/MO.Ekyc.Api/appsettings.Development.jsonJSON
{
"ConnectionStrings": {
"EkycDb": "Host=127.0.0.1;Port=5432;Database=ekyc3;Username=postgres;Password=root123;Search Path=ekyc"
},
"MockMode": {
"GlobalMockEnabled": true
},
"Sms": { "Mode": "FIXED_OTP", "FixedOtp": "1234" },
"Email": { "Mode": "FIXED_OTP", "FixedOtp": "1234" }
}
With GlobalMockEnabled: true, the backend skips all real external provider calls. OTPs are fixed to 1234. You can run the full Flutter journey without hitting NSDL, Decentro, Razorpay, or any other production provider. See 02 - Mock Mode.
Step 4 - Run the API
Bashdotnet run
cd D:\MO_Project\ekyc\backend\src\MO.Ekyc.Api
dotnet run
# Output:
# Now listening on: http://localhost:5000
# Application started. Press Ctrl+C to shut down.
Step 5 - Verify the Setup
| URL | Purpose |
|---|---|
http://localhost:5000/swagger | Interactive API explorer. Try any endpoint from the browser. |
http://localhost:5000/hangfire | Background job dashboard. Shows queued / processing / failed jobs. |
http://localhost:5000/api/v1/journey/init | Smoke test - should return a new session with JSON body. |
BashQuick smoke test with curl
curl "http://localhost:5000/api/v1/journey/init?device_type=DESKTOP"
# Expected: 200 OK with { "success": true, "data": { "leadSessionId": "...", ... } }
Step 6 - Connect the Flutter App
The Flutter app defaults to http://localhost:5000 in dev mode. Just start it up and it should talk to your local backend.
BashStart Flutter client
cd D:\MO_Project\ekyc\flutter_app
C:\flutter\bin\flutter run -d chrome --web-port 8080
Open http://localhost:8080 in Chrome. You should see Stage 0 loader, then navigate to Stage 1 Registration.
The backend's CORS policy (backend/src/MO.Ekyc.Api/appsettings.json → Cors.AllowedOrigins) already permits http://localhost:3000 (WarRoom) and http://localhost:8080 (Flutter web). Add more origins if you run on other ports.
Troubleshooting
"Cannot connect to PostgreSQL"
- Start the PostgreSQL service:
net start postgresql-x64-14 - Verify connection:
psql -U postgres -d ekyc3 -c "SELECT 1;" - Check
appsettings.Development.jsonconnection string password matches your local PostgreSQL setup
"Schema 'ekyc' does not exist"
- Connect to
ekyc3database and runCREATE SCHEMA ekyc; - See DB Actions Checklist
"Port 5000 already in use"
- Find the process:
netstat -ano | findstr :5000 - Kill it:
taskkill /PID <pid> /F - Or change the port in
launchSettings.json
"Hangfire dashboard returns 401"
- The dashboard is only enabled in Development environment
- Verify you're running with
ASPNETCORE_ENVIRONMENT=Development(default fordotnet run)