npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

dyno-table

v2.3.3

Published

A TypeScript library to simplify working with DynamoDB

Downloads

200

Readme

dyno-table

A powerful, type-safe DynamoDB library for TypeScript that simplifies working with DynamoDB through intuitive APIs and comprehensive type safety.

npm version npm downloads License: MIT TypeScript

Why dyno-table?

  • Type Safety First - Full TypeScript support with compile-time error checking
  • Schema Validation - Built-in support for Zod, ArkType, Valibot, and other validation libraries
  • Semantic Queries - Write meaningful method names like getDinosaurBySpecies() instead of cryptic gsi1 references
  • Single-Table Design - Optimized for modern DynamoDB best practices
  • Repository Pattern - Clean, maintainable code architecture

Quick Start

npm install dyno-table @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb
import { z } from "zod";
import { defineEntity, createIndex, createQueries } from "dyno-table/entity";

const createQuery = createQueries<typeof dinosaurSchema._type>();

// 🦕 Define your dinosaur schema
const dinosaurSchema = z.object({
  id: z.string(),
  species: z.string(),
  period: z.enum(["triassic", "jurassic", "cretaceous"]),
  diet: z.enum(["herbivore", "carnivore", "omnivore"]),
  discoveryYear: z.number(),
  weight: z.number(),
});

// Create your entity with indexes for efficient queries
const DinosaurEntity = defineEntity({
  name: "Dinosaur",
  schema: dinosaurSchema,
  primaryKey: createIndex()
    .input(z.object({ id: z.string() }))
    .partitionKey(({ id }) => `DINO#${id}`)
    .sortKey(() => "PROFILE"),
  indexes: {
    byDiet: createIndex()
      .input(dinosaurSchema)
      .partitionKey(({ diet }) => `DIET#${diet}`)
      .sortKey(({ species }) => species),
  },
  queries: {
    getDinosaursByDiet: createQuery
      .input(z.object({ diet: z.enum(["herbivore", "carnivore", "omnivore"]) }))
      .query(({ input, entity }) =>
        entity.query({ pk: `DIET#${input.diet}` }).useIndex("byDiet")
      ),
  },
});

// Start using it!
const dinoRepo = DinosaurEntity.createRepository(table);

// Create a T-Rex
const tRex = await dinoRepo.create({
  id: "t-rex-1",
  species: "Tyrannosaurus Rex",
  period: "cretaceous",
  diet: "carnivore",
  discoveryYear: 1905,
  weight: 8000,
}).execute();

// Find all carnivores (efficient query using index!)
const carnivores = await dinoRepo.query
  .getDinosaursByDiet({ diet: "carnivore" })
  .execute();

That's it! You now have a fully type-safe, validated database with semantic queries.


Feature Overview

Entity Pattern (Recommended)

Schema-validated, semantic queries with business logic

// Get specific dinosaur
const tRex = await dinoRepo.get({ id: "t-rex-1" });

// Semantic queries
const cretaceousDinos = await dinoRepo.query
  .getDinosaursByPeriod({ period: "cretaceous" })
  .execute();

Complete Entity Guide →

Direct Table Operations

Low-level control for advanced use cases

// Direct DynamoDB access with query
const carnivoresInCretaceous = await table
  .query({ pk: "PERIOD#cretaceous" })
  .filter(op => op.eq("diet", "carnivore"))
  .execute();

Table Operations Guide →

Advanced Querying & Filtering

Complex business logic with AND/OR operations

// Find large herbivores from Jurassic period using query + filter
const conditions = await dinoRepo.query
  .getDinosaursByDiet({ diet: "herbivore" })
  .filter(op => op.and(
    op.eq("period", "jurassic"),
    op.gt("weight", 3000)
  ))
  .execute();

Advanced Queries Guide →

Batch Operations

Efficient bulk operations

// Get multiple dinosaurs at once
const dinos = await dinoRepo.batchGet([
  { id: "t-rex-1" },
  { id: "triceratops-1" },
  { id: "stegosaurus-1" }
]).execute();

// Bulk create carnivores
const batch = table.batchBuilder();

carnivores.forEach(dino =>
  dinoRepo.create(dino).withBatch(batch)
);

await batch.execute();

Batch Operations Guide →

Transactions

ACID transactions for data consistency

// Atomic dinosaur discovery
await table.transaction(tx => [
  dinoRepo.create(newDinosaur).withTransaction(tx),
  researchRepo.update(
    { id: "paleontologist-1" },
    { discoveriesCount: val => val.add(1) }
  ).withTransaction(tx),
]);

Transactions Guide →

Pagination & Memory Management

Handle large datasets efficiently

// Stream large datasets (memory efficient)
const allCarnivores = await dinoRepo.query
  .getDinosaursByDiet({ diet: "carnivore" })
  .execute();
for await (const dino of allCarnivores) {
  await processDiscovery(dino); // Process one at a time
}

// Paginated results
const paginator = dinoRepo.query
  .getDinosaursByDiet({ diet: "herbivore" })
  .paginate(50);
while (paginator.hasNextPage()) {
  const page = await paginator.getNextPage();
  console.log(`Processing ${page.items.length} herbivores...`);
}

Pagination Guide →

Schema Validation

Works with any Standard Schema library

// Zod (included)
const dinoSchema = z.object({
  species: z.string().min(3),
  weight: z.number().positive(),
});

// ArkType
const dinoSchema = type({
  species: "string>2",
  weight: "number>0",
});

// Valibot
const dinoSchema = v.object({
  species: v.pipe(v.string(), v.minLength(3)),
  weight: v.pipe(v.number(), v.minValue(1)),
});

Schema Validation Guide →

Performance Optimization

Built for scale

// Use indexes for fast lookups
const jurassicCarnivores = await dinoRepo.query
  .getDinosaursByPeriodAndDiet({
    period: "jurassic",
    diet: "carnivore"
  })
  .useIndex("period-diet-index")
  .execute();

// Efficient filtering with batchGet for known species
const largeDinos = await dinoRepo.batchGet([
  { id: "t-rex-1" },
  { id: "triceratops-1" },
  { id: "brontosaurus-1" }
]).execute();

Performance Guide →


Documentation

Getting Started

Core Concepts

Features

Advanced Topics

Examples


Links