An open API service indexing awesome lists of open source software.

https://github.com/daniel0707/blog-pipeline

Deployment and AI enhancement pipeline for my personal blog
https://github.com/daniel0707/blog-pipeline

Last synced: 7 days ago
JSON representation

Deployment and AI enhancement pipeline for my personal blog

Awesome Lists containing this project

README

          

# Blog Publishing Pipeline

AI-powered blog publishing pipeline that integrates Webiny CMS with Cloudflare Pages via AWS Step Functions.

**Transform your blog posts automatically**: AI-generated summaries, stunning hero images, and instant deployment — all in ~2-3 minutes.

## 🚀 Quick Start

**Get running in 15 minutes**: [docs/QUICKSTART.md](docs/QUICKSTART.md)

```bash
npm install
cp config/env.example.json config/env.dev.json
# Edit config with your values
npm run deploy:dev
./scripts/update-secrets.sh dev "WEBINY_TOKEN" "GITHUB_PAT"
```

That's it! Your pipeline is live.

## Architecture

This project implements an automated content enhancement pipeline:

1. **Webiny CMS** - Content is published
2. **AWS Step Functions** - Orchestrates AI processing workflow
3. **AWS Bedrock** - Generate summaries (Claude) and hero images (Titan)
4. **GitHub Actions** - Build and deploy static site
5. **Cloudflare Pages** - Host the final blog

**Cost**: ~$0.01 per blog post • ~$1-2/month total

## Project Structure

```
├── bin/ # CDK app entry point
├── lib/ # CDK stack definitions
│ ├── stacks/ # Individual CDK stacks
│ └── constructs/ # Reusable CDK constructs
├── lambda/ # Lambda function code
│ ├── summarize/ # AI summarization (Bedrock)
│ ├── generate-image-prompt/ # Image prompt creation
│ ├── generate-image/ # Image generation (Bedrock Titan)
│ ├── upload-to-webiny/ # File upload to Webiny
│ ├── update-cms/ # CMS entry update
│ └── trigger-github/ # GitHub Actions trigger
├── docs/ # Documentation
└── config/ # Configuration files
```

## Prerequisites

- AWS CLI configured with appropriate credentials
- Node.js 20.x or later
- AWS CDK CLI installed (`npm install -g aws-cdk`)
- Webiny CMS deployed on AWS
- GitHub repository set up (`daniel0707/blog-front`)
- AWS Bedrock access enabled (Claude/Llama and Titan models)

## Installation

```bash
npm install
```

## Configuration

Create environment-specific configuration files:

```bash
cp config/env.example.json config/env.dev.json
cp config/env.example.json config/env.prod.json
```

Edit the files with your environment-specific values (API endpoints, tokens, etc.).

## Deployment

### Bootstrap CDK (first time only)
```bash
cdk bootstrap aws://ACCOUNT-ID/REGION
```

### Development Environment
```bash
npm run deploy:dev
```

### Production Environment
```bash
npm run deploy:prod
```

## Stacks

- **BlogPipelineSecretsStack** - AWS Secrets Manager for API tokens
- **BlogPipelineLambdaStack** - Lambda functions for each pipeline step
- **BlogPipelineStateMachineStack** - Step Functions orchestration
- **BlogPipelineMonitoringStack** - CloudWatch alarms and dashboards

## Cost Estimation

- **LLM Summarization**: ~$0.00 (AWS credits)
- **Image Generation**: ~$0.01 per post (Bedrock Titan @ 1024×1024)
- **Lambda/Step Functions**: Minimal (within free tier for low volume)

**Estimated**: $0.30-1.00/month for 30-100 posts

## Pipeline Flow

1. Author publishes content in Webiny CMS
2. Webiny hook invokes Step Function
3. Step Function orchestrates:
- LLM summarization (Bedrock)
- Image prompt generation
- Image creation (Bedrock Titan)
- Upload to Webiny File Manager
- Update CMS entry with summary + image
- Trigger GitHub Actions
4. GitHub Actions builds and deploys to Cloudflare Pages

## 📚 Documentation

| Document | Description |
|----------|-------------|
| **[QUICKSTART.md](docs/QUICKSTART.md)** | 15-minute setup guide - start here! |
| **[PROJECT_OVERVIEW.md](PROJECT_OVERVIEW.md)** | Complete project structure and components |
| **[CDK_DEPLOYMENT.md](docs/CDK_DEPLOYMENT.md)** | Detailed deployment guide with troubleshooting |
| **[DEPLOYMENT.md](docs/DEPLOYMENT.md)** | Architecture, flow, and environment config |
| **[SETUP_CHECKLIST.md](docs/SETUP_CHECKLIST.md)** | Complete setup checklist for all services |
| **[WEBINY_HOOK.md](docs/WEBINY_HOOK.md)** | Webiny CMS integration code | code

## Development

```bash
# Watch for changes
npm run watch

# Show diff before deploying
npm run diff:dev
npm run diff:prod

# Synthesize CloudFormation templates
npm run synth

# Test deployment
./scripts/test-pipeline.sh dev
```

## What Happens When You Publish?

```
CMS Publish → Webiny Hook → Step Functions → AI Pipeline
├─ Summarize (8s)
├─ Generate Prompt (2s)
├─ Create Image (15s)
├─ Upload (5s)
├─ Update CMS (3s)
└─ Trigger GitHub (2s)

GitHub Actions → Build → Deploy → Cloudflare Pages
(1-2 minutes) ↓
✅ Live Blog!
```

**Total**: 2-3 minutes from publish to live

## Features

✅ **AI-Powered Summaries** - Bedrock Claude generates engaging 2-3 sentence summaries
✅ **Stunning Hero Images** - Bedrock Titan creates custom 1024×1024 images
✅ **Automated Deployment** - GitHub Actions builds and deploys automatically
✅ **Error Handling** - Retries, rollback, and email alerts
✅ **Cost Effective** - ~$0.01 per post, ~$1-2/month total
✅ **Monitoring** - CloudWatch dashboards and alarms
✅ **Type Safe** - Full TypeScript implementation
✅ **Infrastructure as Code** - AWS CDK for reproducible deployments

## Support

- 📖 [Full Documentation](docs/)
- 🔧 [Troubleshooting Guide](docs/CDK_DEPLOYMENT.md#troubleshooting)
- 📊 [Architecture Overview](PROJECT_OVERVIEW.md)
- ✅ [Setup Checklist](docs/SETUP_CHECKLIST.md)

## License

MIT