diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 10838fd..8a97884 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -43,7 +43,9 @@ "Bash(vips pdfload:*)", "Bash(convert:*)", "Bash(SKIP_COVERAGE_MINIMUMS=true AWS_REGION=us-east-1 bundle exec rspec:*)", - "Bash(env SKIP_COVERAGE_MINIMUMS=true AWS_REGION=us-east-1 bundle exec rspec:*)" + "Bash(env SKIP_COVERAGE_MINIMUMS=true AWS_REGION=us-east-1 bundle exec rspec:*)", + "Skill(simplecov)", + "Bash(then grep -A 5 \"covered_percent\\|app.rb\\|request_validator\\|response_builder\\|s3_url_parser\\|url_validator\\|webhook_notifier\" coverage/index.html)" ], "deny": [], "ask": [] diff --git a/CLAUDE.md b/CLAUDE.md index b098aa9..4bda281 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -PDF Converter Service - A serverless PDF to image conversion service built with AWS SAM. This application provides secure, asynchronous PDF processing with JWT authentication and webhook notifications. It uses containerized Ruby Lambda functions for scalable document processing. +PDF Converter Service - A serverless PDF to image conversion service built with AWS SAM. This application provides secure, synchronous PDF processing with JWT authentication and optional webhook notifications. It uses containerized Ruby Lambda functions for scalable document processing. ## Development Commands @@ -109,8 +109,20 @@ Converts a PDF to images. ```json { - "message": "PDF conversion request received", + "message": "PDF conversion and upload completed", + "images": [ + "https://s3.amazonaws.com/bucket/output/client-123-0.png?...", + "https://s3.amazonaws.com/bucket/output/client-123-1.png?..." + ], "unique_id": "client-123", - "status": "accepted" + "status": "completed", + "pages_converted": 2, + "metadata": { + "pdf_page_count": 2, + "conversion_dpi": 300, + "image_format": "png" + } } ``` + +**Note:** The service processes PDFs synchronously and returns the converted images in the response. If a webhook URL is provided, a notification is also sent asynchronously (fire-and-forget) upon completion. diff --git a/README.md b/README.md index 9fa2f51..e68d18d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## 🚧 Under Construction -A serverless PDF to image conversion service built with AWS SAM. This application provides secure, asynchronous PDF processing with JWT authentication and webhook notifications using containerized Ruby Lambda functions. +A serverless PDF to image conversion service built with AWS SAM. This application provides secure, synchronous PDF processing with JWT authentication and optional webhook notifications using containerized Ruby Lambda functions. ## Project Structure @@ -105,12 +105,24 @@ Converts a PDF to images. ```json { - "message": "PDF conversion request received", + "message": "PDF conversion and upload completed", + "images": [ + "https://s3.amazonaws.com/bucket/output/client-123-0.png?...", + "https://s3.amazonaws.com/bucket/output/client-123-1.png?..." + ], "unique_id": "client-123", - "status": "accepted" + "status": "completed", + "pages_converted": 2, + "metadata": { + "pdf_page_count": 2, + "conversion_dpi": 300, + "image_format": "png" + } } ``` +**Note:** The service processes PDFs synchronously and returns the converted images in the response. If a webhook URL is provided, a notification is also sent asynchronously (fire-and-forget) upon completion. + ## Architecture The application follows AWS SAM patterns with containerized Ruby Lambda functions: @@ -124,8 +136,12 @@ The application follows AWS SAM patterns with containerized Ruby Lambda function The Lambda function uses these environment variables: -- `AWS_REGION`: AWS region for Secrets Manager (defaults to us-east-1) - `JWT_SECRET_NAME`: Name of the secret in AWS Secrets Manager (defaults to pdf-converter/jwt-secret) +- `CONVERSION_DPI`: DPI resolution for PDF to image conversion (default: 300) +- `PNG_COMPRESSION`: PNG compression level 0-9 (default: 6) +- `MAX_PAGES`: Maximum number of pages allowed per PDF (default: 500) +- `VIPS_WARNING`: Controls libvips warning output (default: 0) +- `AWS_REGION`: AWS region for Secrets Manager (set by Lambda runtime, typically us-east-1) ## Dependencies @@ -142,7 +158,12 @@ The Lambda function uses these environment variables: - **rspec (~> 3.12)**: Testing framework - **webmock (~> 3.19)**: HTTP request stubbing for tests - **aws-sdk-s3 (~> 1)**: AWS S3 SDK for integration tests +- **simplecov (~> 0.22)**: Code coverage analysis + +### Development + - **rubocop (~> 1.81)**: Ruby code linter and formatter +- **rubycritic (~> 4.9)**: Code quality analysis tool ## Resources