Chalkboard: an AI lesson planning system for K-2 teachers
Chalkboard turns a teaching team's curriculum into a week of copy-ready Planbook plans, morning slide decks and printable worksheets. I run it on serverless AWS for about $1 to $2 a month.
My role
Sole engineer. I scoped the problem with the user and made the product calls, then designed and built the system. I also run it in production.
- Product discovery with the user
- Product and scope decisions
- AWS architecture: CDK, Lambda, DynamoDB, Cognito, CloudFront
- IaC and CI/CD with GitHub Actions and OIDC
- Multi-LLM orchestration design
- Evaluation harness and measured results
- Production operations: alerts, cost controls, rollback flags
- Frontend (React) and backend (Python)
- Privacy: names redacted before model calls
- Status
- In use in kindergarten, rolling out to grades 1 and 2, invite only
- Platform cost
- About $1 to $2 a month on AWS
- Cloud
- AWS serverless in us-east-2, built with CDK v2
- AI
- 5 model roles on OpenRouter, each with fallbacks
Technology stack
- AWS CDK v2
- Lambda (container images)
- API Gateway HTTP API
- DynamoDB
- S3
- CloudFront
- Cognito
- SSM Parameter Store
- Python
- Pydantic
- React
- WeasyPrint
- OpenRouter
- Google Slides and Drive APIs
- GitHub Actions (OIDC)
The problem and discovery
Built embedded with real users
K-2 teachers spent hours each week turning curriculum documents into Planbook boxes, morning slides and worksheets. I built Chalkboard the forward deployed way: I worked with them on their real weeks, shipped to production, and fixed what they ran into.
I built for their workflow
Teachers paste plans into Planbook one box at a time, and copying from a PDF dropped the links. I gave each plan box its own rich-HTML Copy button that keeps them, and split English Language Arts into the two boxes they use.
I made their Canvas docs the authority
The team's Canvas lesson documents set what each teacher teaches and when. I designed the planner to work from them, so a week holds only lessons the curriculum contains.
I fixed the cause of a production bug
A teacher reported a field trip line in the wrong week. I traced it to an old small-group pool and fixed it at three layers: a filter on the pool, a calendar verifier that blocks publishing when a plan disagrees with the school calendar, and a backfill of the stored data.
I rebuilt the worksheet maker and measured it
Too many AI-made worksheets failed review. I built an evaluation harness, rebuilt the maker as a code-first pipeline, and ran both versions on the same set of ideas. The pass rate went from 1 of 19 to 30 of 42.
Rich HTML on the clipboard, so links survive the paste into Planbook.
Inputs to outputs
- In: Canvas lesson docs, the school calendar
- Out: Planbook boxes with working links
- Out: daily morning slide decks
- Out: printable worksheets (PDF)
Architecture
Serverless on AWS, defined in CDK
I designed each component to scale to zero, so nothing in the account bills by the hour. Long work runs in staged Lambdas and secrets stay in Parameter Store. I define all of it in CDK and deploy through CI.
Request path
CloudFront serves the React app from S3 at the edge, with its ACM certificate in us-east-1. Cognito handles invite-only sign-in, and a Cognito JWT authorizer on the HTTP API checks each call. The API Lambda reads and writes a DynamoDB single table and an S3 data bucket that holds curriculum documents, built plans, decks, worksheets and the vetted picture library.
Async work
A jobs Lambda (5 minutes) runs the shorter async tasks. A week-generation Lambda (15 minutes) runs in stages, checkpoints to S3, re-invokes itself and resumes dead runs. I publish decks to Google Slides as view-only "Make a copy" links with embedded YouTube players.
Operations
A daily healthcheck tests the Google token and OpenRouter credit, and on Wednesday it alerts me if next week is not built. Link checks and video refreshes run on their own schedules. Alerts reach me through SNS, CloudWatch alarms and AWS Budgets.
Delivery: AWS CDK v2 in TypeScript. GitHub Actions assumes deploy roles with OIDC, so GitHub holds no AWS keys. Pull requests get a read-only diff, and a merge to main deploys.
Key decisions and tradeoffs
Short decision records
Six calls I made, with the reason and the cost of each.
Decision 01
Serverless only
No NAT gateway, load balancer, RDS or Fargate.
A small team of teachers leaves the system idle most of the day. I chose pay-per-request Lambda, DynamoDB and S3, and the platform costs about $1 to $2 a month with no servers to patch.
Tradeoff: Cold starts and the 15-minute Lambda limit, which decision 03 handles.
Decision 02
Lambda container images
I package the API and workers as Python container images.
WeasyPrint PDF rendering and image processing need native libraries that a zip deployment cannot hold. With images, the API and the workers share one runtime.
Tradeoff: Larger images and slower first deploys.
Decision 03
Resumable staged builds
I split week generation into stages. Each stage checkpoints to S3, and the Lambda invokes itself for the next one.
A full week of plans, decks and worksheets can run past the 15-minute Lambda limit. A stage near its deadline checkpoints and re-invokes, and I treat a run with no checkpoint for 20 minutes as dead and resume it.
Tradeoff: More state to track, and no long-running server to pay for.
Decision 04
Removal records with exact Undo
Remove moves an item out of its ITEM# key family into a REMOVED# record with a 30-day expiry.
Normal reads never see a removed item, and Undo puts back the item and its plan line as they were, even after a reload or a closed tab. A teacher should not lose an hour of work to a misclick.
Tradeoff: A restore has to move the record back and re-insert its plan line, more steps than a flag.
Decision 05
Idempotency keys and job deadlines
Each async job carries an idempotency key and a hard deadline.
A retry or a double click cannot create duplicate work. A stuck job now fails with a clear message, where the old worksheet maker once hung for 44 minutes.
Tradeoff: A little bookkeeping per request.
Decision 06
Production only, with guardrails
I test each change before merge and smoke test it live after deploy.
Merging to main deploys. I added a configuration flag that switches the worksheet maker back to the previous version without a code change.
Tradeoff: No staging environment to pay for, so the test suite carries that weight.
Multi-LLM orchestration
Five model roles, each with fallbacks
I route models by role through OpenRouter. For each role I picked a primary on cost, speed and quality for that task, plus fallbacks. A provider outage or a bad response sends the call to the next model, and the build keeps going.
| Role | What it does | Primary | Fallbacks |
|---|---|---|---|
| Orchestrator | Week planning (low reasoning effort) | GLM 5.3 | Kimi K3Claude Sonnet 5.5 |
| Router | Chat triage and fast idea generation | Claude Haiku 5.5 | GPT-6 Luna |
| Drafter | Slide text and quick edits | GLM 5.3 Flash | DeepSeek V4.1 Flash |
| Vision | Page checks and picture vetting | Gemma 4 31B | Claude Haiku 5.5 |
| Image | Kid-safe black and white clip art | Gemini 3.1 Flash Lite Image | Gemini 3.1 Flash Image |
Orchestrator
Week planning (low reasoning effort)
GLM 5.3Kimi K3Claude Sonnet 5.5Router
Chat triage and fast idea generation
Claude Haiku 5.5GPT-6 LunaDrafter
Slide text and quick edits
GLM 5.3 FlashDeepSeek V4.1 FlashVision
Page checks and picture vetting
Gemma 4 31BClaude Haiku 5.5Image
Kid-safe black and white clip art
Gemini 3.1 Flash Lite ImageGemini 3.1 Flash Image
Guardrails on model calls
Provider pinning
I pin requests to mainstream US hosts with data collection off.
Redaction first
I strip student names and personal details before any model call.
Cost control
I track the cost of each call and cap the spend per worksheet.
Out-of-credits handling
If OpenRouter credit runs out, I get an ops alert and the job stops with a clear message.
Structured outputs
I validate each response with Pydantic and clean the text before it reaches the page.
Search on demand
Chalky searches the web when a question needs it and answers from the plan the rest of the time.
Vetted picture library
I generate each picture once, have the vision model check it, and reuse it.
Fallback chains
Each role has at least one fallback model, so one provider outage does not stop a build.
The worksheet pipeline
A code-first worksheet maker
In the rebuild I moved each rule that code can enforce out of the prompt. A worksheet now costs one small planning call, one vision check, and the pictures the library does not have yet.
- 11 LLM call
Plan
One small model call picks a layout and candidate words.
- 2deterministic
Build in code
Code picks the words, numbers, title and lesson tag. Lint and teaching rules run as filters, and code fits the page height.
- 35 threads
Pictures
Five parallel threads check the library first and swap in spares when a picture fails.
- 4PDF
Render
WeasyPrint renders a print-ready PDF.
- 51 vision call
Vision check
One vision call names each picture. I fix problems with targeted edits and skip full redrafts.
Results
Measured before and after
I ran the old maker and the rebuilt pipeline on the same worksheet ideas, with an independent review as the judge.
Worksheets passing independent review
30 of 42
was 1 of 19
about 5% before, 71% after
Median time per worksheet
21 s
was 82 s
about 4x faster
Worst case
under 2 min
was 44 min hang
job deadlines end runaway runs
Model cost per worksheet
$0.01 to $0.07
was about $0.10
mostly new pictures, capped at $0.60
$1 to $2
per month for the AWS platform
about 980
automated backend tests
Live E2E
browser tests against the production site
Also in the product
Smaller pieces they use each week
Chalky, a plan-aware assistant
Chalky reads the week's plan, searches the web when a question needs it, and takes voice input.
Remove with Undo
Undo puts back the item and its plan line as they were.
Offline-tolerant UI
Transient errors show a plain message, and pending work survives a reload.
A playful animated mascot
They teach kindergarten through second grade, and I wanted the tool to feel like their classrooms.
Privacy
Privacy. Chalkboard serves K-2 teams' classroom planning. It stores no student records, and I redact names before any AI call.