An AI-powered web application builder running on AWS Bedrock AgentCore that generates, deploys, and iterates on Next.js apps. Built in ~300 lines of code, VibeCoder takes natural language prompts and turns them into live, deployed web applications with full version control.
VibeCoder is a fully-functioning AI coding agent that:
- Generates complete Next.js/React applications from natural language descriptions
- Builds them locally with npm in a containerized environment
- Deploys to AWS Amplify with live URLs (https://main.{app-id}.amplifyapp.com)
- Maintains full version control with source code preservation in S3
- Enables iterative editing: "add a dark mode toggle" โ new version deployed
- Supports rollback to any previous version
Total time: 60-120 seconds from prompt to live URL.
User Request โ BedrockAgentCore โ Strands Agent โ Tools โ AWS Services
โ
10 Custom Tools:
- Code Generation
- File Operations
- Deployment
- Version Control
| Layer | Technology | Purpose |
|---|---|---|
| Runtime | AWS Bedrock AgentCore | Serverless agent hosting, auto-scaling |
| Agent Framework | Strands | AI orchestration, tool selection |
| LLM | Claude/Bedrock Models | Code generation, decision making |
| Container | Python 3.11 + Node.js 20 | Hybrid runtime for agent + builds |
| Frontend | Next.js 14 + React 18 | Generated web applications |
| Storage | AWS S3 | Source code + built artifacts |
| Hosting | AWS Amplify | CDN, HTTPS, live URLs |
| Deployment | boto3 | AWS SDK for Python |
User: "Create a todo list app with dark mode"
โ
Agent: generate_nextjs_app("todo-app", "todo list with dark mode")
โ Creates ./workspace/todo-app/ with Next.js scaffold
โ
Agent: write_react_component("./workspace/todo-app/pages/index.js", <code>)
โ Writes main page with todo logic
โ
Agent: write_css_file("./workspace/todo-app/styles/Home.module.css", <css>)
โ Writes dark mode styles
โ
Agent: deploy_app_to_amplify("./workspace/todo-app", "todo-app", "todo list with dark mode")
โ
deploy_with_source.py executes:
1. Upload source โ s3://bucket/projects/{app_id}/source/v1/
2. npm install + npm build (locally in container)
3. Upload built files โ s3://bucket/projects/{app_id}/deployments/{timestamp}/
4. amplify_client.start_deployment(sourceUrl=s3://...)
5. Poll until deployment succeeds
6. Get URL: https://main.{app_id}.amplifyapp.com
7. Save metadata.json with version info
โ
Agent: "โ
Deployed v1 to https://main.xxx.amplifyapp.com"
User: "Add a search bar to my todo app"
โ
Agent: download_app_for_editing(app_id, "v1")
โ Downloads source from s3://bucket/projects/{app_id}/source/v1/
โ
Agent: write_react_component(<updated_code>)
โ Adds search bar component
โ
Agent: deploy_app_to_amplify(...)
โ Deploys as v2 to same URL
โ
Agent: "โ
Deployed v2 with search bar"
python3 rollback_amplify.py {app_id} main 1
โ Redeploys v1 from S3
โ Same URL now serves v1 contentCritical Design: AWS Amplify's S3 deployment doesn't run builds, so we store BOTH source and built files:
s3://vibecoder-amplify-deployments/
projects/
{app_id}/
source/ โ Editable source code
v1/
package.json
pages/index.js
styles/...
v2/
...
deployments/ โ Built static files
1734567890/ โ v1 timestamp
index.html
_next/static/...
1734568999/ โ v2 timestamp
...
metadata.json โ Version tracking
metadata.json structure:
{
"app_id": "d3dzp5v50oaoe2",
"app_name": "todo-app",
"versions": [
{
"version": "v1",
"timestamp": 1734567890,
"source_path": "s3://.../source/v1/",
"deployment_path": "s3://.../deployments/1734567890/",
"job_id": "1",
"prompt": "Create a todo list app",
"deployed_url": "https://main.d3dzp5v50oaoe2.amplifyapp.com"
}
]
}Why this matters:
- โ Source preservation: Can iterate on v1 to create v2
- โ Rollback capability: Can redeploy any previous version
- โ Prompt tracking: Knows what user asked for each version
- โ Build reproducibility: Source + timestamp = exact version
The agent has 10 tools at its disposal:
generate_nextjs_app- Creates Next.js project scaffold with package.json, next.config.js, pages/_app.jswrite_react_component- Writes React/JS files (pages, components, utilities)write_css_file- Writes CSS/styling files
deploy_app_to_amplify- Full deployment pipeline (returns live URL, app_id, version)list_app_versions- Shows deployment history with URLs and promptsdownload_app_for_editing- Retrieves source code from S3 for iteration
file_read- Read filesfile_write- Write fileseditor- Edit filesshell- Execute shell commands
AWS Bedrock AgentCore is Amazon's serverless platform for deploying AI agents. It handles:
- Serverless hosting - No infrastructure to manage
- Auto-scaling - Handles concurrent requests automatically
- Built-in observability - OpenTelemetry integration
- HTTP streaming - Real-time response streaming
- Direct code deploy - Push and go (no Docker required)
Before deploying, ensure you have:
- AWS Account with credentials configured
- Python 3.10+ installed
- AWS CLI configured (
aws configure) - Model Access - Anthropic Claude Sonnet 4.0 enabled in Amazon Bedrock console
- IAM Permissions - See IAM Requirements below
Step 1: Install the AgentCore Starter Toolkit
pip install bedrock-agentcore-starter-toolkitStep 2: Verify Agent Code Structure
Your agent must follow this pattern (already implemented in agent_streaming.py):
from bedrock_agentcore.runtime import BedrockAgentCoreApp
app = BedrockAgentCoreApp()
@app.entrypoint
async def agent_invocation(payload, context):
# Your agent logic here
yield response_chunks
if __name__ == "__main__":
app.run()Step 3: Configure the Agent
agentcore configure --entrypoint agent_streaming.py --region us-west-2 --non-interactiveThis creates .bedrock_agentcore.yaml with your deployment configuration.
Step 4: Deploy to AWS
agentcore launchThis command:
- Builds your container using AWS CodeBuild (no Docker required locally)
- Creates necessary AWS resources (ECR repository, IAM roles, etc.)
- Deploys your agent to Amazon Bedrock AgentCore Runtime
- Configures CloudWatch logging
Step 5: Test Your Deployed Agent
agentcore invoke '{"prompt": "Create a simple landing page"}'Step 6: Get Agent Details
agentcore status --verboseNote the Agent ARN - you'll need it for programmatic invocation.
The execution role associated with your AgentCore Runtime agent must have permissions for:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::vibecoder-amplify-deployments",
"arn:aws:s3:::vibecoder-amplify-deployments/*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:CreateBucket",
"s3:PutBucketPolicy"
],
"Resource": "arn:aws:s3:::vibecoder-amplify-deployments"
}
]
}{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"amplify:CreateApp",
"amplify:GetApp",
"amplify:ListApps",
"amplify:UpdateApp",
"amplify:CreateBranch",
"amplify:GetBranch",
"amplify:StartDeployment",
"amplify:GetJob",
"amplify:ListJobs"
],
"Resource": "*"
}
]
}{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": "arn:aws:bedrock:*::foundation-model/*"
}
]
}To attach these permissions:
- Go to AWS IAM Console
- Find the execution role created by AgentCore (format:
AmazonBedrockAgentCoreSDKRuntime-{region}-{hash}) - Attach a custom policy with the above permissions
- Or use AWS managed policies:
AmazonS3FullAccess,AWSAmplifyFullAccess(not recommended for production)
After running agentcore configure, your .bedrock_agentcore.yaml will look like:
default_agent: agent_streaming
agents:
agent_streaming:
name: agent_streaming
entrypoint: agent_streaming.py
deployment_type: direct_code_deploy
runtime_type: PYTHON_3_11
platform: linux/arm64
aws:
region: us-west-2
execution_role: arn:aws:iam::ACCOUNT_ID:role/AmazonBedrockAgentCoreSDKRuntime-us-west-2-HASH
network_mode: PUBLIC
observability:
enabled: trueThe Dockerfile creates a hybrid Python + Node.js environment:
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim
# Install Python dependencies
RUN uv pip install strands-agents strands-agents-tools bedrock-agentcore
# Install Node.js 20 for building Next.js apps
RUN apt-get update && curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get install -y nodejs
# Copy agent code
COPY . .
CMD ["opentelemetry-instrument", "python", "-m", "agent_streaming"]Why both runtimes?
- Python: Runs the AI agent and AWS API calls
- Node.js: Builds Next.js apps locally before deployment
After deployment, invoke your agent programmatically using boto3, agentcore CLI or build your own interface!!
| Step | Duration | Details |
|---|---|---|
| Code Generation | 5-15s | Agent writes files locally |
| Upload Source to S3 | 3-5s | ~6 files, small size |
| npm install | 20-40s | Download Next.js + dependencies |
| npm build | 10-20s | Compile Next.js app |
| npm export | 5-10s | Generate static HTML |
| Upload Built to S3 | 5-10s | ~12 files + assets |
| Amplify Deploy | 10-20s | CDN distribution |
| Total | 60-120s | End-to-end deployment |
The agent is autonomous - it decides:
- Which tools to call and in what order
- When to generate new code vs edit existing
- When to deploy vs just show code
- How to structure the Next.js app
Example decision tree:
User: "Create a landing page"
โ Agent: generate_nextjs_app + write_react_component + write_css_file
User: "Deploy it"
โ Agent: deploy_app_to_amplify
User: "Add a contact form"
โ Agent: download_app_for_editing + write_react_component + deploy_app_to_amplify
Unlike Cursor, v0, or Lovable, VibeCoder:
- โ No fancy UI - it's a conversational agent
- โ No real-time preview during generation
- โ No drag-and-drop components
- โ No built-in database/backend (static sites only)
- โ No SSR support (static export only)
But what it DOES have:
- โ Full source code ownership (stored in your S3)
- โ Complete version history with rollback
- โ No vendor lock-in (runs on your AWS account)
- โ Transparent deployment pipeline
- โ ~300 lines of code you can modify
- โ Runs on serverless infrastructure
vibecoderclone/
โโโ agent_streaming.py # Main agent with tools + streaming
โโโ deploy_with_source.py # Deployment engine with versioning
โโโ rollback_amplify.py # Rollback utility
โโโ Dockerfile # Container with Python + Node.js
โโโ requirements.txt # Python dependencies
โโโ .bedrock_agentcore.yaml # AgentCore configuration
โโโ README.md # This file
Main agent file with:
- BedrockAgentCore integration (
@app.entrypoint) - Strands Agent initialization with 10 tools
- Streaming response handler
- CLI mode for local testing
Deployment engine that:
- Manages S3 uploads (source + built files)
- Orchestrates npm builds
- Calls AWS Amplify APIs
- Tracks version metadata
- Supports rollback
Standalone CLI tool for:
- Listing deployment history
- Redeploying previous versions
- Safety confirmations
s3_client.upload_file(local, Bucket, Key) # Upload files
s3_client.download_file(Bucket, Key, local) # Download files
s3_client.get_object(Bucket, Key) # Read metadata
s3_client.put_object(Bucket, Key, Body) # Write metadataamplify_client.create_app(name, platform) # Create app
amplify_client.start_deployment(appId, branch, url) # Deploy
amplify_client.get_job(appId, branch, jobId) # Check status
amplify_client.list_jobs(appId, branch) # List deployments- Rapid Prototyping - Generate landing pages, portfolios, dashboards in minutes
- Client Demos - Create live demos from descriptions
- A/B Testing - Deploy multiple versions, compare performance
- Learning Tool - See how AI structures React apps
- Version Control - Maintain history of all iterations with prompts
- Static sites only - No server-side rendering (Next.js static export)
- No backend - Can't create APIs or databases (use external services)
- Build time - 60-120s deployment (not instant like some platforms)
- AWS only - Requires AWS account and credentials
- โ Next.js 14 (static export)
- โ React 18
- โ Vue, Svelte, Angular (not yet implemented)
- โ SSR/ISR (Amplify S3 limitation)
- Authentication - API keys for production use
- Multi-user - Support multiple apps per user
- Custom domains - Connect your own domains
- Environment variables - Per-app configuration
- Direct file editing - Edit specific files without full regeneration
- More frameworks - Vue, Svelte, Angular support
- Cleanup automation - Delete old S3 deployments after X days
- Web UI - Visual interface for the agent
# Docker Container
AWS_REGION=us-east-1
AWS_DEFAULT_REGION=us-east-1
DOCKER_CONTAINER=1
UV_SYSTEM_PYTHON=1
PYTHONUNBUFFERED=1
# Agent (optional)
BYPASS_TOOL_CONSENT=true # Auto-approve tool executionfrom bedrock_agentcore.runtime import BedrockAgentCoreApp
app = BedrockAgentCoreApp()
@app.entrypoint
async def agent_invocation(payload, context):
user_message = payload.get("prompt")
agent_stream = agent.stream_async(user_message)
async for event in agent_stream:
# Stream text chunks back to user
yield event["text"]from strands import Agent, tool
agent = Agent(
tools=[
generate_nextjs_app,
write_react_component,
deploy_app_to_amplify,
# ... 7 more tools
]
)def deploy_new_version(app_name, source_dir, prompt):
# 1. Create/get Amplify app
app_id = create_amplify_app_if_needed(app_name)
# 2. Upload source to S3
upload_directory_to_s3(source_dir, f"projects/{app_id}/source/v1/")
# 3. Build locally
subprocess.run(['npm', 'install'], cwd=source_dir)
subprocess.run(['npm', 'run', 'build'], cwd=source_dir)
# 4. Upload built files to S3
upload_directory_to_s3(built_dir, f"projects/{app_id}/deployments/{ts}/")
# 5. Deploy to Amplify
amplify_client.start_deployment(
appId=app_id,
sourceUrl=f"s3://bucket/projects/{app_id}/deployments/{ts}/"
)
# 6. Wait for completion
while status != 'SUCCEED':
time.sleep(5)
# 7. Return live URL
return f"https://main.{app_id}.amplifyapp.com"- Streaming Responses - Uses async generators for real-time feedback
- Tool Consent Bypass - Agent can execute tools without asking (faster UX)
- Static Export Only - Next.js configured with
output: 'export'(Amplify S3 limitation) - Local Builds - Builds happen in container, not on Amplify (S3 deployment constraint)
- Version Immutability - Each version's source frozen in S3 (true rollback)
- Single URL - All versions deploy to same URL, content changes (Amplify behavior)
- AWS Bedrock AgentCore - Get Started with Starter Toolkit
- AWS Bedrock AgentCore Documentation
- Strands Agents Framework
- AWS Amplify Hosting
- Next.js Static Export
This is a proof-of-concept project demonstrating AI agents on AWS Bedrock AgentCore. Feel free to:
- Fork and modify for your use case
- Add support for more frameworks
- Improve the deployment pipeline
- Build a web UI on top
MIT License - Feel free to use this code for your own projects.
Built with:
- AWS Bedrock AgentCore - Serverless agent runtime
- Strands - AI agent framework
- AWS Amplify - Static site hosting
- Next.js - React framework
Built in ~300 lines of code. Deployed on AWS Bedrock AgentCore. Generates live web apps in under 2 minutes.