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

samaid

v0.0.2

Published

Magically transform AWS SAM templates to Mermaid diagrams

Downloads

6

Readme

samaid

🪄 Magically transform AWS SAM templates to Mermaid diagrams 🪄

Build Status

Ever wanted to quickly and painlessly just magically get Mermaid templates from your AWS SAM templates? That's what samaid does for you.

samaid supports both being run as a Node module and as a CLI tool.

Name

Why the name?! SAM + Mermaid = samaid.

Usage

First, install the module with npm install samaid.

Node module example

// ES5 format
const { Samaid } = require('samaid');
// ES6 format
import { Samaid } from 'samaid';

// By default, samaid returns the Mermaid data
const mermaidDiagram = new Samaid(filePath).generate();

// Write the file to disk by passing an optional output path
new Samaid(filePath).generate(outputPath);

// Update your README with the diagram data (see more below)
new Samaid(filePath).generate(outputPath, true);

CLI tool examples

npx samaid

# Update README
npx samaid --readme

# Output to a file
npx samaid --output my_diagram.mmd
npx samaid -o my_diagram.mmd

# Output to a file
npx samaid --template my_template.yml
npx samaid -t my_template.yml

All commands can be combined.

If you do not provide a template name, then template.yml will be used.

An output file name must use the .mmd ending.

Infrastructure support

The infra support is still limited and is first and foremost adapted for common needs in my own contexts. It currently supports DynamoDB (AWS::DynamoDB::Table), Lambda functions (AWS::Serverless::Function), HTTP APIs (AWS::Serverless::HttpApi), and S3 (AWS::S3::Bucket).

Defaults and assumptions

If you want to have your README.md file updated with the diagram, the area between the start and end markers <!-- START DIAGRAM --> and <!-- END DIAGRAM --> will be used.

Example

samaid uses a bit of test data for a simple service which converts to this Mermaid diagram:

graph TD
  subgraph API
    HttpApi
  end
  subgraph DynamoDB
    example-api
  end
  subgraph Functions
    Demo --> |PutItem| example-api
    Demo --> |Query| example-api
    HttpApi --> |GET| Demo
    Demo2 --> |PutItem| example-api
    Demo2 --> |Query| example-api
    Demo2
  end
  subgraph EventBridge
    bloop --> |Triggers| Demo2
  end

Much more complex stacks are supported too, as long as the infrastructure is supported (see above).

License

MIT. See LICENSE file.