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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zxsylph/dbml-formatter

v1.0.16

Published

A powerful and flexible formatter for [DBML (Database Markup Language)](https://dbml.dbdiagram.io/home/) files. This tool helps keep your DBML schemas clean, consistent, and readable by applying standard formatting rules, alignment, and optional enhanceme

Readme

@zxsylph/dbml-formatter

A powerful and flexible formatter for DBML (Database Markup Language) files. This tool helps keep your DBML schemas clean, consistent, and readable by applying standard formatting rules, alignment, and optional enhancements.

Features

  • Standard Formatting: Applies consistent spacing and indentation to tables, fields, indexes, and relationships.
  • Alignment:
    • Automatically aligns field data types for better readability.
    • Aligns field settings (e.g., [pk, increment]) for a clean columnar look.
  • Field Sorting (Optional): Sorts fields within groups alphabetically.
  • Note Management (Optional): Automatically adds empty notes to fields and tables if they are missing.
  • Batch Processing: Supports formatting individual files or entire directories recursively.
  • Dry Run: Preview changes without modifying files.

Installation

You can use the formatter directly via npx without installation:

npx @zxsylph/dbml-formatter <file-or-options>

Or install it globally:

npm install -g @zxsylph/dbml-formatter

Usage

Format a Single File

Prints the formatted result to stdout.

npx @zxsylph/dbml-formatter schema.dbml

Format a Directory

Formats all .dbml files in the specified directory (and subdirectories) in place.

npx @zxsylph/dbml-formatter --folder ./database

Options & Flags

| Flag | Description | | ----------------- | ---------------------------------------------------------------------------------------------- | | --folder <path> | Specifies a directory to recursively find and format .dbml files. Updates files in place. | | --dry-run | Use with --folder to preview formatting changes in the console instead of overwriting files. | | --order-field | Sorts fields within their logical groups (separated by blank lines) in ascending order. | | --add-note | Automatically adds Note: '' to tables and fields that don't have one. |

Examples

1. Basic file formatting (output to console):

npx @zxsylph/dbml-formatter schema.dbml > formatted_schema.dbml

2. Format an entire project directory:

npx @zxsylph/dbml-formatter --folder ./src/db

3. Format with field sorting and extra notes:

npx @zxsylph/dbml-formatter --folder ./src/db --order-field --add-note

4. Preview changes for a folder:

npx @zxsylph/dbml-formatter --folder ./src/db --dry-run

Formatting Rules

The formatter applies the following styles:

  • Indentation: 2 spaces.
  • Spacing: Removes extra empty lines inside table bodies.
  • Alignment: Vertically aligns data types and column settings [...].
  • Hoisting: Moves table-level notes to the top of the table definition.

License

ISC