# nsite-cli

> nsite CLI - publish your site to NOSTR and blossom servers

Latest version **0.1.18** (published 2026-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install nsite-cli
pnpm add nsite-cli
yarn add nsite-cli
bun add nsite-cli
```

Provides the command `nsite-cli`.

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.18 |
| Published | 2026-04-01 |
| First published | 2024-09-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=20.0.0 |
| Dependencies | 15 |
| Unpacked size | 43.5 KB |
| Known vulnerabilities | 0 (+34 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 16 |
| Author | florian |
| Maintainers | flox1an |
| Keywords | nostr, blossom, website, publish |

## Links

- npm: https://www.npmjs.com/package/nsite-cli
- Repository: https://github.com/flox1an/nsite-cli
- Issues: https://github.com/flox1an/nsite-cli/issues
- npm.io page: https://npm.io/package/nsite-cli

## Dependencies (15)

- [ws](https://npm.io/package/ws.md) ^8.18.0
- [axios](https://npm.io/package/axios.md) 1.14.0
- [debug](https://npm.io/package/debug.md) ^4.4.0
- [dotenv](https://npm.io/package/dotenv.md) ^16.4.7
- [inquirer](https://npm.io/package/inquirer.md) ^12.4.1
- [commander](https://npm.io/package/commander.md) ^13.1.0
- [mime-types](https://npm.io/package/mime-types.md) ^2.1.35
- [node-fetch](https://npm.io/package/node-fetch.md) ^3.3.2
- [nostr-tools](https://npm.io/package/nostr-tools.md) ^2.10.4
- [proxy-agent](https://npm.io/package/proxy-agent.md) ^6.5.0
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^1.7.1
- [@nostr-dev-kit/ndk](https://npm.io/package/@nostr-dev-kit/ndk.md) ^2.11.0
- [blossom-client-sdk](https://npm.io/package/blossom-client-sdk.md) ^2.1.1
- [websocket-polyfill](https://npm.io/package/websocket-polyfill.md) ^1.0.0
- [inquirer-autocomplete-standalone](https://npm.io/package/inquirer-autocomplete-standalone.md) ^0.8.1

## Recent versions

- 0.1.18 (latest) — 2026-04-01
- 0.1.17 — 2026-04-01
- 0.1.16 — 2025-02-13
- 0.1.15 — 2025-02-12
- 0.1.14 — 2024-12-13
- 0.1.13 — 2024-10-19
- 0.1.12 — 2024-10-18
- 0.1.10 — 2024-10-13
- 0.1.9 — 2024-09-27
- 0.1.8 — 2024-09-26
- 0.1.7 — 2024-09-26
- 0.1.6 — 2024-09-25
- 0.1.5 — 2024-09-23
- 0.1.4 — 2024-09-23
- 0.1.3 — 2024-09-21
- … 3 more at https://npm.io/package/nsite-cli/versions

## README

# nsite-cli

This command line tool allows you to publish a static website on NOSTR in a anonymous and censorship resistant way.

- The website file listings are published as events (`Kind 34128`) on NOSTR relays.
- The binary files are uploaded to a blossom server ( https://github.com/hzrd149/blossom )
- All data is signed with your private key, so it can not be altered by anyone else.

## Usage

There are two ways to use this tool.

1. When you run `npx nsite-cli` without any subcommand, it will start an interactive dialog to set up a new project. Here you can also create a new private key (nsec) for signing, add custom relays and blossom servers. All settings will be saved in a `.nsite/project.json` file in the current working directory.

2. You can specify all settings on the command line or environment variables and use the `upload` command to upload a website.
   ```
   npx nsite-cli upload \
   --relays 'wss://nos.lol,wss://relay.primal.net,wss://relay.nostr.band,wss://relay.damus.io' \
   --servers 'https://cdn.satellite.earth,https://nostr.download' \
   --privatekey <some secret nsec> \
   www
   ```

## Commands

### Upload

Upload a folder to NOSTR and the configured blossom servers:

```
npx nsite-cli upload <folder>
```

### Download

Download a folder from NOSTR and the configured blossom servers:

```
npx nsite-cli download ./targetfolder npub1kjd4h3scfgzqmxn509a2fzuemps379rxnk7lkfh39jme3jdnfg
```

Download currently only works with a given public key (npub) and not with the private key or project configuratiom.

### List

List all uploaded files of a specific public user (npub):

```
npx nsite-cli ls npub1kjd4h3scfgzqmxn509a2fzuemps379rxnk7lkfh39jme3jdnfg
```

or list all uploaded files for the current private key (from the .nsite/project.json file):

```
npx nsite-cli ls ./targetfolder
```

## Environment variables

Setup your NOSTR relays through the `NOSTR_RELAYS` environment variable:

```
export NOSTR_RELAYS=wss://nos.lol,wss://relay.primal.net,wss://relay.nostr.band,wss://relay.damus.io
```

The `BLOSSOM_SERVERS` can be used to specify the blossom servers:

```
export BLOSSOM_SERVERS=https://media-server.slidestr.net/,https://nostr.download/
```

Set a `NOSTR_PRIVATE_KEY` that will be used to publish events (nsec or hex string) can be set as follows:

```
export NOSTR_PRIVATE_KEY=<nsec or hex nostr private key>
```


## Dynamic web app with browser based routing (e.g. React Browser Router)

For deep linking into web apps that use browser based routing there needs to be a way to redirect 
requests to the root `/index.html` to start the web apps. **nsite** solves this by using a `/404.html`. You can either 
upload a custom `/404.html` file or use the `--fallback=/index.html` option to "redirect" to a specific html file. 
This instructs `nsite-cli` to upload a copy of the specified fallback file as  `/404.html`.
```
npx nsite-cli upload dist --fallback=/index.html

```
Another way is to use the fallback option in the project config.
```json
{
  "privateKey": "xxxxxxxxxx",
  "relays": [
    ...
  ],
  "servers": [
    ...
  ],
  "fallback": "/index.html"
}

```


## Connecting to Tor and I2P relays

nsite-cli supports `ALL_PROXY` and other proxy env variables [here](https://www.npmjs.com/package/proxy-from-env#environment-variables)

Install Tor ([Documentation](https://community.torproject.org/onion-services/setup/install/)) and I2Pd ([Documentation](https://i2pd.readthedocs.io/en/latest/user-guide/install/))

Create a proxy.pac file

```txt
// SPDX-License-Identifier: CC0-1.0

function FindProxyForURL(url, host)
{
  if (shExpMatch(host, "*.i2p"))
  {
    return "PROXY 127.0.0.1:4444; SOCKS5 127.0.0.1:4447";
  }
  if (shExpMatch(host, "*.onion"))
  {
    return "SOCKS5 127.0.0.1:9050";
  }
  return "DIRECT";
}
```

Start the command with `PAC_PROXY` variable

```sh
PAC_PROXY=file://$(pwd)/proxy.pac npx nsite-cli .
```

## Troubleshooting

To enable debug logging, set the `DEBUG` environment variable to `nsite*` or even `*` to also see `ndk:*` logs

```
export DEBUG=nsite*

OR

export DEBUG=*
```

## Build

```
npm i
npm run build

bun i
bun run build
```

## Install or Run

By running

```
npm link
```

the `nsite-cli` command can be installed to be run from command line from anywhere you like.

Otherwise it can also be run from source using `bun`

```
bun run src/cli.ts upload ./www
```

Or from the built javascript files using node

```
node dist/cli.ts upload ./www
```

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