NPR provides a minimal NPM-compatible package registry with support of multiple database and storage providers. NPR is designed to be small and fast, allowing for easy deployment to cloud. NPR is not a proxy registry, it doesn't support caching and redirecting requests to an upstream registry. If you require such functionality, consider using npm-cache-proxy or Verdaccio.
- Publish package
- Install package
- Unpublish package
- Organizations
- Access control
Databases are used to store package metadata.
- Memory
- MongoDB
Storages are used to store package tarballs.
- Memory
- MongoDB
Feel free to open an issue or provide a pull request if you need a support for any other feature, database or storage provider.
Docker is the preferred way to use NPR.
docker run -p 8080:8080 pkgems/npm-package-registry
Alternatively, binaries of different platforms can be found on Releases section.
Configuration can be managed either by CLI flags or environment variables.
Options | Env | Default | Description |
---|---|---|---|
--listen <address> |
NPR_LISTEN_ADDRESS |
locahost:8080 |
Address to listen |
--silent |
NPR_SILENT |
0 |
Disable logs |
--database <name> |
NPR_DATABASE |
memory |
Database to use (list) |
--storage <name> |
NPR_STORAGE |
memory |
Storage to use (list) |
NPR provides registry
, adapter
and handler
go packages that can be used programmatically. Docs are available on godoc.org.
package main
import (
"log"
"net/http"
"github.com/pkgems/npm-package-registry/adapter"
"github.com/pkgems/npm-package-registry/handler"
"github.com/pkgems/npm-package-registry/registry"
)
func main() {
core, err := registry.NewCore(registry.CoreConfig{
Database: adapter.NewDatabaseMemory(),
Storage: adapter.NewStorageMemory(),
})
if err != nil {
log.Fatal(err)
}
server := http.Server{
Handler: handler.Handler(core),
Addr: "localhost:8080",
}
server.ListenAndServe()
}
...