System Overview

The Dissertation Editor Platform is a web application that allows PhD candidates to submit their dissertations for professional editing services. The system handles document upload, automated analysis, quote generation, CRM integration, and video consultations.

Architecture Diagram

graph TB
    Browser["Browser (Client)"]

    subgraph "AWS Amplify"
        NextJS["Next.js Frontend"]
    end

    subgraph "API Gateway"
        APIGW["REST API"]
    end

    subgraph "Lambda Functions"
        PresignedURL["getPresignedUrl"]
        SubmitIntake["submitIntake"]
        ProcessSubmission["processSubmission"]
        DocAnalyzer["documentAnalyzer"]
        QuoteCalc["quoteCalculator"]
        PipedriveFn["pipedriveClient"]
        GetSubmission["getSubmission"]
        TokenGen["tokenGenerator"]
        Webhook["webhookHandler"]
    end

    subgraph "Data & Storage"
        S3["S3 (dissertation-editor-uploads-dev)"]
        DynamoDB["DynamoDB (submissions-dev, config-dev)"]
    end

    subgraph "External Services"
        Pipedrive["Pipedrive CRM"]
        LiveKit["LiveKit Server (EC2)"]
    end

    Browser --> NextJS
    NextJS --> APIGW
    APIGW --> PresignedURL
    APIGW --> SubmitIntake
    APIGW --> GetSubmission
    APIGW --> TokenGen
    APIGW --> Webhook

    SubmitIntake -->|"async invoke"| ProcessSubmission
    ProcessSubmission --> DocAnalyzer
    ProcessSubmission --> QuoteCalc
    ProcessSubmission --> PipedriveFn

    PresignedURL --> S3
    DocAnalyzer --> S3
    SubmitIntake --> DynamoDB
    ProcessSubmission --> DynamoDB
    GetSubmission --> DynamoDB
    QuoteCalc --> DynamoDB

    PipedriveFn --> Pipedrive
    Webhook --> Pipedrive
    TokenGen --> LiveKit
    Browser -->|"WebSocket (WSS)"| LiveKit

Components

Frontend (Next.js on Amplify)

The user-facing web application built with Next.js App Router. Hosted on AWS Amplify with automatic deployments from the staging and main branches. Provides the submission form, quote display, and video consultation interface.

API Gateway

A REST API that routes HTTP requests to Lambda functions. Base URL: https://jwfqmc0638.execute-api.us-east-1.amazonaws.com. Handles CORS and request routing.

Lambda Functions

Function Purpose
getPresignedUrl Generates a pre-signed S3 URL for direct document upload from the browser
submitIntake Receives the intake form submission, stores it in DynamoDB, and triggers async processing
processSubmission Orchestrates the async pipeline: analyze document, calculate quote, create Pipedrive deal
documentAnalyzer Downloads the uploaded .docx from S3 and extracts word counts, structure, and metadata
quoteCalculator Reads the rate schedule from DynamoDB and computes a line-item quote based on document analysis
pipedriveClient Creates or updates deals in Pipedrive CRM with quote details and contact info
getSubmission Returns the current state of a submission (the frontend polls this for status updates)
tokenGenerator Issues LiveKit JWT tokens with room grants for video consultations
webhookHandler Receives Pipedrive webhook events for deal status changes

Data Stores

  • S3 (dissertation-editor-uploads-dev): Stores uploaded dissertation documents. Lifecycle policy transitions to Glacier after 90 days and deletes after 365 days.
  • DynamoDB submissions table (submissions-dev): Stores submission records including contact info, document analysis results, and generated quotes.
  • DynamoDB config table (config-dev): Stores the rate schedule and other system configuration.

External Integrations

  • Pipedrive CRM: Deals are created automatically when a quote is generated. Pipeline stages track the editing workflow from quote to document delivery.
  • LiveKit: Self-hosted video conferencing server running on EC2. Used for optional video consultations between editors and clients.

Request Flow Summary

  1. Client uploads a .docx file directly to S3 via a pre-signed URL.
  2. Client submits the intake form with contact info and the S3 key.
  3. The backend asynchronously analyzes the document, calculates a quote, and creates a Pipedrive deal.
  4. The frontend polls for status updates and displays the quote when ready.

For detailed sequence diagrams, see Data Flow.