A production-ready, full-stack serverless blog application demonstrating modern cloud architecture with React frontend, AWS serverless backend, and Infrastructure as Code. Features complete portability, multi-environment support, and cost-optimized deployment.
π― Project Status: Production-ready with successful deployment verification, complete portability across AWS accounts, and comprehensive documentation for immediate use.
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β React App β β API Gateway β β Lambda Func β
β (TypeScript) βββββΊβ (REST API) βββββΊβ (Node.js) β
β + Tailwind β β + CORS β β + DynamoDB β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β CloudFront β β Route 53 β β DynamoDB β
β + S3 Static β β (Optional) β β Pay-per-req β
β + CDN β β Custom DNS β β + Auto-scale β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Full CRUD Operations - Create, read, update, delete blog posts
- Professional UI - Modern React interface with Tailwind CSS
- Responsive Design - Mobile-first, accessible interface
- Real-time Updates - Dynamic post creation and listing
- Error Handling - Comprehensive error states and user feedback
- Auto-scaling - Handles traffic spikes automatically
- Pay-per-use - No idle server costs
- Global CDN - CloudFront distribution for fast loading
- High Availability - Multi-AZ deployment with AWS managed services
- Infrastructure as Code - Complete AWS CDK implementation
- Multi-Environment - Deploy dev/staging/prod independently
- Zero Configuration - Dynamic API discovery, no hardcoded URLs
- One-Click Deployment - Automated deployment scripts
- Complete Portability - Works in any AWS account without modification
- Serverless Functions - Lambda pay-per-invocation
- DynamoDB On-Demand - Pay-per-request database
- S3 + CloudFront - Efficient static asset delivery
- No Fixed Costs - Scale to zero when unused
This project has been successfully deployed and tested with the following verified functionality:
# Successful API Testing Results
β
GET /blog - Successfully retrieves all blog posts
β
POST /blog - Successfully creates new blog posts
β
Frontend - Professional UI with Tailwind CSS styling
β
CORS - Proper cross-origin request handling
β
Multi-Environment - Tested dev environment deployment
β
Cost Management - Successful resource cleanup verificationLive Demo Results: Application successfully deployed to AWS with functional CRUD operations, professional UI, and proper error handling.
- React 18 with TypeScript and modern hooks
- Tailwind CSS 3 for utility-first styling
- Axios for HTTP client with dynamic configuration
- Responsive Design with mobile-first approach
- AWS CDK - Infrastructure as Code framework (TypeScript)
- AWS Lambda - Serverless API functions (Node.js 18.x)
- API Gateway - REST API with CORS support
- DynamoDB - NoSQL database with pay-per-request billing
- S3 - Static website hosting with CloudFront integration
- CloudFront - Global CDN for fast content delivery
- Environment-specific deployments (dev, staging, prod)
- Automated resource cleanup to prevent unexpected costs
- Portable deployment scripts for any AWS account
- Dynamic configuration injection during deployment
- Node.js 18+ and npm
- AWS CLI configured with appropriate permissions
- AWS CDK CLI:
npm install -g aws-cdk
git clone <repository-url>
cd blog-app-with-cicd
# Install all dependencies
npm install
cd frontend && npm install && cd ..
cd infrastructure && npm install && cd ..# Make deployment script executable
chmod +x scripts/deploy.sh
# Deploy to development environment
./scripts/deploy.sh --environment devAfter deployment, check the CDK outputs for your URLs:
- Frontend:
https://your-cloudfront-domain.cloudfront.net - API:
https://your-api-gateway.execute-api.region.amazonaws.com/prod/blog
blog-app-with-cicd/
βββ frontend/ # React application
β βββ src/
β β βββ api.ts # Dynamic API client
β β βββ App.tsx # Main app component
β β βββ index.css # Tailwind CSS imports
β βββ build/ # Built assets (created on build)
β βββ tailwind.config.js # Tailwind configuration
β βββ package.json # Frontend dependencies
βββ infrastructure/ # AWS CDK infrastructure
β βββ bin/
β β βββ blog-app.ts # CDK app entry point
β βββ lib/
β β βββ blog-app-stack.ts # Main stack definition
β βββ lambda/
β β βββ index.js # Lambda function code
β βββ package.json # Infrastructure dependencies
βββ scripts/
β βββ deploy.sh # Deployment automation script
βββ cdk.json # CDK configuration
βββ .gitignore # Comprehensive ignore file
βββ README.md # This documentation
# Deploy to development (default)
./scripts/deploy.sh
# Deploy to staging
./scripts/deploy.sh --environment staging
# Deploy to production
./scripts/deploy.sh --environment prod
# Skip frontend rebuild (if already built)
./scripts/deploy.sh --environment prod --skip-build# 1. Build frontend
cd frontend && NODE_OPTIONS="--max-old-space-size=4096" npm run build && cd ..
# 2. Deploy infrastructure
cdk deploy --context environment=dev
# 3. Get outputs
cdk output --context environment=dev# Deploy with custom domain (requires ACM certificate)
cdk deploy --context environment=prod \
--context domainName=yourblog.com \
--context certificateArn=arn:aws:acm:region:account:certificate/cert-idAll AWS resources are automatically named with environment-specific prefixes to prevent conflicts:
- Stack Name:
BlogAppStack-{environment} - DynamoDB Table:
{stackname}-posts-{environment} - S3 Bucket:
{stackname}-website-{account-id} - API Gateway:
{stackname}-api-{environment} - Lambda Function:
BlogLambda(with environment variables)
This ensures you can deploy multiple environments in the same AWS account without conflicts.
Once deployed, your API provides these endpoints:
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /blog |
List all blog posts | - |
| POST | /blog |
Create new blog post | {title, content, author?} |
| GET | /blog/{id} |
Get specific blog post | - |
| PUT | /blog/{id} |
Update blog post | {title, content, author?} |
| DELETE | /blog/{id} |
Delete blog post | - |
# List all posts
curl https://your-api.execute-api.region.amazonaws.com/prod/blog
# Create a new post
curl -X POST https://your-api.execute-api.region.amazonaws.com/prod/blog \
-H "Content-Type: application/json" \
-d '{"title": "Hello World", "content": "My first blog post!", "author": "John Doe"}'
# Get specific post
curl https://your-api.execute-api.region.amazonaws.com/prod/blog/{post-id}The application uses a sophisticated configuration system that eliminates hardcoded values:
- CDK generates
config.jsonduring deployment with actual API URLs - Frontend loads configuration dynamically from
/config.json - Fallback to environment variables if config.json unavailable
- Cached configuration for performance
{
"apiUrl": "https://actual-api-gateway-url.execute-api.region.amazonaws.com/prod",
"region": "us-east-1",
"environment": "dev"
}This ensures the application works in any AWS account without modifications.
- DynamoDB: Pay-per-request billing (no fixed costs)
- Lambda: Pay per invocation and execution time
- API Gateway: Pay per API call
- S3: Pay for storage and requests
- CloudFront: Pay for data transfer
- Serverless architecture - No idle server costs
- DynamoDB on-demand - Automatic scaling without provisioning
- Lambda timeout controls - Prevent runaway costs
- Automated cleanup scripts - Easy environment destruction
# Clean up specific environment
cdk destroy --context environment=dev
# Clean up all environments
cdk destroy --context environment=staging
cdk destroy --context environment=prod# Start frontend development server (requires deployed backend)
cd frontend && npm start
# The frontend will automatically use the deployed API endpoints# Build frontend
cd frontend && npm run build
# Test API endpoints directly
curl https://your-api-endpoint/blog
# Deploy and test
./scripts/deploy.sh --environment devYou can override default behavior with environment variables:
# Set custom API URL for frontend
export REACT_APP_API_URL=https://custom-api-url.com
# Set AWS region
export AWS_DEFAULT_REGION=eu-west-1
# Build with custom settings
cd frontend && npm run build# Solution: Increase Node.js memory
export NODE_OPTIONS="--max-old-space-size=4096"
cd frontend && npm run buildEnsure your AWS credentials have these permissions:
- CloudFormation (full access)
- S3 (full access)
- Lambda (full access)
- API Gateway (full access)
- DynamoDB (full access)
- IAM (role creation)
- CloudFront (distribution management)
- Verify API Gateway CORS configuration
- Check that OPTIONS method is properly configured
- Ensure Lambda returns appropriate CORS headers
# If resources already exist, use different environment
./scripts/deploy.sh --environment dev2
# Or clean up existing resources first
cdk destroy BlogAppStack # Old stack
./scripts/deploy.sh --environment dev # New stack# List all CDK stacks
cdk list
# View stack outputs
cdk output
# View CloudFormation template
cdk synth
# Check stack differences
cdk diff --context environment=dev- IAM Roles with least privilege access
- CORS Configuration to prevent unauthorized access
- S3 Bucket Policies restricting public access
- API Gateway Throttling to prevent abuse
- Environment Isolation through separate stacks
- Replace CORS
*with specific domain names - Implement API authentication (AWS Cognito)
- Add input validation and sanitization
- Enable AWS CloudTrail for audit logging
- Set up monitoring with CloudWatch alarms
- User Authentication - AWS Cognito integration
- Rich Text Editor - WYSIWYG post editing
- Image Upload - S3 integration for media
- Search Functionality - ElasticSearch integration
- Comments System - Additional DynamoDB tables
- Email Notifications - SES integration
- Analytics - CloudWatch custom metrics
# Deploy to new environment
./scripts/deploy.sh --environment test
# Deploy to production with custom domain
cdk deploy --context environment=prod \
--context domainName=myblog.com \
--context certificateArn=your-cert-arnThis project demonstrates modern development practices. To contribute:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Follow TypeScript best practices
- Maintain infrastructure as code principles
- Test all changes in development environment first
- Document any new configuration options
- Ensure portability across AWS accounts
MIT License - see LICENSE file for details.
- Issues: Create GitHub issues for bugs or feature requests
- Documentation: This README covers all deployment scenarios
- AWS Costs: Remember to destroy resources after testing
This project demonstrates production-ready serverless architecture with modern DevOps practices, complete portability, and cost-effective resource management.# Test commit for GitHub Actions