Weekend Productivity Challenge: AI Email Writer
AI Email Writer is a lightweight, AI powered tool that turns a one-line description into a ready to send email. Just enter who it's for, what it's about, and the tone you want, and Amazon Bedrock's Nova Micro model generates a complete subject line and body in seconds , built on a minimal serverless stack (Lambda + Bedrock + Amplify) with no database, no sign-up, and no bloat.
Vision & What the App Does
Writing emails is a small task that quietly eats a disproportionate amount of time. You know what you want to say, but you burn ten minutes rewording the same sentence, second guessing whether it sounds too blunt or too formal. AI Email Writer removes that friction entirely, you describe the recipient, the topic, and the tone you want, and it generates a complete, ready to send email, subject line and body in a couple of seconds.
The design goal was deliberately narrow. Rather than build a bloated all-in-one writing suite, I focused on one job done well: turn a rough intention ("ask my manager for Friday off, keep it friendly") into a finished draft. From a user's perspective, it's three fields and a button recipient, topic, tone and the output is something you can copy straight into your email client.
How I Built It
Motivation: I wanted something I'd actually use, not a toy demo. Emails are the one writing task I do every single day, so it was the obvious target for a genuinely useful weekend build.
Architecture : stay small on purpose: I skipped a database and skipped API Gateway entirely. The frontend is a single static HTML file no framework, no build step and it talks straight to a Lambda Function URL, which calls Amazon Bedrock. No moving parts beyond what the task actually needs.
Key challenges and how I solved them:
- Handler misconfiguration. My first deploy threw
Runtime.HandlerNotFound. Lambda's Runtime Settings hadlambda_function.lambda_handleras the expected entry point, but my function was defined ashandler, notlambda_handler. Fixed by updating the Handler field in Runtime Settings to match my code exactly (lambda_function.handler) a good reminder that Lambda's handler name isn't inferred, it's an explicit config value that has to match your code.
- Duplicate CORS headers. Once the function was running, the browser started throwing: "the 'Access-Control-Allow-Origin' header contains multiple values ', '". I'd set CORS in two places at once — inside the Function URL's own CORS configuration, and again inside my Python response headers. Both were injecting
Access-Control-Allow-Origin: *, and the browser refused to accept a doubled-up header as valid. The fix was choosing one layer to own CORS (the Function URL config) and stripping the headers out of the application code entirely.
- Debugging methodology. Rather than guessing from the browser, I isolated backend vs. frontend by hitting the Lambda Function URL directly with
curl. That confirmed Bedrock and Lambda were working correctly well before the CORS issue was found, which meant I only had to debug one layer at a time instead of both simultaneously.
AWS Services Used / Architecture Overview
User (browser) │ ▼AWS Amplify(static HTML/JS hosting) │ ▼AWS Lambda Function URL(HTTPS endpoint, no API Gateway) │ ▼AWS Lambda(Python 3.12) │ ▼Amazon Bedrock(Amazon Nova Micro, Converse API) │ ▼Generated email (subject + body) → JSON → rendered in browserServices breakdown:
- AWS Amplify — hosts the static single-file frontend, deployed via drag-and-drop (no Git required)
- AWS Lambda — Python 3.12 function, exposed directly via a Function URL, skipping API Gateway for a single-endpoint use case
- Amazon Bedrock (Nova Micro) — generates the email content via the
ConverseAPI from a structured prompt
- IAM — Lambda's execution role scoped with Bedrock invoke permissions
What I Learned
This was my first time wiring Lambda directly to Bedrock without any intermediate service. I learned that Lambda Function URLs are a genuinely fast way to stand up a single-endpoint backend no need for API Gateway if you're not doing routing, multiple methods, or custom domains. I also picked up a concrete lesson about CORS: it can be configured at the infrastructure layer (Function URL settings) or the application layer (response headers in code), but never both — configuring it twice produces an invalid duplicated header that browsers reject outright, even though tools like
curl won't show any problem at all. That mismatch between "works in curl" and "fails in browser" was the most useful debugging lesson of the whole build.Future Improvements
- Multiple drafts per request — generate 2–3 variations (e.g. direct vs. softer tone) to choose from
- Copy-to-clipboard button — one-click copy instead of manual selection
- Save/history — keep a lightweight local history of past generated emails
- Length control — a short/medium/long slider for different email styles
Link to App :
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article