Code Monkey home page Code Monkey logo

earthstar-pub's Introduction

Earthstar Pub

Hosts and syncs Earthstar workspaces over HTTP. One pub server can hold multiple Earthstar workspaces.

You can

  • View the data through a web interface
  • Sync your local files to/from the server using earthstar-cli

Pub servers don't sync directly to each other (yet?).

Caveats

This is for demonstration purposes, so it shows all the workspaces and data over the web. Normally Earthstar pubs should not reveal which workspaces they hold.

It stores data in memory, not on disk, so it will forget everything if restarted. Note that glitch.com restarts projects often.

There's an issue describing how to store data in SQLite for persistence.

Demo

https://earthstar-demo-pub-v5-a.glitch.me/

Running on Glitch

Make your own copy on Glitch by going here and clicking "Remix this".

Or start a new Glitch project from scratch:

  • Make a new Express project
  • Go to Glitch's package.json, click "Add package", and add earthstar-pub
  • Delete the demo code from server.js
  • Copy-paste the code from this repo's example.js into Glitch's server.js
  • Rename your project, at the top left
  • Click "๐Ÿ•ถ Show > In a New Window" to visit your pub

Easy command-line install

Install

npm install --global earthstar-pub

Run

earthstar-pub

Then visit http://localhost:3333.

Options:

Usage: earthstar-pub [options]

Run an HTTP server which hosts and replicates Earthstar workspaces.

Options:
  -p, --port <port>   Which port to serve on
                        (default: "3333")

  --readonly          Don't accept any pushed data from users
                        (default: false)

  -c, --closed        Accept data to existing workspaces but
                        don't create new workspaces.
                        (default: false)

  -d, --discoverable  Allow workspace addresses to be discovered
                        via the web interface.  Only use
                        this for testing purposes.
                        (default: false)

  -s, --sqlite        Use sqlite instead of memory.  Default is memory.
                        (default: false)

  --dataFolder <folder>
                      Folder in which to store sqlite files.
                        Defaults to current directory.
                        Only used for sqlite, not memory.
                        (default: ".")
                      
  --logLevel <logLevel>
                      Show this many logs. 0 = none, 1 = basic, 2 = verbose,
                        3 = include sensitive information (workspace addresses).
                        (default: "0")

Developing

Clone and install

git clone https://github.com/earthstar-project/earthstar-pub
cd earthstar-pub
npm install

Compile typescript

npm run build

Start the server

npm start

Then visit http://localhost:3333.

earthstar-pub's People

Contributors

cinnamon-bun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.