AWS Builder Center
Shipping Three Full-Stack Applications with AWS Blocks — No Cloud Account Required

Shipping Three Full-Stack Applications with AWS Blocks — No Cloud Account Required

A walkthrough of three progressively advanced applications — a personal bookmark manager, a live polling platform, and an AI-powered help desk — built as part of the Builders Skill Sprint (June 2026) AWS Blocks Sprint, hosted under DevTools Month with the AWS User Group Madurai.

About the Sprint

The AWS Blocks Sprint was structured as three independent tracks, each targeting a different level of complexity. Participants could choose the track that matched their experience, and none of the tracks required completing the previous one first. Every track ran entirely on  npm run dev , using local implementations of each AWS Block — no AWS account, credentials, or deployment was required to complete the core sprint.
I worked through all three prescribed tracks:
Level
Application
Focus Area
Core Blocks
1
Personal Bookmark Manager
Authenticated CRUD and data isolation
AuthBasic, DistributedTable
2
Live Polls
Multi-user concurrency and realtime updates
AuthBasic, DistributedTable, Realtime, CronJob
3
AI Help Desk
AI agents, authorization, uploads, and observability
AuthBasic, DistributedTable, FileBucket, KnowledgeBase, Agent, Realtime
Across all three builds, the sprint's ground rules stayed constant: call the backend only through the typed  aws-blocks  API import, persist all application state through a Block rather than local files or arrays, authorize every protected endpoint with  auth.requireAuth()  (or a role check), and never trust the browser for a user's identity. Below is a detailed account of what each level involved and the engineering decisions that mattered most at each stage.



Level 1: Personal Bookmark Manager

Objective

Build a private, single-user-scoped web application where each authenticated user can save, view, and delete their own bookmarks. The application needed real authentication, strict per-user data isolation, and persistence that survives server restarts — not an in-memory demo.

Feature Set

  • Sign up, sign in, and sign out
  • Save a bookmark with a URL, title, and tag
  • View a personal, per-user bookmark list
  • Delete a bookmark
  • Full data isolation between user accounts

Blocks Used

 Scope  for the application resource boundary,  AuthBasic  for username/password authentication,  DistributedTable  for durable per-user storage, and  ApiNamespace  for a typed backend API consumed directly by the frontend.

Architecture

Browser → AuthBasic (sign-up / sign-in)
→ ApiNamespace (createBookmark, listBookmarks, deleteBookmark)
→ DistributedTable (persisted locally under .bb-data/)


Data Model

const bookmarkSchema = z.object({
userId: z.string(), // Partition key — per-user isolation
bookmarkId: z.string(), // Sort key — generated on the backend
url: z.string().url(),
title: z.string().min(1),
tag: z.string().min(1),
createdAt: z.string(), // ISO 8601, generated on the backend
});


Design Decision: Identity Is Never Client-Supplied

The sprint's ground rules are explicit that  userId ,  owner , and similar fields must never be accepted from the browser when they can be derived from the authenticated session. In practice, that meant every write path looked like this:
async createBookmark(input: { url: string; title: string; tag: string }) {
const user = await auth.requireAuth(context); // authorize first
const bookmarkId = randomUUID(); // generated server-side
const createdAt = new Date().toISOString(); // generated server-side
const userId = user.userId; // derived from session, never from input

await bookmarks.put({ userId, bookmarkId, url, title, tag, createdAt });
return { success: true };
}

This single pattern — authenticate, then derive identity from the session rather than the request body — is what made the isolation guarantees enforceable rather than merely assumed. It was validated directly:
✔ Unauthenticated request rejected (401)
✔ User A creates and views their own bookmark
✔ Bookmark persists after a server restart
✔ User B cannot view User A's bookmarks
✔ User B cannot delete User A's bookmark


Takeaways

 DistributedTable  removed the need for any manual table provisioning while still giving schema-validated, durable, per-user storage locally.  ApiNamespace  eliminated hand-written REST routes and fetch wrappers entirely — the frontend consumed backend methods as regular typed function calls. Most importantly, this level established the pattern that carried through the remaining two tracks: authorize at the endpoint, and derive identity server-side, every time.



Level 2: Live Polls

Objective

Build a multi-user, realtime polling application. Users create polls, cast exactly one vote each, and watch aggregate results update live as other participants vote. Polls also needed to close automatically once their deadline passed, without any manual intervention.

