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

@greener-games/vite-deterministic-port

v1.0.2

Published

A Vite plugin to assign deterministic ports based on project name.

Readme

@greener-games/vite-deterministic-port

Vite TypeScript npm version npm downloads GitHub stars CI License: MIT

A Vite plugin that automatically assigns a stable, deterministic port to your project based on its name.

This ensures that every developer on your team uses the exact same localhost URL for a specific project, eliminating the "it works on my port 3000 but not yours" confusion. This is especially powerful for:

  • Micro-frontends: Ensuring each app always has its own dedicated port.
  • Webhook testing: Maintaining stable callback URLs for services like Stripe or GitHub.
  • Shared documentation: Referencing local dev URLs in team wikis that actually work for everyone.

Features

  • Zero Config: Automatically reads name from your package.json.
  • Team Consistency: Everyone gets the same port (e.g., http://localhost:52491) for the same project.
  • Informative: Logs the chosen port to the console on startup.
  • Customizable: Define your own port ranges and salts.
  • Smart Fallback: Attempts the deterministic port first and hunts for the next available port if occupied (configurable via strict).

Installation

npm install --save-dev @greener-games/vite-deterministic-port

Usage

Add it to your vite.config.ts:

import { defineConfig } from 'vite';
import deterministicPortPlugin from '@greener-games/vite-deterministic-port';

export default defineConfig({
  plugins: [
    deterministicPortPlugin()
  ]
});

Options

The plugin works out of the box, but you can customize its behavior:

| Option | Type | Default | Description | | :--- | :--- | :--- | :--- | | strict | boolean | false | If true, Vite fails immediately if the port is busy instead of hunting for the next available port. | | portSalt | string \| number | '' | Change this to force a new port if a collision occurs. | | minPort | number | 10000 | The minimum port number in the range. | | maxPort | number | 60000 | The maximum port number in the range. | | verbose | boolean | true | Log the port selection to the console. |

Example with Options

deterministicPortPlugin({
  strict: false, // Default is false; set true to prevent Vite from hunting for port + 1
  portSalt: 'v2',
  minPort: 3000,
  maxPort: 3999,
  verbose: true
})

Troubleshooting

Port Collision

In the rare event that two projects hash to the same port, simply provide a portSalt:

deterministicPortPlugin({ portSalt: 'resolve-collision' })

Port Already in Use

By default (strict: false), if the deterministic port is already occupied (e.g., running multiple instances of the same project), Vite will automatically hunt for the next open port (e.g. port + 1). If you require strict port enforcement where Vite fails rather than incrementing, set strict: true.

License

MIT