Proposal Management System - AI-powered proposal generation and management
Find a file
Adam Moussa ceefae2850
Implement Phases 2-5: Frontend, AI/RAG, PDF Generation (#22)
* Fix NuGet versions and add InitialCreate EF Core migration

- Update AWSSDK.SQS and AWSSDK.SecretsManager to 3.7.500.0 (actual available versions)
- Update AWSSDK.Extensions.NETCore.Setup to 3.7.400
- Generate InitialCreate migration for PostgreSQL (all 8 entities)
- Build verified: 0 errors, 0 warnings

* Implement Dispatcher Frontend (Phase 2)

React 19 + MUI v7 + TypeScript + Vite SPA matching SHOC patterns:
Redux Toolkit (auth/ui slices), TanStack React Query, axios interceptors,
react-toastify, Cognito OAuth PKCE login flow, paginated proposal list,
new proposal form with customer autocomplete and vendor PDF upload,
read-only proposal detail with status stepper timeline.

* Add AuthController for Cognito code exchange and .env.example

Backend endpoint POST /api/auth/callback exchanges the OAuth
authorization code with Cognito's token endpoint, auto-provisions
the user in the DB, and returns the access token to the frontend.

* Implement Admin Frontend Experience (Phase 3)

Three-panel admin workspace: left reference panel (submission details,
vendor data), center editor (refined scope, inline line item table with
reorder/add/remove/pricing), right similar proposals panel (KB results
with pull-to-editor). Admin dashboard with stats cards and proposal
queue table. Approval flow with confirmation dialog, mark-as-sent,
and create-revision actions. Role-based sidebar navigation.

* Implement backend dev mode, internal API auth, and service layer enhancements

- Add dev-login endpoint with local JWT signing for local development
- Add InternalApiKeyMiddleware with timing-safe comparison for Lambda-to-API auth
- Add DevS3Service and NoOpJobPublisher for running without AWS services
- Implement CurrentUserService cascading user resolution (ID → sub → email → create)
- Add async ResolveAsync() to avoid synchronous DB calls in request pipeline
- Add /proposals/stats endpoint for efficient server-side status counts
- Guard status transitions: only allow Draft → InReview via update endpoint
- Add vendor proposals, generated PDFs, and similar proposals controllers
- Add ISimilarProposalService and SimilarProposalService
- Add [Authorize] to AddSimilarReference endpoint

* Implement Lambda functions for PDF processing, suggestions, and library ingest

- pdf-extract: Parse vendor PDFs with pdfplumber, fallback to Claude multimodal
- pdf-generate: Generate branded proposal PDFs with reportlab Platypus
- library-ingest: Format approved proposals as markdown and sync to Bedrock KB
- suggestions: Query KB for similar proposals, generate line items via Claude
- All Lambdas use internal API key auth and cold-start secret caching
- Fix pdf_path unbound variable in pdf-extract error handling

* Add Bedrock Knowledge Base, OpenSearch Serverless, and SQS message filtering

- Provision OpenSearch Serverless collection for vector search
- Create Bedrock Knowledge Base with Titan embedding model
- Configure S3 data source with fixed-size chunking (512 tokens, 20% overlap)
- Add suggestions Lambda with SQS event source filtering
- Scope bedrock:InvokeModel IAM to specific model ARN patterns
- Add internal API key secret in Secrets Manager
- Add log retention (2 months) to all Lambda functions
- Add docker-compose.yml for local PostgreSQL

* Apply SHOC design system styling across frontend

- Rewrite theme with SHOC palette (#0c4f6f primary, Nunito font, 4px radius)
- Add global CSS with Google Fonts import for Nunito
- Redesign Topbar with avatar initials, role subtitle, gradient header
- Redesign Sidebar with 220px width, section headers, active state border
- Restyle LoginPage with SHOC branded card and dev-mode role selector
- Update AdminDashboard KPI cards to centered SHOC style
- Add devLogin API method for local development auth flow

* Fix frontend navigation bugs, differentiate Dashboard from Proposals list

- Fix double nav selection by adding isNavActive() with ALL_NAV_PATHS set
- Fix /admin/users routing to placeholder instead of redirect to /
- Fix ProposalDetailPage Back button navigating to / instead of /proposals
- Differentiate Dashboard (KPI cards + recent 5) from ProposalListPage (full paginated table)
- Dashboard now uses dedicated /proposals/stats endpoint for accurate counts
- Fix adminApi.getPdf dead code (axios rejects before status check)
- Wire up PDF generation button in AdminWorkspace
- Adjust layout: 220px drawer, 10px content padding, 64px toolbar height

* Add appsettings.Development.json to gitignore

Prevent dev-only signing keys and connection strings from being committed.

* Fix CI failures: unused Python imports and CDK synth asset path

CDK synth job needs the .NET API published first so the Lambda asset
path exists. Python lint had 3 unused imports in pdf-generate.

* Apply ruff formatting to all Lambda Python files
2026-05-17 13:06:23 -04:00
.github Implement Phases 2-5: Frontend, AI/RAG, PDF Generation (#22) 2026-05-17 13:06:23 -04:00
api Implement Phases 2-5: Frontend, AI/RAG, PDF Generation (#22) 2026-05-17 13:06:23 -04:00
infra Implement Phases 2-5: Frontend, AI/RAG, PDF Generation (#22) 2026-05-17 13:06:23 -04:00
lambdas Implement Phases 2-5: Frontend, AI/RAG, PDF Generation (#22) 2026-05-17 13:06:23 -04:00
mobile Initial scaffold: monorepo structure, CDK stacks, CI/CD, domain model 2026-05-16 18:40:46 -04:00
shared/api-contracts Initial scaffold: monorepo structure, CDK stacks, CI/CD, domain model 2026-05-16 18:40:46 -04:00
web Implement Phases 2-5: Frontend, AI/RAG, PDF Generation (#22) 2026-05-17 13:06:23 -04:00
.gitignore Implement Phases 2-5: Frontend, AI/RAG, PDF Generation (#22) 2026-05-17 13:06:23 -04:00
docker-compose.yml Implement Phases 2-5: Frontend, AI/RAG, PDF Generation (#22) 2026-05-17 13:06:23 -04:00
README.md Initial scaffold: monorepo structure, CDK stacks, CI/CD, domain model 2026-05-16 18:40:46 -04:00

Proposal Management System

AI-powered proposal generation and management system for Sea Haven Industries. Enables dispatchers to submit proposal requests, uses Bedrock RAG to auto-generate draft line items from historical data, and provides admins with a pricing/approval workspace with professional PDF output.

Architecture

Layer Technology
Backend API .NET 8 / ASP.NET Core on Lambda (Amazon.Lambda.AspNetCoreServer)
Database RDS PostgreSQL 15 + EF Core
Frontend Web React 19 + MUI v7 + TypeScript
Mobile React Native (iOS-first)
IaC CDK (TypeScript) - 3 stacks
AI/RAG Bedrock Knowledge Base + Claude (Bedrock Runtime)
PDF Processing Python 3.12 Lambdas
Auth Cognito User Pool + Google OAuth
Storage S3 (PDFs, attachments, library)
Notifications Slack Bot API

AWS Resources

  • Stack prefix: proposal-system-*
  • Account: 328440206208
  • Region: us-east-1
Resource Name
Lambda (.NET 8) proposal-system-api
API Gateway HTTP API proposal-system-gateway
RDS PostgreSQL proposal-system-db
S3 Buckets proposal-system-uploads, proposal-system-generated, proposal-system-library
Bedrock Knowledge Base proposal-system-kb
Lambda (Python) proposal-system-pdf-extract, proposal-system-pdf-generate, proposal-system-library-ingest
Cognito User Pool proposal-system-auth
CloudFront proposal-system-web
SQS Queue proposal-system-jobs + DLQ

Repository Structure

proposal-system/
├── infra/          # CDK app (TypeScript) - 3 stacks
├── api/            # .NET 8 Web API (Lambda-hosted)
├── web/            # React 19 + MUI frontend
├── mobile/         # React Native app (iOS)
├── lambdas/        # Python 3.12 processing functions
├── shared/         # Shared TypeScript types/contracts
└── .github/        # CI/CD workflows

Local Development

Prerequisites

  • .NET 8 SDK
  • Node.js 24
  • Python 3.12
  • AWS CDK CLI (npm install -g aws-cdk@2.253.1)

Backend API

cd api
dotnet restore
dotnet run --project src/ProposalSystem.Api

Web Frontend

cd web
npm install
npm run dev

Infrastructure

cd infra
npm install
npx cdk synth
npx cdk deploy --all

CI/CD

  • CI: Runs on pull requests to main (dotnet build/test, tsc, ruff, cdk synth)
  • Deploy: Runs on push to main (cdk deploy, frontend S3 sync, CloudFront invalidation)
  • OIDC Role: githubdeploy-proposal-system

Data Flow

  1. Dispatcher submits proposal request (web or mobile)
  2. API creates proposal record, publishes SQS message
  3. If vendor PDF attached: pdf-extract Lambda parses and structures data
  4. Suggestion engine queries Bedrock KB for similar proposals, generates line items via Claude
  5. Admin reviews/edits line items in workspace
  6. On approval: pdf-generate Lambda creates branded PDF
  7. On send: library-ingest Lambda adds to KB for future matching
  8. Slack notifications at key status transitions