Feature Set

  • Poll creation with multiple options and a defined close time
  • One vote per user, enforced on the backend rather than the UI
  • Live vote-count updates pushed to all connected clients over WebSocket
  • Automatic poll closure via a scheduled background job

Blocks Used

 Scope ,  AuthBasic ,  DistributedTable  for poll and vote storage,  Realtime  for WebSocket-based live updates,  CronJob  for scheduled poll closure, and  ApiNamespace .

Architecture

Browser → vote() API
→ DistributedTable (conditional write)
→ Realtime.publish(full snapshot)
→ All connected clients update live

CronJob (scheduled)
→ Query open polls past their close time
→ Close each poll (optimistic concurrency check)
→ Publish the final snapshot


Data Model

Polls table (partition key  pollId , indexed by status and close time):
{ pollId, ownerId, question, options, status, closesAt,
closedAt, createdAt, revision, summary }

Votes table (partition key  pollId , sort key  userId ):
{ pollId, userId, optionId, votedAt }
// One record per vote; the composite key enforces uniqueness.


Design Decision: Voting Under Concurrency

The vote-casting workflow is where this track's real complexity lived. A naive implementation — read the poll, check whether the user has voted, then write — is vulnerable to a race condition: two simultaneous requests from the same user can both pass the check before either write completes. The correct implementation instead relies on atomic, conditional writes at every step:
async vote(pollId, optionId) {
const user = await auth.requireAuth(context);
const votedAt = new Date().toISOString();

const poll = await polls.get({ pollId });
if (!poll) throw new ApiError('Not found', 404);
if (poll.status === 'closed') throw new ApiError('Closed', 409);
if (!poll.options.some(o => o.id === optionId)) throw new ApiError('Invalid option', 400);

// Atomic vote reservation — the composite key prevents double-voting
try {
await votes.put(voteRecord, { ifNotExists: true });
} catch (e) {
if (isBlocksError(e, DistributedTableErrors.ConditionalCheckFailed)) {
throw new ApiError('Already voted', 409);
}
}

// Re-check for a close that happened between the initial read and the write
const freshPoll = await polls.get({ pollId });
if (freshPoll?.status === 'closed') {
await votes.delete({ pollId, userId: user.userId });
throw new ApiError('Poll closed', 409);
}

const updated = await bumpRevision(pollId); // optimistic concurrency
const snapshot = await buildSnapshot(updated);
await rt.publish('polls', pollId, snapshot); // full snapshot, never a delta
}

The combination of  ifNotExists  for first-write-wins vote reservation and  ifFieldEquals -based optimistic locking for the poll's revision counter is what makes simultaneous duplicate vote requests fail safely rather than corrupt the tally.

Design Decision: Realtime Publishes Full Snapshots Only

A second rule proved equally important: the  Realtime  channel never publishes incremental deltas, only the complete current state, tagged with a monotonically increasing revision number.
type PollSnapshot = {
pollId: string;
counts: Record<string, number>;
totalVotes: number;
status: 'open' | 'closed';
revision: number; // clients discard snapshots older than their current one
updatedAt: string;
};

 DistributedTable  remains the single source of truth;  Realtime  delivery is treated as best-effort. A client that disconnects and reconnects reloads canonical state rather than depending on missed WebSocket messages.

Design Decision: An Idempotent Scheduled Job

The  CronJob  that closes expired polls runs on a fixed schedule and queries only polls that are still open and past their close time, using an index rather than a table scan. Each closure checks that the poll's status is not already  closed  before acting, so a job that runs twice — or overlaps with a manual close — never double-processes a poll.

Validation

✔ User A creates a poll
✔ User B opens the poll and receives the initial snapshot
✔ User A votes — both clients update live
✔ User A votes again — rejected
✔ Simultaneous duplicate vote requests — rejected
✔ Poll closes — a vote submitted after close is rejected
✔ Client disconnect and reconnect — reloads canonical state
✔ Local restart — poll and vote data remain intact


Takeaways

This track demonstrated that concurrency correctness, not raw feature count, is what separates a working demo from a reliable multi-user system. Conditional writes ( ifNotExists ,  ifFieldEquals ), full-snapshot broadcasting, and idempotent background jobs form a small set of patterns that generalize well beyond polling to any system with concurrent writers and live observers.



Level 3: AI Help Desk

Objective

Build a customer support platform where an AI agent answers questions grounded in a knowledge base, creates support tickets on a customer's behalf when it cannot resolve an issue, and streams its responses in real time. Human support agents needed a live queue of tickets, and the system needed to enforce request rate limits, support document uploads, and produce structured observability data throughout.

