CloudPro

Project Documentation

Author: Will Soltani

What This Application Does

This repository contains a Next.js web application and AWS infrastructure for a secure document workflow:

The system is optimized for deterministic conversion behavior and explicit capability gating so the UI only offers conversions that the backend can execute.

Architecture Summary

Core User Flows

  1. Upload -> Convert -> Download
    • User uploads one or more files to a project.
    • API creates upload intent and presigned PUT URL.
    • Upload completion writes kind=raw file metadata to DynamoDB.
    • Conversion request writes kind=output rows (status=processing) and starts Step Functions.
    • Worker converts and writes final output file(s) to S3, then updates metadata to status=done.
    • UI reads /files and downloads with short-lived signed URLs.
  2. Fill PDF -> Download -> Persist as Filled Artifact
    • User opens /app/projects/[projectId]/fill/[fileId].
    • PDF is loaded client-side (PDF.js) and edited (pdf-lib).
    • On save/download, frontend validates PDF bytes and downloads immediately.
    • Same bytes are uploaded to output storage and registered as artifactType=filled_pdf.
  3. Reconvert Existing Output
    • User picks a converted artifact and applies new target settings.
    • API submits a new conversion job against the original source reference (sourceFileId).
    • New output artifact is tracked independently; no cascade deletion is intended.

Supported Formats

Authoritative conversion capabilities are centralized in app/app/_lib/conversion-support.ts.

Supported input labels:

Supported output labels:

Additional accepted upload extensions include DOC (mapped to DOCX-class document handling in source label logic).

How Validation Works (High Level)

Local Development

Prerequisites:

Commands:

npm install
npm run dev
npm run test:pdf-fill
npm run lint

Infra commands:

npm --prefix infra install
npm --prefix infra run build
npm --prefix infra run cdk -- synth

Deployment (High Level)

  1. Build and synth infra (infra/).
  2. Deploy CDK stack that provisions DynamoDB, S3, KMS, Lambda (container), and Step Functions.
  3. Deploy Next.js app with required env vars (Cognito, AWS resources, table/bucket names, state machine ARN).
  4. Validate end-to-end upload/convert/fill/download flows.

Documentation Map