# Port from Project Name for Raycast

URL: https://www.raycast.com/sopheakvethya_syna/port-from-project-name

> Generate a unique, repeatable 4-digit development port from a project name, edit ports and keep a port history.

- Install: raycast://extensions/sopheakvethya_syna/port-from-project-name
- Author: [Sopheakvethya Syna](https://www.raycast.com/sopheakvethya_syna)
- Installs: 79
- Platforms: Windows, macOS
- Categories: Developer Tools
- Updated: 2026-11-17
- Source: https://github.com/raycast/extensions/tree/480c8790efdca370fda96f8f95bc914604e362d5/extensions/port-from-project-name/

## Commands

- **Generate Port**: Generate a unique 4 digit port for a given project name
- **Port History**: View and manage generated port history

## README

### Port From Project Name

A Raycast extension that generates unique 4-digit ports for your development projects based on the project name.

#### Features

- **Deterministic Port Generation**: Same project name always generates the same port
- **Edit Ports**: Manually override any port to your preferred value
- **Port History**: Keeps track of all generated ports with timestamps
- **Quick Access**: Generate ports directly from Raycast with a simple command
- **History Management**: View, search, and manage your port history

#### Installation

1. Install the extension from the Raycast Store
2. No additional setup or configuration required

#### Usage

##### Generate Port

Use the "Generate port" command in Raycast:

1. Open Raycast
2. Type "Generate port"
3. Enter your project name as an argument
4. The extension will generate and display a unique port for that project

**Example:**
```
Generate port my-react-app
```
This will generate a consistent port number for the "my-react-app" project.

##### View Port History

Use the "Port History" command to:

- View all previously generated ports
- See when each port was first created and last updated
- Search through your port history
- Copy port numbers to clipboard
- **Edit ports** to any value you prefer (use ⌘E or ctrl+E or the "Edit Port" action)
- Delete individual entries or clear all history

When you edit a port, it becomes "locked" - future generations for other projects will automatically avoid colliding with your custom port.

#### How It Works

The extension uses a deterministic algorithm to generate ports:

1. Creates an MD5 hash of the project name
2. Converts the first 8 characters of the hash to an integer
3. Maps the result to a port number in the range 1000-9999
4. Stores the mapping in local history for future reference

**Port Range:** 1000-9999 (4-digit ports commonly used for development)

#### Important Notes

- **Deterministic**: The same project name always generates the same port
- **Collision possibility**: Different project names may occasionally generate the same port. With 9,000 possible ports (1000-9999), collisions are rare but possible in practice (~42% collision probability with 100 projects)
- **Edited ports are protected**: Once you manually edit a port, it won't be overwritten by future generations
- **Smart collision avoidance**: If a generated port would conflict with a manually edited port, it automatically shifts to the next available port

#### Privacy

- All data is stored locally on your device
- No information is sent to external servers
- Project names and generated ports are only used locally

#### Development

This extension is built with:
- TypeScript
- Raycast API
- React hooks for state management
- Local storage for history persistence

#### License

MIT License - feel free to use and modify as needed.

#### Support

If you encounter any issues or have feature requests, please check the extension's page in Raycast for updates and support options.
