pkg-porter

A custom proxy server for private NPM registries

Features

  • Proxy access to private NPM registries
  • Local caching for improved performance
  • Optional logging and database usage
  • Configurable through environment variables

Setup

To get started, follow these steps:

  1. Clone the repository: git clone https://github.com/muratpolatozkan/pkg-porter.git
  2. Navigate to the project directory: cd pkg-porter
  3. Install the dependencies: npm install
  4. Create a .env file with the necessary configuration:
                    # Registry URL and credentials
                    REGISTRY_URL=https://your-registry-url
                    USERNAME=your-username
                    PASSWORD=your-password
                 
                    # Cache settings
                    USE_CACHE=true
                 
                    # Server settings
                    URL=http://localhost
                    PORT=8081
                 
                    # Database usage (set to true if you want to use the database)
                    USE_DB=true
                 
                    # Logger usage (set to true if you want to enable logging)
                    USE_LOGGER=true
                
  • Start the server: npm start
  • Usage

    Once the server is running, you can use the proxy server to access packages from your private NPM registry. For example:

    http://localhost:8081/@scope/package@version/path/to/file
                    

    Replace @scope/package with your package name, version with the package version, and path/to/file with the path to the specific file you need.