← Back to projects

Personal project

Twin — AI digital twin on AWS

A personal AI chat prototype that answers from profile context and conversation history, with a FastAPI backend and Terraform-defined AWS infrastructure.

Prototype

Personal prototype. The repository includes application code and deployment configuration; a currently running demo is not linked.

System architecture

Twin: application and AWS deployment architectureComponent and data flow map · based on repository code

On smaller screens, scroll the diagram horizontally or read the text version below.

Twin: application and AWS deployment architectureA browser loads the Next.js interface through CloudFront and S3. Chat requests reach API Gateway and a Lambda-hosted FastAPI app through Mangum. The backend combines profile context and session history, calls Bedrock, stores the conversation, and returns the reply. A separate GitHub Actions workflow packages and provisions the AWS resources with Terraform.Application and data flowDeployment configurationopen chatsite assetsmessage + session_idinvoke handlerprofile inputsession historyrequest / replyresponse payloadpackageapply + uploadVisitor / browserProfessional profile questionsMessage + session identifierNext.js chat interfaceStatic frontendDisplays conversation repliesCloudFront + S3CDN + static frontend bucketServes exported site assetsAPI GatewayHTTP API · POST /chatForwards requests to LambdaLambda + FastAPIMangum adapter · chat handlerLoad history · build promptProfile contextFacts · summary · style notesLinkedIn document contentConversation memoryS3 in AWS / local JSON filesLoad history · save new turnsAmazon BedrockConverse APIPrompt + recent 50 messagesChat responseGenerated reply + session_idReturned to the chat interfaceGitHub ActionsOIDC AWS credentialsRuns deployment scriptBuild + packagePython Lambda ZIPNext.js static exportTerraform + deploymentLambda · API · S3 · CloudFrontProvision resources · upload

Solid arrows: application and data flow. Dashed arrows: feedback or deployment configuration.

Read components and connections as text

A browser loads the Next.js interface through CloudFront and S3. Chat requests reach API Gateway and a Lambda-hosted FastAPI app through Mangum. The backend combines profile context and session history, calls Bedrock, stores the conversation, and returns the reply. A separate GitHub Actions workflow packages and provisions the AWS resources with Terraform.

  • Visitor / browser: Professional profile questions. Message + session identifier.
  • Next.js chat interface: Static frontend. Displays conversation replies.
  • CloudFront + S3: CDN + static frontend bucket. Serves exported site assets.
  • API Gateway: HTTP API · POST /chat. Forwards requests to Lambda.
  • Lambda + FastAPI: Mangum adapter · chat handler. Load history · build prompt.
  • Profile context: Facts · summary · style notes. LinkedIn document content.
  • Conversation memory: S3 in AWS / local JSON files. Load history · save new turns.
  • Amazon Bedrock: Converse API. Prompt + recent 50 messages.
  • Chat response: Generated reply + session_id. Returned to the chat interface.
  • GitHub Actions: OIDC AWS credentials. Runs deployment script.
  • Build + package: Python Lambda ZIP. Next.js static export.
  • Terraform + deployment: Lambda · API · S3 · CloudFront. Provision resources · upload.
  • Visitor / browser → Next.js chat interface: open chat.
  • CloudFront + S3 → Next.js chat interface: site assets.
  • Next.js chat interface → API Gateway: message + session_id.
  • API Gateway → Lambda + FastAPI: invoke handler.
  • Profile context → Lambda + FastAPI: profile input.
  • Lambda + FastAPI ↔ Conversation memory: session history.
  • Lambda + FastAPI ↔ Amazon Bedrock: request / reply.
  • Lambda + FastAPI → Chat response: response payload.
  • Chat response → Next.js chat interface: HTTP response.
  • GitHub Actions → Build + package: package.
  • Build + package → Terraform + deployment: apply + upload.

Purpose

Explore how an AI assistant can answer questions about my professional background using supplied profile information. This personal project brings a conversational interface, a Python API, and AWS deployment configuration together.

Architecture

A Next.js chat interface calls a FastAPI backend. The backend builds a prompt from profile facts, summary notes, communication style, and LinkedIn content, then calls Amazon Bedrock with recent conversation history. Conversations can be stored in local JSON files or S3. Terraform defines Lambda, API Gateway, S3, and CloudFront resources, with GitHub Actions deployment workflows in the repository.

Engineering decisions

Profile information is supplied directly in the prompt rather than retrieved from a vector database. A session identifier connects each exchange to stored conversation history, and the model input is limited to the most recent 50 messages. Local storage supports development while the S3 option supports the AWS deployment path.

Status and limitations

This is a prototype, separate from my employer work. Source code shows the application and infrastructure design; it does not establish current deployment health, answer accuracy, or production usage. Session access controls, narrower IAM permissions, and a repeatable answer-quality evaluation are areas for further work.

View source