AWS Builder Center
Building a Full-Stack Student Task Manager with AWS Blocks: From Local Mocks to Production on AWS

Building a Full-Stack Student Task Manager with AWS Blocks: From Local Mocks to Production on AWS

A beginner-friendly guide to building a secure, full-stack task manager with TypeScript and AWS Blocks — covering user-scoped data isolation, CRUD workflows, and how the same backend code runs locally with zero AWS setup and deploys to production unchanged

Building a Full-Stack Student Task Manager with AWS Blocks: From Local Mocks to Production on AWS

Introduction

Learning full-stack development often means juggling a dozen moving parts before you write a single line of business logic — setting up a database, wiring authentication, configuring a bundler, and provisioning cloud infrastructure. For students and beginners, this setup overhead can be the biggest barrier to actually building something.
This is the problem I set out to solve with Student Task Manager, a beginner-friendly, full-stack task management application built with TypeScript and AWS Blocks. It lets any user sign up, sign in, and manage a completely private, personal task list — with create, edit, complete, and delete operations — while the entire backend runs as in-memory mocks locally. No AWS account, no manual infrastructure setup, and no code changes required to eventually deploy the same application to real AWS services.
In this post, I'll walk through the architecture, the data flow, the CRUD implementation, and the security model behind the app, along with how AWS Blocks makes the leap from "runs on my laptop" to "runs on AWS" completely seamless.



Why AWS Blocks?

One of the biggest friction points in early-stage full-stack projects is the mismatch between local development and cloud deployment. Typically, developers either:
  • Mock everything locally and then rewrite significant portions of the backend for production, or
  • Require live AWS credentials from day one, which is a steep ask for students just getting started.
AWS Blocks solves this by letting the same backend code run against local, in-memory implementations during development and against real AWS services (DynamoDB, Lambda, CloudFront, S3) in production — with zero code changes. This made it the ideal foundation for a project meant to be approachable for beginners while still reflecting real production patterns.



Key Features

Feature
Description
Sign Up
Create a new account with a username and password (minimum 8 characters)
Sign In / Sign Out
Authenticate with credentials; sign out from the top-right menu
Create Task
Add a new task with a title (up to 200 characters)
View Tasks
See all tasks, sorted by creation date (oldest first)
Edit Task
Rename any task inline; confirm with Enter or the Save button
Complete / Incomplete
Toggle a task's completion status via checkbox
Delete Task
Remove a task permanently, with a confirmation prompt
User Isolation
Every user only ever sees and operates on their own tasks
Task Summary
A live counter shows tasks remaining vs. completed
Loading & Error States
Clear loading indicators and inline error messages throughout the UI



High-Level Architecture

The application is intentionally framework-light on the frontend and relies on AWS Blocks primitives on the backend:
Component
Purpose
TypeScript + DOM
Single-page frontend; no framework; rendered imperatively in src/index.ts
Vite
Development server (port 3100) and production bundler
AuthBasic
Username/password authentication backed by a signed JWT session cookie
ApiNamespace
Exposes all backend methods to the frontend as typed async functions
KVStore (tasks)
Stores individual Task objects at user-scoped keys
KVStore (auth-users)
Stores per-user task-ID index arrays for efficient listing
AWS Blocks
Ties everything together — mocks locally, deploys to AWS unchanged
This keeps the frontend simple (no framework overhead) while the backend stays production-realistic from day one.




Full-Stack Data Flow

Every user action in the app follows the same predictable path, end to end:
  1. The user interacts with the browser UI (add, edit, toggle, or delete a task).
  1. The frontend calls the matching typed API method exposed via AWS Blocks (e.g.  api.createTask ).
  1. The backend receives the request as JSON-RPC.
  1.  auth.requireAuth(context)  reads the session cookie and resolves the authenticated  userId . If no valid session exists, it throws a 401 and the call stops immediately.
  1. The backend builds a user-scoped KVStore key ( tasks:{userId}:{taskId} ), ensuring no user can ever reach another user's data.
  1. KVStore performs the read or write operation.
  1. The backend returns the result to the frontend.
  1. The frontend updates local state and re-renders the task list.
This single, consistent flow — auth check first, scoped key second, data operation third — is what makes the security model easy to reason about across every endpoint.



CRUD Workflows

Create

 api.createTask(title)  generates a unique  id  (base-36 timestamp plus a random suffix), sets  completed: false , stamps  createdAt  as an ISO 8601 timestamp, and attaches the  userId  from the session. The task is written to  tasks:{userId}:{taskId} , and its ID is appended to the  index:{userId}  list.

Read

 api.listTasks()  reads the  index:{userId}  list to get the user's task IDs, fetches each  Task  object individually from KVStore, and returns them sorted by  createdAt  ascending.

