ThailerL/pocket-region

AWS services like S3, DynamoDB, and Lambda inside Node or a browser tab, reached with the ordinary AWS SDK

TypeScript

1

140 commits

updated Sep 18, 2026

See the code
aws
aws-emulator
browser
testing

See what people are saying (1)

SourceMessageScoreDate

Pocket Region: S3, Lambda, DynamoDB, and more in Node or a browser tab, with the real AWS SDK (r/SideProject)

Over the past month I've been working on a project that needed an AWS region running in the browser. I thought it might be useful to other people on its own, so I ended up pulling it out as Pocket Region, a separate MIT-licensed library. Lambdas run as child processes in Node or as Web Workers in…

1

Sep 18, 2026

README

Pocket Region

Pocket Region runs AWS services like S3, DynamoDB, and Lambda inside your Node process or a browser tab, and you call them with the ordinary AWS SDK. Your SDK calls reach the emulator as function calls, without a socket, so there's no container to start and no server to reach. Lambda handlers run in child processes or Web Workers.

import { clientConfig, createRegion } from 'pocket-region/node';
import { S3Client, CreateBucketCommand, PutObjectCommand } from '@aws-sdk/client-s3';

const region = await createRegion();
const s3 = new S3Client(clientConfig(region));

await s3.send(new CreateBucketCommand({ Bucket: 'photos' }));
await s3.send(new PutObjectCommand({ Bucket: 'photos', Key: 'cat.txt', Body: 'meow' }));

await region.stop();

It needs WebAssembly JSPI: Node 24.20 or later, or a browser that supports it.

The AWS APIs come from MiniStack, a Python AWS emulator that runs here under Pyodide.

In Node, a region is ready in about half a second. Resetting a region to empty takes about a millisecond for a typical test, so every test can start clean without booting a new one.

Read the docs at pocket-region.dev/docs, where you can edit and run the examples in your browser tab, or try the demo.

Features

  • Node and the browser: the same region runs in a Node process or a page, which loads the emulator from jsDelivr with no files to copy.
  • Services: CloudWatch Logs, DynamoDB, EventBridge, Kinesis, KMS, S3, Secrets Manager, SNS, SQS, and SSM Parameter Store behave as they do in MiniStack, with a runnable example for each. Others, such as RDS and ECS, answer as stubs with nothing running behind them, or are untested here.
  • Lambda: Node functions run from a zipped deployment package, in child processes or Web Workers, with event source mappings.
  • Resets and saves: empty a region between tests, or save its state to a store and boot from it later.
  • Clients: requestHandler for AWS SDK clients, and serve for anything that needs an endpoint.
  • The aws CLI: awsCli runs aws commands and returns their output, for tests or an AWS console in your own page.
  • Examples in your docs: add a Run button to code examples written for real AWS. createRunner runs them in the reader's tab without any Pocket Region setup in the example.

In a real app

Glass Garden runs on Pocket Region. It opens on a working project, a load balancer in front of an instance group, and you can drag S3, SQS, DynamoDB, and Lambda onto the canvas and watch requests move through real code. Pocket Region started there as its AWS region and was pulled out so the same region can run in a test or any other page.

Contributors

ThailerL

140 commits

ThailerL/pocket-region

AWS services like S3, DynamoDB, and Lambda inside Node or a browser tab, reached with the ordinary AWS SDK

TypeScript

1

140 commits

updated Sep 18, 2026

See the code
aws
aws-emulator
browser
testing

See what people are saying (1)

SourceMessageScoreDate

Pocket Region: S3, Lambda, DynamoDB, and more in Node or a browser tab, with the real AWS SDK (r/SideProject)

Over the past month I've been working on a project that needed an AWS region running in the browser. I thought it might be useful to other people on its own, so I ended up pulling it out as Pocket Region, a separate MIT-licensed library. Lambdas run as child processes in Node or as Web Workers in…

1

Sep 18, 2026

README

Pocket Region

Pocket Region runs AWS services like S3, DynamoDB, and Lambda inside your Node process or a browser tab, and you call them with the ordinary AWS SDK. Your SDK calls reach the emulator as function calls, without a socket, so there's no container to start and no server to reach. Lambda handlers run in child processes or Web Workers.

import { clientConfig, createRegion } from 'pocket-region/node';
import { S3Client, CreateBucketCommand, PutObjectCommand } from '@aws-sdk/client-s3';

const region = await createRegion();
const s3 = new S3Client(clientConfig(region));

await s3.send(new CreateBucketCommand({ Bucket: 'photos' }));
await s3.send(new PutObjectCommand({ Bucket: 'photos', Key: 'cat.txt', Body: 'meow' }));

await region.stop();

It needs WebAssembly JSPI: Node 24.20 or later, or a browser that supports it.

The AWS APIs come from MiniStack, a Python AWS emulator that runs here under Pyodide.

In Node, a region is ready in about half a second. Resetting a region to empty takes about a millisecond for a typical test, so every test can start clean without booting a new one.

Read the docs at pocket-region.dev/docs, where you can edit and run the examples in your browser tab, or try the demo.

Features

  • Node and the browser: the same region runs in a Node process or a page, which loads the emulator from jsDelivr with no files to copy.
  • Services: CloudWatch Logs, DynamoDB, EventBridge, Kinesis, KMS, S3, Secrets Manager, SNS, SQS, and SSM Parameter Store behave as they do in MiniStack, with a runnable example for each. Others, such as RDS and ECS, answer as stubs with nothing running behind them, or are untested here.
  • Lambda: Node functions run from a zipped deployment package, in child processes or Web Workers, with event source mappings.
  • Resets and saves: empty a region between tests, or save its state to a store and boot from it later.
  • Clients: requestHandler for AWS SDK clients, and serve for anything that needs an endpoint.
  • The aws CLI: awsCli runs aws commands and returns their output, for tests or an AWS console in your own page.
  • Examples in your docs: add a Run button to code examples written for real AWS. createRunner runs them in the reader's tab without any Pocket Region setup in the example.

In a real app

Glass Garden runs on Pocket Region. It opens on a working project, a load balancer in front of an instance group, and you can drag S3, SQS, DynamoDB, and Lambda onto the canvas and watch requests move through real code. Pocket Region started there as its AWS region and was pulled out so the same region can run in a test or any other page.

Contributors

ThailerL

140 commits

Languages

TypeScript

73.8%

MDX

10.2%

Astro

5.6%

JavaScript

5.1%

Python

3.7%

CSS

1.6%