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

@nitro-bio/molstar-easy

v0.0.18

Published

collection of ui components

Readme

Molstar Easy

CI

Documentation

molstar-easy makes it simple to get started using molstar in react projects. It provides a bare-bones api that allows styling of the viewer and the loaded protein structures, as well as annotating specific regions of the protein via highlighting. Supports both PDB and mmCIF file formats.

Quickstart

npm i @nitro-bio/molstar-easy

PDB Format (default)

import { MoleculeViewer } from "@nitro-bio/molstar-easy";
export const Demo = () => {
  const highlight = {
    label: { text: "Red Annotation", hexColor: "#881337", scale: 1 },
    start: 14,
    end: 30,
  };
  const pdbUrl = "https://files.rcsb.org/download/1CRN.pdb";
  const [pdbStr, setPdbStr] = useState<string | null>(null);
  useEffect(
    function fetchPDB() {
      fetch(pdbUrl)
        .then((res) => res.text())
        .then((pdbStr) => setPdbStr(pdbStr));
    },
    [pdbUrl],
  );

  return (
    <div>
      {pdbStr && (
        <MoleculeViewer
          moleculePayloads={[
            {
              structureString: pdbStr,
              format: "pdb", // optional, defaults to 'pdb'
              highlights: [highlight],
              structureHexColor: "#7279df",
            },
          ]}
        />
      )}
    </div>
  );
};

mmCIF Format

import { MoleculeViewer } from "@nitro-bio/molstar-easy";
export const Demo = () => {
  const highlight = {
    label: { text: "Active Site", hexColor: "#dc2626", scale: 1.2 },
    start: 50,
    end: 65,
  };
  const mmcifUrl = "https://files.rcsb.org/download/1CRN.cif";
  const [mmcifStr, setMmcifStr] = useState<string | null>(null);
  useEffect(
    function fetchMmCIF() {
      fetch(mmcifUrl)
        .then((res) => res.text())
        .then((mmcifStr) => setMmcifStr(mmcifStr));
    },
    [mmcifUrl],
  );

  return (
    <div>
      {mmcifStr && (
        <MoleculeViewer
          moleculePayloads={[
            {
              structureString: mmcifStr,
              format: "mmcif",
              highlights: [highlight],
              style: { type: "ribbon" },
            },
          ]}
        />
      )}
    </div>
  );
};

Format Support

This library supports both PDB and mmCIF formats:

  • PDB: Traditional protein structure format, widely supported
  • mmCIF: Modern crystallographic information file format, preferred by PDB for large structures

Backward Compatibility

The pdbString property is deprecated but still supported for backward compatibility. It will be removed in v2.0. Please migrate to using structureString with the appropriate format property.

// ❌ Deprecated (but still works)
{
  pdbString: myPdbData
}

// ✅ Recommended
{
  structureString: myStructureData,
  format: "pdb" // or "mmcif"
}

Development

Scripts

This project uses pnpm as the package manager. Here's a list of available scripts:

Frequently Used in Local dev

  • dev: Runs Storybook development server on port 6006.
  • format:fix: Fixes code formatting issues using Prettier.
  • lint:fix: Fixes linting issues automatically.
  • build: Lints, builds the project, and generates CSS.
  • build-css: Builds and minifies Tailwind CSS.
  • test: Runs tests using Vitest.

CI

  • build:ci: Builds the project for CI environments.
  • build-storybook: Builds Storybook for production.
  • format: Checks code formatting using Prettier.
  • lint: Runs TypeScript compiler and ESLint.

Publishing/Library dev

  • publish: Publishes the package to NPM.
  • prepublishOnly: Runs linting, formatting, and build before publishing.
  • build:watch: Watches for changes and rebuilds the project.
  • test:watch: Runs tests in watch mode.

Usage

To run a script, use:

pnpm <script-name>

For example:

pnpm dev

This will start the Storybook development server.