Aral Balkan

Mastodon icon RSS feed icon

Indie Web Server

Screenshot of a web browser and two terminal windows. The URL of the web browser is set to https://aral2.hypha.dev and it shows a copy of my blog. The first terminal window is running Indie Web Server and the second one is running ngrok with HTTP and HTTPS tunnels to my machine. Excerpt of first terminal window: ~/ar.al/live: web-server --global πŸ’– Indie Web Server v6.0.1 🌍 [Indie Web Server] Using globally-trusted certificates. πŸ‘‰ [Indie Web Server] HTTP β†’ HTTPS redirection active. πŸŽ‰ Serving . on https://aral2.hypha.dev GET / 200 51166 - 4.602 ms (followed by more server log output).

Indie Web Server serving my blog over a TLS tunnel via ngrok.

Indie Web Server1 is a secure and seamless Small Tech personal web server.

Use it to seamlessly serve your personal static web site in development and production or build your own dynamic web app on top of it using JavaScript and Node.js.

Indie Web Server is as easy as it gets.

Features

Install

$ npm i -g @ind.ie/web-server

Use

Command-line

Start serving the current directory at https://localhost:

$ web-server

Start serving the site directory at your hostname:

$ web-server site --global

For example, if you run the command on a connected server that has the ar.al domain pointing to it and ar.al set in /etc/hostname (on Unix/Linux/macOS), you will be able to access the site at https://ar.al. The first time you hit it, it will take a little longer to load as your Let’s Encrypt certificates are being automatically provisioned by ACME TLS.

API

You can also use Indie Web Server programatically as the basis of you own web applications.

Examples

Serve the current directory at https://localhost using locally-trusted TLS certificates:

const webServer = require('@ind.ie/web-server')
const server = webServer.serve()

Serve the current directory at your hostname using globally-trusted Let’s Encrypt TLS certificates:

const webServer = require('@ind.ie/web-server')
const server = webServer.serve({global: true})

Create a custom server:

const webServer = require('@ind.ie/web-server')
const express = require('express')

const app = express()
app.use(express.static('.'))

const options = {} // to use globally-trusted certificates instead, set this to {global: true}
const server = webServer.createServer(options, app).listen(443, () => {
  console.log(` πŸŽ‰ Serving on https://localhost\n`)
})

For full details of the command-line syntax and API, please see the documentation.


  1. Previously known as HTTPS Server. ↩︎

  2. Receives an A on the SSL Labs SSL Server Test. ↩︎