Feature Set

  • An AI chat interface that searches a knowledge base before answering
  • Automatic ticket escalation when the agent cannot resolve a request
  • Manual ticket creation for customers who prefer to reach a human directly
  • A live agent queue that updates in real time over WebSocket
  • Server-enforced rate limiting on AI requests per user
  • Help-document upload and staging for agents
  • Structured logging and custom metrics on every significant operation

Blocks Used

 Scope ,  AuthBasic ,  DistributedTable  for ticket and rate-limiter storage,  FileBucket  for help-document staging,  KnowledgeBase  for semantic retrieval over uploaded documents,  Agent  for the tool-using conversational AI,  Realtime  for the live ticket queue,  Logger ,  Metrics , and  ApiNamespace .

Architecture

Customer → sendMessage() API
→ checkRateLimit() (optimistic concurrency)
→ helpAgent.stream()
→ searchHelpDocs tool → KnowledgeBase.retrieve()
→ createTicketTool → DistributedTable.put()
→ Realtime.publish(full snapshot)
→ Realtime channel (token-by-token streaming to the browser)

Customer → createTicket() API
→ DistributedTable.put()
→ Realtime.publish(full snapshot)

Agent → listAgentTickets() (indexed query, no table scan)
→ updateTicketStatus() (optimistic concurrency)
→ getAgentChannel() (Realtime subscription)

Admin → getUploadUrl() → FileBucket presigned upload
→ finalizeUpload() (post-upload validation)
→ KnowledgeBase auto-indexes from the uploaded document folder


Data Model

Tickets table (partition key  ticketId , indexed by customer and by status):
{ ticketId, customerId, subject, description,
status, // open | in_progress | resolved | closed
priority, // low | medium | high | urgent
source, // customer | ai
createdAt, updatedAt, version }

Rate limiter table (partition key  userId , sort key  windowStart , TTL on  expiresAt ):
{ subject, windowStart, count, version, expiresAt }
// One record per user per fixed time window; expires automatically.


Design Decision: Rate Limiting Without a Race Condition

A naive rate limiter — read the current count, increment it, write it back — is unsafe under concurrent requests: two requests can read the same count before either write lands, allowing more requests through than the limit permits. The implementation instead separates a fast path for the first request in a window from a bounded-retry slow path for subsequent ones:
async function checkRateLimit(userId: string): Promise<void> {
const windowStart = toWindowStart(Date.now());

// Fast path: atomically create the window record
try {
await rateLimiter.put(
{ subject: userId, windowStart, count: 1, version: 1, expiresAt },
{ ifNotExists: true },
);
return;
} catch (e) {
if (!isBlocksError(e, DistributedTableErrors.ConditionalCheckFailed)) throw e;
}

// Slow path: optimistic-concurrency increment, bounded retries
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
const current = await rateLimiter.get({ subject: userId, windowStart });
if (!current) return; // window expired between steps — treat as a new window

if (current.count >= RATE_LIMIT_MAX_REQUESTS) {
throw new ApiError('Rate limit exceeded.', 429);
}

try {
await rateLimiter.put(
{ ...current, count: current.count + 1, version: current.version + 1 },
{ ifFieldEquals: { version: current.version } },
);
return;
} catch (e) {
if (isBlocksError(e, DistributedTableErrors.ConditionalCheckFailed)) continue;
throw e;
}
}
throw new ApiError('Too many concurrent requests', 429);
}

Placing a TTL ( expiresAt ) directly on the rate-limiter record means expired windows are cleaned up automatically, without a dedicated background job.

Design Decision: Grounding the Agent with Tools

The AI agent was not treated as a standalone chatbot but as a component with explicit, auditable tools:
const helpAgent = new Agent(scope, 'help-agent', {
model: { deployed: BedrockModels.BALANCED, local: [ollamaConfig] },
streamingMode: 'token',
systemPrompt: `You are a helpful AI support assistant...
Always search the knowledge base before answering.
When a customer needs human help, create a ticket for them.
Never make up information.`,
tools: (tool) => ({
searchHelpDocs: tool({
description: 'Search help documentation for answers',
parameters: z.object({ query: z.string(), maxResults: z.number().optional() }),
handler: async ({ input }) => {
const results = await kb.retrieve(input.query, { maxResults: input.maxResults ?? 3 });
return results.map(r => ({ fact: r.text, source: r.source, score: r.score }));
},
}),
createTicketTool: tool({
description: 'Create a support ticket when the customer needs human help',
parameters: z.object({
subject: z.string(), description: z.string(),
priority: z.enum(['low', 'medium', 'high', 'urgent']),
}),
handler: async ({ input, context: toolCtx }) => {
const ticket = await createTicketRecord({ customerId: toolCtx.userId, ...input, source: 'ai' });
await rt.publish('tickets', 'agent-queue', { ...ticket, event: 'created' });
return { ticketId: ticket.ticketId, status: 'open' };
},
}),
}),
});

