System Architecture

Serverless, scalable, and cost-optimized for a personal collection

Infrastructure Overview

graph TB subgraph Client["Client Layer"] Browser[Browser] end subgraph CDN["CDN Layer"] CF[CloudFront
Global Edge] end subgraph App["Application Layer"] APIGW[API Gateway] Lambda[Lambda
Python 3.x] end subgraph Data["Data Layer"] Aurora[(Aurora PostgreSQL
Serverless v2)] ElastiCache[(ElastiCache Redis
Serverless)] S3_Img[S3 Images] S3_Web[S3 Static Site] Secrets[Secrets Manager] end subgraph Auth["Auth Layer"] Cognito[Cognito
User Pool] end Browser -->|HTTPS| CF CF -->|Static| S3_Web CF -->|Images| S3_Img CF -->|API| APIGW APIGW -->|Invoke| Lambda Lambda -->|Query| Aurora Lambda -->|Cache| ElastiCache Lambda -->|Read/Write| S3_Img Lambda -->|Secrets| Secrets APIGW -->|Validate JWT| Cognito Browser -->|Authenticate| Cognito style CF fill:#9C27B0,color:#fff style Lambda fill:#FF9800,color:#fff style Aurora fill:#2196F3,color:#fff style ElastiCache fill:#DC382D,color:#fff style Cognito fill:#4CAF50,color:#fff

AI-Powered Valuation Flow (AWS Bedrock + Claude Opus/Sonnet/Haiku)

flowchart TB subgraph Input["Acquisition Input"] eBay[eBay Listing URL] Manual[Manual Entry] end subgraph Import["Data Import"] Parse[Parse Listing
Title, Price, Images] Archive[Wayback Archive
Snapshot Storage] end subgraph AI["AWS Bedrock AI Layer"] Bedrock[AWS Bedrock
Claude Sonnet 4] Napoleon[Napoleon Framework
Valuation Prompt] end subgraph Analysis["Valuation Output"] Condition[Condition Assessment
Binding, Pages, Foxing] Market[Market Analysis
Comparable Sales] FMV[Fair Market Value
Low/Mid/High Range] end subgraph Scoring["Investment Scoring"] Grade[Investment Grade
0-100 Score] Fit[Strategic Fit
0-7 Collection Match] end subgraph Storage["Data Layer"] DB[(Aurora PostgreSQL)] S3[S3 Images] end eBay --> Parse Manual --> Parse Parse --> Archive Parse --> Bedrock Napoleon --> Bedrock Bedrock --> Condition Bedrock --> Market Condition --> FMV Market --> FMV FMV --> Grade Grade --> Fit Fit --> DB Parse --> S3 Archive --> S3 style Bedrock fill:#FF9800,color:#fff style Napoleon fill:#8b5cf6,color:#fff style Grade fill:#10b981,color:#fff style Fit fill:#3b82f6,color:#fff style DB fill:#2196F3,color:#fff

Frontend

  • Vue 3 - Composition API
  • TypeScript - Type safety
  • Pinia - State management
  • Tailwind CSS - Utility-first styling
  • Vite - Build tooling
  • Container Queries - Component-level responsive

Backend

  • FastAPI - Async REST API
  • Python 3.x - Runtime
  • SQLAlchemy 2.0 - Async ORM
  • Pydantic v2 - Validation
  • Alembic - Migrations
  • SQS Async - Queue-based AI with retry
  • API Keys - CLI/automation access
  • Model Selection - Sonnet/Opus config

Infrastructure

  • AWS Lambda - Serverless compute
  • Aurora Serverless v2 - Auto-scaling DB
  • ElastiCache Redis - Dashboard caching
  • CloudFront - Global CDN
  • Cognito - Authentication
  • Terraform - Infrastructure as code

Security

  • SAST - Bandit + Semgrep
  • Dependency Scan - pip-audit
  • Secret Scan - Gitleaks
  • JWT Auth - Cognito tokens
  • TLS 1.3 - Encryption in transit

Performance Optimizations

Redis Caching

  • ElastiCache Serverless - Auto-scaling Redis
  • Dashboard Stats - Cached for instant loads
  • Reference Data - Authors, publishers, binders
  • Smart Invalidation - Updates on data changes

Cold Start UX

  • API Retry Logic - Automatic retry on timeout
  • Reference Pre-caching - Load entities on startup
  • Graceful Degradation - Show cached data first
  • Loading States - Skeleton UI during fetch

CI/CD Pipeline

Automated testing, security scanning, and deployment on every push

gh run view - Deploy Workflow
main Deploy · 19950842156 Triggered via push about 1 hour ago JOBS CI Checks / Backend Lint in 29s CI Checks / Backend Tests in 1m10s CI Checks / Backend Type Check in 36s CI Checks / SAST Security Scan in 1m24s CI Checks / Secret & Vulnerability Scan in 32s CI Checks / Frontend Build in 42s CI Checks / Frontend Lint in 28s CI Checks / Backend Validation in 24s CI Checks / Frontend Tests in 28s CI Checks / Dependency Security Scan in 38s CI Checks / Frontend Type Check in 31s CI Checks / CI Complete in 4s Build Frontend in 40s Build Lambda Package in 51s Deploy to Production in 55s Smoke Tests in 43s Create Release Tag in 6s ARTIFACTS gitleaks-results.sarif semgrep-report bandit-report frontend-dist lambda-package

