You are reading content from Scuttlebutt
@mix.exe %gmBNvW4TIthRxEEjUTPTduemQi60bjBmdyeaXWMX0xQ=.sha256

ssb-ahoy @ 5-alpha

I've been reshaping ssb-ahoy to be laser-focused on making it easy for JS devs to easily build installable ssb apps. I'm dropping the pre-launch screen where you can edit your config, or handle initial sync. Really interested to hear what people think of this API


Builds on top of:

  • electron@18
  • secret-stack@6

Getting started

// index.js
const ahoy = require('ssb-ahoy')
const path = require('path')

ahoy(
  'http://localhost:8080', // dev-server for UI
  {
    plugins: [
      require('ssb-db'),
      require('ssb-backlinks')
    ]
  },
  (err, ssb) => {
    if (err) throw err

    console.log('ahoy started', ssb.id)
  }
)
// package.json
{
  "scripts": {
    "start": "electron index.js"
  }
}

API

ahoy(url, opts, cb)

  • url String

    • a url to load the app UI from
    • can start with
      • http:, https: - great for local dev-servers
      • file: - useful when you bundle ui for production, electron fetches directly from file system
        • e.g. `file://${path.join(__dirname, 'dist/index.html)}'
  • opts Object with properties:

    • opts.title - String the title of your app
      • will be the title of the app window
      • default: 'hello_world'
    • opts.plugins - [Plugin] an array of secret-stack plugins
      • default: []
    • opts.config - Object config over-wrides which secret-stack and plugins will be launched with
      • opts.config.path - String location your database + secret will be installed
        • default: \${envPaths.data}/ssb-ahoy/dev/\${format(opts.title)}
      • generally defaults follow ssb-config/defaults.js
  • cb function callback which is run once ssb and electron have started up

ahoy(url, opts) => Promise

Convenience method which is a promisify'd version of the last method.

User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@mix.exe %czsUao9LFPNVxq/sc8JGzBWREbWRQ/pspMjTfitnMKk=.sha256

spent all of today on getting this ship-shape.

  • got a pretty barebones AppImage building at 83MB which I'm pretty happy with
    • this is the result of a much faster build cycle (skipping UI bundling, having a very minimal app + config)
  • had a tutu with esbuild to see if i could bundle the "main" electron process
    • oh my god that tool is fast
    • hit challenges with bundling a preload file... gave up
    • not sure the file size would be significant
Join Scuttlebutt now