Update

 api.updateTask(taskId, title)  reads the existing task, replaces only the  title  field, and writes it back — every other field is preserved untouched.

Complete / Incomplete

 api.toggleTask(taskId)  reads the existing task, flips the  completed  boolean, and writes it back. Calling it twice restores the original state — a simple, idempotent-by-pairs design.

Delete

 api.deleteTask(taskId)  removes the task object from  tasks:{userId}:{taskId}  and removes the corresponding ID from the  index:{userId}  list, keeping the index and the data store in sync.



Task Data Model

Every task is validated at runtime using Zod, so malformed data never silently makes it into the store:
{
id: string // Unique task identifier
title: string // Task title (trimmed, max 200 chars in the UI)
completed: boolean // false on creation; toggled by toggleTask
createdAt: string // ISO 8601 timestamp set at creation
userId: string // Username of the owning user; set from the session
}




Security: User-Scoped Data Isolation

Security here isn't bolted on — it's structural. A few deliberate design choices make user isolation the default, not an afterthought:
  • The frontend never sends a  userId . Every request's  userId  is derived server-side from the authenticated session via  auth.requireAuth(context) .
  • KVStore keys are always user-scoped: tasks:{userId}:{taskId} → individual Task object index:{userId} → string[] of taskIds belonging to this user
  • Every API method starts with an auth check. If the session cookie is missing or expired, the call throws a 401 before any data operation runs.
Because the  userId  used in every key is always derived from the server-side session — never from client input — there's no code path by which one user could construct a key that reaches another user's data.



Local Development vs. AWS Production

This is where AWS Blocks really shines: the exact same backend file,  aws-blocks/index.ts , runs in both environments.

npm run dev
npm run sandbox / npm run deploy
AWS account required
No
Yes
AuthBasic
In-memory mock
Real JWT + DynamoDB session store
KVStore
Files in .bb-data/
Real DynamoDB table
Frontend
Vite dev server (port 3100)
CloudFront + S3
Same backend code?
✅ Yes
✅ Yes
For a student or beginner, this means you can build, test, and iterate entirely offline, then deploy to production AWS infrastructure with a single command and zero rewrites.



Project Structure

student-task-manager/
├── aws-blocks/
│ ├── index.ts # Backend — AuthBasic, KVStore, ApiNamespace
│ ├── index.cdk.ts # CDK infrastructure definition (AWS deploy)
│ ├── index.handler.ts # Lambda entry point (AWS deploy)
│ └── scripts/ # Dev server, deploy, sandbox, destroy helpers
├── src/
│ └── index.ts # Frontend — DOM rendering, auth polling, API calls
├── test/
│ └── e2e.test.ts # End-to-end tests (Node test runner)
├── .bb-data/ # Local mock data (git-ignored; delete to reset)
├── index.html # App shell — header, #app mount point, all CSS
├── vite.config.ts # Vite bundler config
├── tsconfig.json # TypeScript config (target ES2022, strict)
├── cdk.json # CDK app entry point
└── package.json # Scripts, dependencies, Node ≥22 requirement




Getting Started

Prerequisites: Node.js ≥ 22 ( node --version )
# Install dependencies
npm install

# Run locally — starts backend + Vite frontend on port 3100
npm run dev

Open localhost:3100  in your browser. Local data persists to  .bb-data/  across restarts — delete that folder anytime to reset all users and tasks.
# Run end-to-end tests
npm run test:e2e

# Type-check without emitting output
npm run typecheck

The end-to-end suite spins up a backend server automatically (if one isn't already running) and exercises the full auth and CRUD surface — sign-up, sign-in, unauthenticated rejection, create, list, edit, toggle, delete, and user isolation — using the same typed API client the frontend relies on.



Tech Stack Summary

Package
Version
Purpose
@aws-blocks/blocks
*
Core framework — AuthBasic, KVStore, ApiNamespace, UI components
zod
^4.3.0
Runtime schema validation for the Task model
typescript
^5.3.0
Language
vite
^6.4.3
Frontend bundler and dev server
tsx
^4.7.0
TypeScript execution for backend scripts
aws-cdk-lib
^2.257.0
CDK infrastructure (used only for deploy)



Closing Thoughts

Student Task Manager is deliberately small in scope, but it's built on patterns that scale: session-derived authorization, user-scoped storage keys, runtime schema validation, and a backend that's identical across local and cloud environments. For students exploring full-stack development, it's a compact but realistic example of how to think about auth, data isolation, and deployment from the very first commit — without needing an AWS account just to get started.
If you're learning AWS Blocks or looking for a clean reference implementation of auth + CRUD + user isolation, feel free to clone the repo, run  npm run dev , and explore the code from  aws-blocks/index.ts  outward.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article