The system prompt instructs the model to search the knowledge base before answering and to avoid fabricating information — but it is the  searchHelpDocs  tool that makes this enforceable: without it, responses have no traceable source; with it, every answer can be tied back to an indexed document. Because  context: { userId }  is passed directly into  helpAgent.stream() , tool handlers receive the authenticated user's identity without needing to re-authenticate independently.

Design Decision: Ownership Is Checked Separately from Authentication

Being authenticated does not imply a user owns a given conversation or ticket. Every conversation-access path verifies ownership explicitly before proceeding:
const owned = await helpAgent.listConversations(user.userId);
if (!owned.some(c => c.conversationId === conversationId)) {
throw new ApiError('Conversation not found', 404);
}

 userId  is drawn from  auth.requireAuth(context)  throughout — never from the request body — consistent with the identity rule established in Level 1 and carried through Level 2.

Observability

Every significant backend operation paired a structured log entry with a custom metric:
emitMetric('AgentRequests', 1);
log.info('agent_request', { conversationId, userId: user.userId });

emitMetric('RateLimitRejected', 1);
log.warn('rate_limit_rejected', { userId, count: current.count });

emitMetric('KnowledgeRetrievalLatency', latency, 'Milliseconds');
log.info('knowledge_retrieval', { query, resultCount, latencyMs: latency });

Locally,  Metrics  calls are paired with a structured log so the same data is visible during development; in a deployed environment, the same code maps to Amazon CloudWatch metrics and logs without modification.

Validation

✔ Unauthenticated request rejected (401)
✔ Customer sends a message — agent streams the response token by token
✔ Agent searches the knowledge base and returns a sourced answer
✔ Agent creates a ticket on escalation — appears in the agent queue live
✔ Customer creates a ticket manually — appears in the agent queue live
✔ Agent updates ticket status — realtime snapshot published
✔ Requests beyond the rate limit — rejected
✔ Concurrent rate-limit requests — no double-counting
✔ Conversation ownership — one user cannot read another user's conversation
✔ Oversized file upload — rejected
✔ Incorrect file extension — rejected
✔ Local restart — all ticket data remains


Takeaways

This track made clear that production-grade AI features require the same engineering discipline as any other backend system: optimistic concurrency for anything counted under load, ownership checks kept explicit and separate from authentication, TTL-based cleanup in place of extra scheduled jobs where possible, and tool-based grounding rather than relying on a model's unverified output.



Patterns That Carried Across All Three Levels

A small number of principles recurred at every level of the sprint, regardless of the application's complexity:
  • Derive identity from the authenticated session, never from client input. Applied to bookmark ownership in Level 1 and to conversation and ticket ownership in Level 3.
  • Use conditional writes for anything touched concurrently.  ifNotExists  for first-write-wins operations (vote reservation, rate-limit windows),  ifFieldEquals  for optimistic locking (poll revisions, rate-limit counters).
  • Treat Realtime as best-effort and the database as the source of truth. Every WebSocket channel across Levels 2 and 3 published complete, revisioned snapshots rather than deltas, and every client reloaded canonical state on reconnect.
  • Design background and repeated operations to be idempotent. The scheduled poll-closure job in Level 2 and the rate limiter in Level 3 both check current state before acting, so re-runs and retries never produce incorrect results.
  • Authorize at the API boundary, every time. Every protected method in all three tracks opened with  auth.requireAuth(context)  or an equivalent role check, in line with the sprint's stated ground rules.
All three applications ran entirely on local Block implementations under  npm run dev , with  DistributedTable  persisting to  .bb-data/  and the Level 3  Agent  block configured against a local model — with Amazon Bedrock as the corresponding managed service for a future deployment. No AWS account or cloud deployment was required to complete any of the three tracks.


Built as part of the Builders Skill Sprint — June 2026, AWS Blocks Sprint, under DevTools Month with the AWS User Group Madurai.
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