Staging-First Deployment Strategy

flowchart LR subgraph Dev["Development"] Feature[Feature Branch] end subgraph PR1["PR to Staging"] CI1[CI Checks
12 parallel jobs] end subgraph Staging["Staging Environment"] Deploy1[Deploy to Staging] Test1[Smoke Tests] Validate[Manual Validation] end subgraph PR2["PR to Production"] CI2[CI Checks] end subgraph Prod["Production"] Deploy2[Deploy to Prod] Test2[Smoke Tests] Tag[Release Tag
v2025.12.10-abc123] end Feature -->|PR| CI1 CI1 -->|Merge| Deploy1 Deploy1 --> Test1 Test1 --> Validate Validate -->|PR main| CI2 CI2 -->|Merge| Deploy2 Deploy2 --> Test2 Test2 --> Tag style Feature fill:#4CAF50,color:#fff style CI1 fill:#3b82f6,color:#fff style Staging fill:#f59e0b,color:#000 style Prod fill:#9C27B0,color:#fff style Tag fill:#10b981,color:#fff

CI/CD Pipeline Detail

flowchart LR subgraph Trigger Push[Push to branch] end subgraph CI["CI Checks (Parallel)"] Lint[Lint
Ruff + ESLint] Test[Tests
pytest + vitest] Type[Type Check
mypy + vue-tsc] SAST[SAST
Bandit + Semgrep] Deps[Dependency Scan
pip-audit + npm] Secrets[Secret Scan
Trivy + Gitleaks] end subgraph Build Lambda[Lambda Package
Python 3.12] Vue[Frontend Dist
Vite build] end subgraph Deploy S3[S3 Sync] Fn[Update Lambda] CF[Invalidate CDN] end subgraph Verify Smoke[Smoke Tests] Tag[Release Tag] end Push --> Lint Push --> Test Push --> Type Push --> SAST Push --> Deps Push --> Secrets Lint --> Lambda Test --> Lambda Type --> Lambda SAST --> Lambda Deps --> Lambda Secrets --> Lambda Lint --> Vue Test --> Vue Type --> Vue Lambda --> Fn Vue --> S3 Fn --> CF S3 --> CF CF --> Smoke Smoke --> Tag style Push fill:#4CAF50,color:#fff style SAST fill:#f44336,color:#fff style Secrets fill:#f44336,color:#fff style Tag fill:#9C27B0,color:#fff
curl api.bluemoxon.com/api/v1/health/deep | jq
{
  "status": "healthy",
  "timestamp": "2026-01-02T15:30:00.000000+00:00",
  "version": "2026.01.02-9033e57",
  "environment": "production",
  "total_latency_ms": 145.2,
  "checks": {
    "database": {
      "status": "healthy",
      "latency_ms": 45.8,
      "book_count": 152
    },
    "s3": {
      "status": "healthy",
      "bucket": "bluemoxon-images",
      "latency_ms": 52.3,
      "has_objects": true
    },
    "cognito": {
      "status": "healthy",
      "latency_ms": 47.1
    }
  }
}

REST API

60+ endpoints for complete collection management

Books & Collection

Method Endpoint Description
GET /api/v1/books List all books with pagination and filtering
GET /api/v1/books/{id} Get complete book details with images and analysis
POST /api/v1/books Create a new book record
PUT /api/v1/books/{id} Update book metadata
PATCH /api/v1/books/{id}/status Update delivery status (IN_TRANSIT, ON_HAND)
POST /api/v1/books/{id}/images Upload book images to CDN
PUT /api/v1/books/{id}/analysis/raw Update markdown analysis document

Acquisitions & Scoring

Method Endpoint Description
GET /api/v1/acquisitions List acquisitions with status filter (watchlist, in_transit, on_hand)
POST /api/v1/acquisitions Create new acquisition with automatic scoring
POST /api/v1/acquisitions/parse-order Parse eBay order text to extract listing details
PATCH /api/v1/acquisitions/{id} Update acquisition status or details
POST /api/v1/acquisitions/{id}/convert Convert acquisition to collection book entry
POST /api/v1/acquisitions/{id}/archive Save listing to Wayback Machine

AI Valuations (AWS Bedrock)

Method Endpoint Description
POST /api/v1/books/{id}/valuation Generate AI valuation using Napoleon Framework (Claude Sonnet 4)
POST /api/v1/acquisitions/{id}/score Calculate Investment Grade and Strategic Fit scores

Health & Export

Method Endpoint Description
GET /api/v1/export/csv Export collection as CSV
GET /api/v1/health/deep Deep health check with all dependencies
GET /api/v1/health/version Get deployed version and build info
View API Docs (Swagger)