- TypeScript 73%
- CSS 16%
- Astro 10%
- JavaScript <1%
Praise Cage #
Praise Cage is a low-cost, fully serverless Nicolas Cage news aggregator. A daily AWS pipeline discovers recent coverage with Brave News Search and Brave Video Search, validates and categorizes the metadata with Amazon Bedrock, stores accepted stories in DynamoDB, and publishes static JSON for a small Astro site served by CloudFront.
Architecture #
EventBridge (06:00 UTC) → Discovery Lambda → SQS (+ DLQ)
↓
Enrichment Lambda → Articles DynamoDB
↓ ↓
Rejected URL tombstones ↓
(30-day TTL) ↓
EventBridge (08:00 UTC) → Publisher Lambda → S3 JSON + daily report
↓
CloudFront → Astro site
The two-hour publishing delay keeps the MVP simple and inexpensive while leaving enough time for normal queue processing. SQS invokes enrichment with a batch size of one, so a malformed or transiently failing article retries independently and reaches the DLQ after three receives. Rejected URLs are recorded in a separate DynamoDB table with a 30-day TTL so recurring low-quality results do not repeatedly invoke Bedrock. The frontend reads only S3 JSON through CloudFront; it has no AWS credentials and never accesses DynamoDB.
Prerequisites #
- Node.js 22 or newer and pnpm 10
- An AWS account and AWS CLI credentials with permission to deploy CDK stacks
- AWS CDK bootstrapped in the target account/region
- A Brave Search API key
- Amazon Bedrock model access for Nova Lite in the target region
CDK and Bedrock availability are region-specific. us-east-1 is the default.
Verify Bedrock access #
You do not need to create or deploy a Bedrock model. Nova Lite is an AWS-managed foundation model that Praise Cage invokes on demand and pays for per usage.
Before the first deployment, verify access in the AWS console:
-
Open the Amazon Bedrock console and set the region in the upper-right corner to US East (N. Virginia) —
us-east-1. -
Open Playgrounds → Chat / Text.
-
Choose Select model, then select Amazon → Nova Lite and apply the selection.
-
Send a small test prompt, such as:
Return JSON containing {"working": true} -
If the model responds, Bedrock is ready for Praise Cage.
If Nova Lite is unavailable, open Bedrock configurations → Model access and enable or request access to Nova Lite. Model access is regional, so enable it in the same region where the CDK stack will run.
The application uses the on-demand Bedrock Converse API with the model ID
amazon.nova-lite-v1:0. You may override that ID with BEDROCK_MODEL_ID. This
MVP does not require a Bedrock knowledge base, agent, guardrail, custom model,
provisioned-throughput resource, or inference endpoint.
Deploy #
-
Configure AWS credentials and choose a region:
aws configure export AWS_REGION=us-east-1 -
Bootstrap CDK once per AWS account and region:
pnpm dlx aws-cdk bootstrap aws://YOUR_ACCOUNT_ID/us-east-1 -
Install dependencies and set deployment variables:
pnpm install cp .env.example .env set -a source .env set +aBRAVE_API_KEYis required. CDK creates a Secrets Manager secret containing it and grants only the discovery Lambda read access. Because the value enters CloudFormation during deployment, protect local shell history and restrict access to stack templates. For stricter production secret handling, create the secret out-of-band and import its ARN instead. -
Deploy everything:
pnpm cdk deployThe command builds Astro first, bundles all TypeScript Lambda handlers with esbuild, and deploys the stack. Confirm the security changes when CDK prompts. The outputs include
CloudFrontUrl,BucketName,TableName, andRejectionTableName. -
Visit
CloudFrontUrl. The site initially shows an empty feed. The pipeline runs automatically at 06:00 and 08:00 UTC every day.
Run immediately #
To avoid waiting for the schedules, invoke functions in order from the Lambda console:
- Invoke the function whose name contains
DiscoverFunctionwith{}. - Wait until the
ArticleQueuehas zero visible and in-flight messages. - Invoke the function whose name contains
PublishFunctionwith{}. - Wait a few minutes for CloudFront's five-minute JSON cache, then refresh the site.
CloudWatch Logs for each function are the first place to inspect failures. Messages that fail enrichment three times are retained in ArticleDLQ for 14 days.
Remove a bad article #
The operator CLI resolves the deployed table and Publisher Lambda from
CloudFormation. It is a dry run unless --apply is provided, and a successful
deletion automatically republishes the static feed.
Preview an exact URL removal:
pnpm articles:remove --url 'https://example.com/unwanted-article'
Remove it after reviewing the preview:
pnpm articles:remove --url 'https://example.com/unwanted-article' --apply
You may instead select one record by --id, or every record from a host with
--domain example.com. Domain removal is intentionally bulk and should always
be previewed before adding --apply. Use --region or --stack when operating
outside the default us-east-1 / PraiseCageStack deployment.
Development #
pnpm check # strict TypeScript and Astro diagnostics
pnpm build # compile every workspace
pnpm lint # ESLint
pnpm --filter @praise-cage/web dev
Configuration is validated at Lambda startup. The shared schemas and fixed category list live in packages/shared. Search-provider-specific behavior lives only in the Brave adapter in functions/discover.
Discovery sources #
Discovery uses Brave's dedicated vertical indexes rather than general Web Search:
- News Search finds recent editorial coverage across targeted Nicolas Cage, movie, casting, trailer, interview, and review queries.
- Video Search finds interviews, news clips, and reviews across video platforms.
Both sources request English-language US results from the previous 24 hours with strict safe search. Video results must mention Nicolas Cage and match the intent of their query lane. Full-film uploads, free-movie spam, obviously non-English titles, and unrelated results are rejected before enrichment. Because Brave's language setting is a preference rather than a guarantee, enrichment also classifies the supplied title and description and rejects metadata that is primarily non-English. Results are de-duplicated by URL before they enter SQS; DynamoDB remains the authoritative duplicate guard across runs.
The 24-hour window and rejection tombstones were added after operations showed a dramatic spike in daily message processing. The previous seven-day rolling window repeatedly rediscovered rejected URLs: accepted articles were de-duplicated by the articles table, but rejected results had no durable marker and could invoke Bedrock again every day. Enrichment now checks a separate rejection table before model invocation and records deterministic or model-based rejections for 30 days. DynamoDB removes expired tombstones automatically, allowing old URLs to be reconsidered later.
Data contract #
The publisher writes:
/data/latest.json— newest 100 accepted stories/data/categories/{CATEGORY}.json— every story in a fixed category/data/daily/YYYY-MM-DD.json— the current Daily Cage Report/data/manifest.json— pointers to the newest generated assets
Daily reports and summaries use only Brave-provided titles, descriptions, publisher or creator names, and dates. The application does not scrape article or video pages.
The rejection table contains only normalized URL identifiers, URLs, rejection reasons, rejection timestamps, and TTL expiration timestamps. It is operational cache data rather than published content and is configured for deletion with the stack; the articles table remains retained.
Cost and teardown #
SQS, Lambda, DynamoDB on-demand, S3, and CloudFront have usage-based pricing and should be near free at this traffic level. Bedrock, Brave Search, Secrets Manager, and CloudFront requests can still incur charges. The articles table and S3 bucket use RETAIN removal policies to prevent accidental data loss; the TTL-backed rejection table is disposable and is deleted with the stack.
English-language classification is part of the existing Bedrock enrichment request rather than a separate model invocation. It adds a small amount of prompt text and one boolean response field, so each newly evaluated result uses slightly more tokens while the number of model calls remains unchanged. Rejected non-English URLs receive the same 30-day tombstone as other rejected results, avoiding repeated enrichment charges for the same URL during that period.
To remove compute resources:
pnpm --filter @praise-cage/cdk exec cdk destroy
Afterward, manually delete the retained DynamoDB table and S3 bucket if the data is no longer needed.