Skip to content

Local Setup Guide

Akash Goswami edited this page Jun 29, 2026 · 1 revision

Local Setup Guide

Get DocAnalytics running on your machine from a clean clone.

Prerequisites

Tool Version Notes
.NET SDK 10.x dotnet --version should print 10.*
PostgreSQL 18 Includes psql and (optionally) pgAdmin
Git any recent
IDE Visual Studio 2026 / VS Code / Rider
dotnet-ef tool latest dotnet tool install --global dotnet-ef (open a fresh terminal after)

💡 During PostgreSQL install you set a password for the postgres superuser. Remember it — it goes in your connection string.

1. Clone & open

git clone https://github.com/Akash29g/Document_Processing_Analytics.git
cd Document_Processing_Analytics

Open DocAnalytics.slnx via File → Open → Project/Solution. Do not create a new project.

2. Set local secrets (git-ignored)

appsettings.json ships with a blank password + placeholder JWT key. Provide real values via .NET user-secrets:

# PostgreSQL connection string (replace YOUR_LOCAL_PW)
dotnet user-secrets set "ConnectionStrings:Default" "Host=localhost;Port=5432;Database=docanalytics;Username=postgres;Password=YOUR_LOCAL_PW" --project DocAnalytics.Api

# JWT signing key (must be >= 32 characters)
dotnet user-secrets set "Jwt:Key" "any-32+-character-secret-key-for-local-dev" --project DocAnalytics.Api

Verify: dotnet user-secrets list --project DocAnalytics.Api

⚠️ Username/Password must match a real PostgreSQL role or you'll hit 28P01. Jwt:Key < 32 chars throws IDX10720. See FAQ and Troubleshooting.

3. Create the database

You don't create tables — or even the database — by hand. EF Core does it:

dotnet ef database update --project DocAnalytics.Data --startup-project DocAnalytics.Api

If docanalytics doesn't exist, EF runs CREATE DATABASE automatically, then builds all 12 tables. More in Database and Migrations.

Why two --project flags? --project DocAnalytics.Data holds the DbContext + migrations; --startup-project DocAnalytics.Api holds the connection string + DI. Omitting the startup project causes Unable to resolve service for type 'DbContextOptions<AppDbContext>'.

4. Run

# Option 1 — auto-opens Swagger + hot-reloads (best for dev)
dotnet watch run --project DocAnalytics.Api

# Option 2 — plain run; copy the printed URL into a browser yourself
dotnet run --project DocAnalytics.Api

For Option 2, note the port (e.g. Now listening on: http://localhost:5256) and open http://localhost:<port>/swagger.

First run also seeds the database. Keep this terminal open; use a second terminal for curl/git/dotnet ef. Ctrl + C stops the app.

5. Smoke test

See API Reference for the full Swagger walkthrough and seed credentials.

Clone this wiki locally