cnpmjs.org
‼️ ‼️ ‼️ ‼️ DEPRECATED, please use https://github.com/cnpm/cnpmcore ‼️ ‼️ ‼️ ‼️
Top Related Projects
A lightweight Node.js private proxy registry
Sonatype Nexus Repository Open-source codebase mirror
A Git platform powered by Scala with easy installation, high extensibility & GitHub API compatibility
Quick Overview
cnpmjs.org is an open-source npm registry and web interface, designed to be a private npm registry for organizations or individuals. It provides a complete solution for hosting and managing npm packages, including package storage, user management, and a web interface for package browsing and management.
Pros
- Easy to set up and deploy, with support for various databases (MySQL, SQLite, PostgreSQL)
- Supports both private and public package hosting
- Provides a web interface for package management and browsing
- Syncs with the official npm registry, allowing access to public packages
Cons
- Limited documentation, especially for advanced configurations
- May require additional setup for production-level security and scalability
- Less active development compared to other npm registry alternatives
- Some reported issues with package syncing and versioning in complex scenarios
Getting Started
To set up cnpmjs.org:
- Install Node.js and MySQL (or another supported database)
- Clone the repository:
git clone https://github.com/cnpm/cnpmjs.org.git
- Install dependencies:
cd cnpmjs.org npm install
- Copy the example configuration:
cp config/index.js config/config.js
- Edit
config/config.js
to set your database connection and other options - Start the registry and web interface:
npm run start
The registry will be available at http://localhost:7001
, and the web interface at http://localhost:7002
.
Competitor Comparisons
A lightweight Node.js private proxy registry
Pros of Verdaccio
- Lightweight and easy to set up, with minimal configuration required
- Supports multiple storage backends, including local filesystem and cloud storage
- Active development and community support, with frequent updates and improvements
Cons of Verdaccio
- Limited built-in authentication options compared to cnpmjs.org
- Fewer advanced features for large-scale enterprise deployments
- May require additional plugins for certain functionalities
Code Comparison
Verdaccio configuration (yaml):
storage: ./storage
auth:
htpasswd:
file: ./htpasswd
uplinks:
npmjs:
url: https://registry.npmjs.org/
packages:
'@*/*':
access: $all
publish: $authenticated
'**':
proxy: npmjs
cnpmjs.org configuration (js):
module.exports = {
registryPort: 7001,
webPort: 7002,
enablePrivate: true,
scopes: ['@company'],
database: {
db: 'cnpmjs_test',
username: 'root',
password: '',
},
};
Both Verdaccio and cnpmjs.org are popular npm registry solutions, but they cater to different use cases. Verdaccio is more suitable for smaller teams and projects, offering simplicity and ease of use. cnpmjs.org, on the other hand, provides more advanced features and is better suited for large-scale enterprise deployments. The choice between the two depends on specific project requirements and team size.
Sonatype Nexus Repository Open-source codebase mirror
Pros of Nexus Public
- More comprehensive repository management: Supports multiple package formats (Maven, npm, Docker, etc.)
- Advanced security features: Built-in vulnerability scanning and license compliance
- Scalable architecture: Designed for enterprise-level deployments
Cons of Nexus Public
- Higher resource requirements: Needs more system resources to run effectively
- Steeper learning curve: More complex setup and configuration process
- Proprietary components: Some features require a paid license
Code Comparison
CNPMJS.org (config.js):
module.exports = {
registryPort: 7001,
webPort: 7002,
bindingHost: '127.0.0.1',
database: {
db: 'cnpmjs_test',
username: 'root',
password: '',
},
};
Nexus Public (nexus.properties):
application-port=8081
application-host=0.0.0.0
nexus-context-path=/
nexus-edition=nexus-pro-edition
nexus-features=\
nexus-pro-feature
Both repositories serve as package management solutions, but Nexus Public offers a more robust and feature-rich platform suitable for enterprise environments. CNPMJS.org, on the other hand, is a simpler, open-source alternative focused primarily on npm package management. The code snippets demonstrate the configuration differences, with Nexus Public having a more extensive setup process.
A Git platform powered by Scala with easy installation, high extensibility & GitHub API compatibility
Pros of GitBucket
- Written in Scala, offering better performance and scalability
- Provides a more GitHub-like interface and feature set
- Supports plugins for extended functionality
Cons of GitBucket
- Less focused on npm package management
- May require more resources to run due to its broader feature set
- Steeper learning curve for users familiar with npm-specific tools
Code Comparison
GitBucket (Scala):
def getRepositoryInfo(owner: String, repository: String): Option[RepositoryInfo] = {
getAccountByUserName(owner).flatMap { account =>
LockUtil.lock(s"${account.userName}/${repository}") {
getRepository(account.userName, repository)
}
}
}
cnpmjs.org (JavaScript):
exports.getPackage = function* (name, version) {
const pkg = yield Package.findOne({
name: name,
version: version
});
if (!pkg) {
return null;
}
return pkg;
};
GitBucket offers a more comprehensive Git repository management system with a focus on providing a GitHub-like experience. It includes features such as issue tracking, pull requests, and wiki functionality. On the other hand, cnpmjs.org is specifically designed for npm package management and registry hosting, making it more suitable for JavaScript developers working with npm packages. The code comparison highlights the different languages and approaches used by each project, with GitBucket using Scala for better performance and cnpmjs.org using JavaScript for easier integration with npm ecosystem.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
â¼ï¸ â¼ï¸ â¼ï¸ â¼ï¸ DEPRECATED, please use https://github.com/cnpm/cnpmcore instead â¼ï¸ â¼ï¸ â¼ï¸ â¼ï¸
â¼ï¸ â¼ï¸ â¼ï¸ â¼ï¸ DEPRECATED, please use https://github.com/cnpm/cnpmcore instead â¼ï¸ â¼ï¸ â¼ï¸ â¼ï¸
â¼ï¸ â¼ï¸ â¼ï¸ â¼ï¸ DEPRECATED, please use https://github.com/cnpm/cnpmcore instead â¼ï¸ â¼ï¸ â¼ï¸ â¼ï¸
cnpmjs.org
Description
Private npm registry and web for Enterprise, base on koa, MySQL and Simple Store Service.
Our goal is to provide a low cost maintenance, easy to use, and easy to scale solution for private npm.
What can you do with cnpmjs.org
?
- Build a private npm for your own enterprise. (alibaba is using
cnpmjs.org
now) - Build a npm mirror. (we use it to build a mirror in China: https://npmmirror.com/)
- Use the private npm service provided by Alibaba Cloud DevOps which build with cnpm. https://packages.aliyun.com/
Features
- Support "scoped" packages: npm/npm#5239
- Support CORS
- Simple to deploy: only need
mysql
and a simple store system. - Low cost and easy maintenance:
package.json
info can store in MySQL, MariaDB, SQLite or PostgreSQL. tarball(tgz file) can store in Amazon S3 or other object storage service. - Automatic synchronization: automatically sync from any registry specified. support two sync modes:
- Sync all modules from upstream
- Only sync the modules after first access.
- Manual synchronization: automatic synchronization may has little delay. you can sync manually on web page.
- Customized client: we provide a client cnpm
to extend
npm
with more features(sync
command, gzip support). And it is easy to wrap for your own registry which build withcnpmjs.org
. - Compatible with npm client: you can use the official npm client with
cnpmjs.org
. you only need to change the registry in client config. - Support http_proxy: if you're behind a firewall, you can provide a http proxy for cnpmjs.org.
Docs
- How to deploy
- cnpm client: cnpm,
npm install -g cnpm
- Sync packages through
http_proxy
- Migrating from 1.x to 2.x
- New features in 2.x.
- wiki
Develop on your local machine
Dependencies
- node >= 8.0.0
- Databases: only required one type
Clone code and run test
# clone from git
$ git clone https://github.com/cnpm/cnpmjs.org.git
# install dependencies
$ make install
# test
$ make test
# coverage
$ make test-cov
# update dependencies
$ make autod
# start server with development mode
$ make dev
Dockerized cnpmjs.org Installation Guide
Cnpmjs.org shipped with a simple but pragmatic Docker Compose configuration.With the configuration, you can set up a MySQL backend cnpmjs.org instance by executing just one command on Docker installed environment.
Preparation
- Install Docker
- Install Docker Compose (Docker for Mac, Docker for Windows include Docker Compose, so most Mac and Windows users do not need to install Docker Compose separately)
- (Optional) Speed up Docker images downloading by setting up Docker images download accelerator
Dockerized cnpmjs.org control command
Make sure your current working directory is the root of this GitHub repository.
Run dockerized cnpmjs.org
$docker-compose up
This command will build a Docker image using the current code of repository. Then set up a dockerized MySQL instance with data initialized. After Docker container running, you can access your cnpmjs.org web portal at http://127.0.0.1:7002 and npm register at http://127.0.0.1:7001.
Run cnpmjs.org in the backend
$docker-compose up -d
Rebuild cnpmjs.org Docker image
$docker-compose build
Remove current dockerized cnpmjs.org instance
The current configuration set 2 named Docker Volume for your persistent data. If you haven't change the repository directory name, them will be "cnpmjsorg_cnpm-files-volume" & "cnpmjsorg_cnpm-db-volume".
Be Careful, the following commands will remove them.
$docker-compose rm
$docker volume rm cnpmjsorg_cnpm-files-volume
$docker volume rm cnpmjsorg_cnpm-db-volume
You can get more information about your data volumes using the below commands:
$docker volume ls // list all of your Docker volume
$docker volume inspect cnpmjsorg_cnpm-files-volume
$docker volume inspect cnpmjsorg_cnpm-db-volume
How to contribute
- Clone the project
- Checkout a new branch
- Add new features or fix bugs in the new branch
- Make a pull request and we will review it ASAP
Tips: make sure your code is following the node-style-guide.
Sponsors
License
Contributors
This project follows the git-contributor spec, auto updated at Sun Mar 20 2022 09:50:54 GMT+0800
.
Top Related Projects
A lightweight Node.js private proxy registry
Sonatype Nexus Repository Open-source codebase mirror
A Git platform powered by Scala with easy installation, high extensibility & GitHub API compatibility
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot