Skip to content

Repository files navigation

Chat Agent on AWS Blocks

A streaming AI chat agent built on AWS Blocks — username/password auth, per-user conversation history, and token-by-token responses. Runs fully locally with no AWS account.

Quick start

Requires Node.js ≥ 20.19 and pnpm.

pnpm install
pnpm dev

Open http://localhost:3000, create an account, and start chatting.

Locally the agent replies with a built-in canned mock (no setup, no cost). For real responses, run Ollama — the agent picks it up automatically:

ollama serve
ollama pull llama3.1:8b

Project structure

Path Purpose
aws-blocks/index.ts Backend (IFC): Scope, AuthBasic, Agent, ApiNamespace
src/lib/ Framework boundary — auth and chat services (no React)
src/hooks/ Logic — useAuth, useAuthForm, useAgentChat
src/components/ UI — AuthForm, Chat, shadcn primitives under ui/
src/App.tsx App shell

Scripts

Command Description
pnpm dev API + web dev servers
pnpm typecheck tsc --noEmit
pnpm check Biome lint + format (check:fix to apply)
pnpm knip Find unused files, dependencies, and exports
pnpm build Production build

Deploy (optional)

Requires AWS credentials and a CDK-bootstrapped account. The same code that runs locally deploys unchanged — the agent runs on Amazon Bedrock.

pnpm sandbox  # fast, ephemeral deploy for testing
pnpm deploy   # full production deploy

Infrastructure as code

The backend is infrastructure-from-code: the Blocks in aws-blocks/index.ts synthesize to AWS CDK / CloudFormation. Generate the template without deploying:

pnpm dlx cdk synth

Customize or add raw CDK resources in aws-blocks/index.cdk.ts.

About

A streaming AI chat agent built on AWS Blocks

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages