shotparty is a self-hosted photo and video drop for events. Guests scan a QR code, pick photos and videos on their phone, and the files land at full quality in an S3 bucket in your own AWS account. Thereās no app, no guest account and no subscription. Itās serverless: CloudFront in front of a static page and a small API on API Gateway and Lambda, with a DynamoDB table, all defined in AWS SAM and deployed with one command. This blog post covers how it was built.
The project site gives the short tour. The GitHub repo has the quick start, the operations guide and a detailed āhow it worksā walkthrough of every subsystem.
Tech Stack
| Layer | Technology |
|---|---|
| Guest page | Vite + TypeScript, no runtime dependencies, mobile-first, light and dark |
| Hosting | CloudFront on the Free flat-rate plan (CDN, WAF, TLS), private S3 site bucket with OAC |
| API | API Gateway HTTP API, 5 Lambdas (Node 22, arm64, bundled with esbuild) |
| Uploads | S3 presigned POST, straight from the browser to the media bucket |
| Validation | EventBridge Object Created ā a Lambda that checks magic bytes |
| Data | DynamoDB single table (on-demand, TTL, PITR) |
| Secrets | SSM Parameter Store SecureStrings |
| Bot check | Cloudflare Turnstile, verified server-side |
| Monitoring | CloudWatch alarms and log metric filters, SNS email, AWS Budgets |
| Infrastructure | AWS SAM (CloudFormation), three stacks |
| Tooling | TypeScript CLI scripts and bash, npm run setup |
| Tests and CI | Vitest (445 unit tests), Playwright (12 end-to-end tests), GitHub Actions, CodeQL, Dependabot |
Architecture
Components
- Guest page at
/e/<token>. A static page from the site bucket. A CloudFront Function rewrites/e/*toindex.html. It uploads three files at a time with per-file progress, retries and a screen wake lock. - HTTP API at
/api/*on the same CloudFront distribution, throttled to 50 requests/second with a burst of 100 per route. - Lambdas:
event: returns the eventās name, text, accent color, open/closed status and Turnstile site key.session: verifies Turnstile, then the gate (kill switch, token, window, PIN), and issues a signed 12-hour session.presign: checks the session, reserves quota, and returns a presigned POST for one file.validate: checks each uploadās first bytes and moves it toaccepted/or deletes it.health: for monitoring.
- Media bucket: private, versioned and TLS-only, with CORS for the site only. Files are stored under
uploads/<event>/<guest>/<uuid>.<ext>and moved toaccepted/once theyāre validated. An optional lifecycle rule moves them to Glacier Instant Retrieval after N days. - DynamoDB single table: events, event ID reservations, sessions, quota counters, rejected uploads and duplicate claims.
- SSM: the Turnstile secret, the session HMAC key, the origin secret, the alert email and the
uploads_enabledkill switch. - Organizer tools:
event:create/event:update/event:closewith QR codes, a local gallery page of presigned links, an MD5-verified download, the kill switch, and load-test, abuse-test and recovery scripts.
Upload sequence
Abuse protection
The page is public and writes to your bucket, so itās protected in layers. The goal is to make scripted abuse impractical and to put a hard ceiling on the worst case.
| # | Layer | What it stops |
|---|---|---|
| 1 | WAF (3,000 requests / 5 min per IP plus AWS managed rules), API throttling, reserved Lambda concurrency | Floods. Also caps the API and Lambda bill |
| 2 | 128-bit event token in the QR URL, plus an optional PIN printed on the card | Scanners and crawlers that never saw the card |
| 3 | Cloudflare Turnstile, verified server-side before a session is issued | Headless scripts and simple bots |
| 4 | Signed 12-hour session, required on every presign | Reusing one human check across many bots |
| 5 | Quotas: 500 files / 10 GiB per session, 3,000 files/hour per IP, 20,000 files / 100 GiB per event | One guest or bot filling the bucket |
| 6 | Presigned POST policy: server-chosen key, exact type and byte size, 10-minute expiry | Oversized files, overwrites, arbitrary paths |
| 7 | Magic-byte validation after upload | Junk, executables and archives renamed as photos |
| 8 | Upload window and an SSM kill switch, checked on every request | Uploads after the event. Gives an instant off switch |
| 9 | CloudWatch alarms emailing through SNS, and an account budget | Surprises of any kind |
Worst case: S3 doesnāt charge for incoming data, so filling an eventās 100 GiB cap with junk costs about $2.30/month until itās deleted.
Supported files
JPEG, PNG, HEIC/HEIF, WebP, GIF, MP4, MOV, WebM and 3GP, plus camera RAW: DNG (including iPhone ProRAW), CR2, CR3, NEF, ARW, RAF, ORF and RW2. The default limit is 1 GiB per file, and the config can raise it to 5 GiB.
Deployment
Stacks
| Stack | Contains | Protection |
|---|---|---|
<prefix>-<stage>-data |
Media bucket, DynamoDB table | Termination protection, a stack policy denying replace and delete, Retain policies, S3 versioning, DynamoDB deletion protection and PITR |
<prefix>-<stage>-app |
Lambdas, HTTP API, CloudFront, site bucket, alarms | None needed. Safe to delete and recreate without losing data |
<prefix>-account |
The account budget, shared by the stages | None needed |
The data stack publishes its resource names to SSM, and the app stack reads them from there. CloudFormation exports arenāt used, because they lock both stacks against edits. Every deploy creates a change set first, and a guard refuses any change that would replace or remove the bucket or table, or replace the CloudFront distribution the printed QR codes point at.
Setup
- Log in:
aws sso login(or any AWS CLI credentials), and export a Cloudflare API token for prod. - Run setup:
npm run setupasks a few questions and savesshotparty.config.json. It then creates the secrets, deploys the data and app stacks, creates the Turnstile widget through Cloudflareās API, creates the first event with its QR code, and runs a health check. Re-running it resumes after a failure and changes nothing on a finished install. - By hand: confirm the alert email, print the QR code, and optionally subscribe the distribution to the CloudFront Free plan in the console (thereās no API for it), then run setup again to attach its WAF.
After the event
npm run downloadpulls every accepted file and verifies each oneās MD5 against S3.- The upload window closes on its own, or
scripts/uploads.sh prod offcloses it early. - Optionally, archive to Glacier Instant Retrieval, or tear down the app stack and keep the data.
Estimated Cost
For a typical event of ~100ā200 guests and 15ā25 GB.
| Item | Estimate |
|---|---|
| CloudFront Free plan (CDN, WAF, TLS, 5 GB S3 credit) | $0 |
| S3 Standard, ~25 GB | ~$0.46 / month |
| S3 requests | < $0.05 |
| API Gateway, Lambda, DynamoDB on-demand | pennies |
| Uploads in, and downloading everything once | $0 |
| CloudWatch alarms | ~$0.30 for one stage, ~$1.60 for dev + prod |
| Cloudflare Turnstile | $0 |
| Total | ~$1ā$2 / month while live. About $0.10/month archived, or $0 after download and delete |
Not used, on purpose: a custom domain, Secrets Manager, WAF CAPTCHA and Bot Control, and a standalone WAF web ACL.
Highlights
- Photo bytes never pass through Lambda. S3 enforces the exact key, type and size of every upload.
- The app stack can be deleted and recreated without risk to the photos. A stack policy and a change-set guard enforce that, and a drill proved it.
- Nine layers of abuse protection with a known worst-case cost.
- The real viewer IP is passed from CloudFront with a shared secret, so per-IP quotas work and the API canāt be reached around the WAF. Counters store an HMAC of the IP, never the IP itself.
- Quotas use single-item conditional updates with rollback instead of transactions. That change came from a load test that failed 32 uploads with
TransactionConflict. - One-command, re-runnable setup from one config file, including the Cloudflare Turnstile widget.
- Load-tested with simulated guests: 300 of 300 uploads, with the validator finishing 5 seconds after the last one.
- Every download is MD5-verified against S3.
Known Limitations
- Anyone with the QR code (and PIN) can upload. A leaked code means closing the event early or turning uploads off.
- Validation checks that a file is a real photo or video, not what it shows. Thereās no content moderation.
- Without a custom domain, the printed QR codes are tied to one CloudFront distribution, so the prod app stack canāt be recreated while an event is live.
- No mid-file resume. A dropped upload restarts from the beginning.
- The CloudFront Free plan has to be subscribed to and canceled in the console, and a distribution canāt be deleted while itās on the plan.
- Each stage reserves 205 concurrent Lambda executions, so new accounts need a quota increase before the first deploy.
- The WAF rate rule was verified by its configuration, not by a real flood.