# @cocalc/hub

> CoCalc: Backend webserver component

Latest version **1.120.6** (published 2023-01-04) · SEE LICENSE.md license · 0 weekly downloads

## Install

```sh
npm install @cocalc/hub
pnpm add @cocalc/hub
yarn add @cocalc/hub
bun add @cocalc/hub
```

Provides the commands `cocalc-hub-server`, `cocalc-hub-stripe-sync`, `cocalc-hub-stats-updater`, `cocalc-hub-delete-projects`, `cocalc-hub-maintenance-blobs`, `cocalc-hub-maintenance-expired`, `cocalc-hub-maintenance-syncstrings`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.120.6 |
| Published | 2023-01-04 |
| First published | 2021-08-03 |
| Weekly downloads | 0 |
| License | SEE LICENSE.md |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 66 |
| Unpacked size | 1.6 MB |
| Known vulnerabilities | 0 (+29 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1288 |
| Author | SageMath, Inc. |
| Maintainers | wstein, hasch |
| Keywords | python, sage, sagemath, latex, terminal, web, ide, math, mathematics |

## Links

- npm: https://www.npmjs.com/package/@cocalc/hub
- Repository: https://github.com/sagemathinc/cocalc
- Homepage: https://github.com/sagemathinc/cocalc/tree/master/src/packages/hub
- Issues: https://github.com/sagemathinc/cocalc/issues
- npm.io page: https://npm.io/package/@cocalc/hub

## Dependencies (66)

- [nyc](https://npm.io/package/nyc.md) ^15.1.0
- [cors](https://npm.io/package/cors.md) ^2.8.5
- [mime](https://npm.io/package/mime.md) ^1.3.4
- [next](https://npm.io/package/next.md) 12.3.4
- [read](https://npm.io/package/read.md) ^1.0.7
- [temp](https://npm.io/package/temp.md) ^0.9.4
- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [async](https://npm.io/package/async.md) ^1.5.2
- [debug](https://npm.io/package/debug.md) ^4.3.2
- [jsdom](https://npm.io/package/jsdom.md) ^16.2.2
- [react](https://npm.io/package/react.md) ^17.0.2
- [jquery](https://npm.io/package/jquery.md) ^3.6.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [mkdirp](https://npm.io/package/mkdirp.md) ^1.0.4
- [primus](https://npm.io/package/primus.md) ^8.0.6
- [rimraf](https://npm.io/package/rimraf.md) ^2.4.4
- [blocked](https://npm.io/package/blocked.md) ^1.1.0
- [cookies](https://npm.io/package/cookies.md) ^0.8.0
- [express](https://npm.io/package/express.md) ^4.17.1
- [saml2js](https://npm.io/package/saml2js.md) ^0.1.2
- [awaiting](https://npm.io/package/awaiting.md) ^3.0.0
- [bindings](https://npm.io/package/bindings.md) ^1.3.0
- [passport](https://npm.io/package/passport.md) ^0.6.0
- [commander](https://npm.io/package/commander.md) ^7.2.0
- [immutable](https://npm.io/package/immutable.md) ^3.8.2
- [lru-cache](https://npm.io/package/lru-cache.md) ^6.0.0
- [react-dom](https://npm.io/package/react-dom.md) ^17.0.2
- [uglify-js](https://npm.io/package/uglify-js.md) ^3.14.1
- [validator](https://npm.io/package/validator.md) ^13.6.0
- [basic-auth](https://npm.io/package/basic-auth.md) ^2.0.1
- [bottleneck](https://npm.io/package/bottleneck.md) ^2.19.5
- [dot-object](https://npm.io/package/dot-object.md) ^2.1.3
- [http-proxy](https://npm.io/package/http-proxy.md) ^1.18.1
- [nodemailer](https://npm.io/package/nodemailer.md) ^6.7.0
- [random-key](https://npm.io/package/random-key.md) ^0.3.2
- [underscore](https://npm.io/package/underscore.md) ^1.12.1
- [@cocalc/cdn](https://npm.io/package/@cocalc/cdn.md) ^1.15.1
- [@types/uuid](https://npm.io/package/@types/uuid.md) ^8.3.1
- [compression](https://npm.io/package/compression.md) ^1.7.4
- [prom-client](https://npm.io/package/prom-client.md) ^13.0.0
- [serve-index](https://npm.io/package/serve-index.md) ^1.9.1
- [@cocalc/next](https://npm.io/package/@cocalc/next.md) ^0.103.5
- [@cocalc/util](https://npm.io/package/@cocalc/util.md) ^1.76.5
- [@types/react](https://npm.io/package/@types/react.md) ^17.0.33
- [parse-domain](https://npm.io/package/parse-domain.md) ^5.0.0
- [cookie-parser](https://npm.io/package/cookie-parser.md) ^1.4.3
- [password-hash](https://npm.io/package/password-hash.md) ^1.2.2
- [sanitize-html](https://npm.io/package/sanitize-html.md) ^2.3.2
- [@cocalc/assets](https://npm.io/package/@cocalc/assets.md) ^1.10.1
- [@cocalc/server](https://npm.io/package/@cocalc/server.md) ^0.44.5
- [@cocalc/static](https://npm.io/package/@cocalc/static.md) ^1.136.7
- [@types/express](https://npm.io/package/@types/express.md) ^4.17.13
- [require-reload](https://npm.io/package/require-reload.md) ^0.2.2
- [@cocalc/backend](https://npm.io/package/@cocalc/backend.md) ^1.21.1
- [express-session](https://npm.io/package/express-session.md) ^1.10.4
- [@cocalc/database](https://npm.io/package/@cocalc/database.md) ^0.35.8
- [@cocalc/frontend](https://npm.io/package/@cocalc/frontend.md) ^1.102.7
- [@sendgrid/client](https://npm.io/package/@sendgrid/client.md) ^7.4.6
- [@types/lru-cache](https://npm.io/package/@types/lru-cache.md) ^5.1.1
- [@types/nodemailer](https://npm.io/package/@types/nodemailer.md) ^6.4.4
- [async-await-utils](https://npm.io/package/async-await-utils.md) ^3.0.1
- [sql-string-escape](https://npm.io/package/sql-string-escape.md) ^1.1.6
- [safe-json-stringify](https://npm.io/package/safe-json-stringify.md) ^1.2.0
- [json-stable-stringify](https://npm.io/package/json-stable-stringify.md) ^1.0.1
- [@passport-next/passport-oauth2](https://npm.io/package/@passport-next/passport-oauth2.md) ^2.1.1
- [@passport-next/passport-google-oauth2](https://npm.io/package/@passport-next/passport-google-oauth2.md) ^1.0.0

## Alternatives

- [adhdev](https://npm.io/package/adhdev.md) — 11.1K weekly downloads
- [react-slide-button](https://npm.io/package/react-slide-button.md) — 310 weekly downloads
- [better](https://npm.io/package/better.md) — 42 weekly downloads
- [react-native-swipe-image](https://npm.io/package/react-native-swipe-image.md) — 22 weekly downloads
- [nl.fokkezb.pulltorefresh](https://npm.io/package/nl.fokkezb.pulltorefresh.md) — 11 weekly downloads

## Recent versions

- 1.120.6 (latest) — 2023-01-04
- 1.92.5 (next-sso) — 2022-08-24
- 1.67.7 (range-time-5931) — 2022-05-23
- 1.63.1 (boost-dedi-5796) — 2022-05-11
- 1.55.5 (pr-5795) — 2022-04-05
- 1.52.1 (upd-hub-db-test) — 2022-04-01
- 1.46.0 (pr-5775) — 2022-03-15
- 1.45.0 (pr-5723) — 2022-03-06
- 1.20.0 (pr5560) — 2021-11-11
- 1.120.5 — 2023-01-03
- 1.120.4 — 2023-01-03
- 1.120.3 — 2023-01-03
- 1.120.1 — 2023-01-03
- 1.120.0 — 2023-01-02
- 1.119.0 — 2023-01-02
- … 271 more at https://npm.io/package/@cocalc/hub/versions

## README

# The hub CoCalc web server.

This code is part of https://github.com/sagemathinc/cocalc and isn't currently designed to be used standalone. Our plan is to refactor this code into smaller useful modules that are published under the @cocalc npm organization.

This is a node.js process that serves _all_ of the following (possibly simultaneously):

- static content - our mirror of the cdn and the results of webpack (packages/static)
- an http api as documented at https://doc.cocalc.com/api
- a websocket connection that client browsers use for sign in, account config, creating projects, etc.
- a proxy server that connects client browsers to projects
- project control server that creates, starts and stops projects running locally

## Running the server

Run the dev server, suitable for use inside a CoCalc project:

```sh
npm run hub-project-dev
```

## Using a different BASE\_PATH and PORT

Just set either the BASE\_PATH or PORT environment variables when starting thehub, and it will use what you set. If you do not set a BASE\_PATH it uses either"/" by default, or something involving the project id if you're inside a CoCalcproject.

If you don't set the PORT then 5000 is used by default.   The only way to set the port is via the PORT environment variable.

You can use the `--hostname` command line options if you are starting the hub directly via the `cocalc-hub-server` script and need to specify a different interface (e.g., 0.0.0.0 instead of localhost).

## Listening on https

As a quick test, you can do

```sh
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./selfsigned.key -out selfsigned.crt
```

to create self-signed key and cert. You can then start the hub with these two files as options:

```sh
cd packages/hub; npx cocalc-hub-server ... --https-key=./selfsigned.key --https-cert=./selfsigned.crt
```

and the hub will use https instead of http. Simple as that.

---
_Source: https://npm.io/package/@cocalc/hub · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
