No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Lightning Network Daemon API Documentation Site

API Documentation for the Lightning Network Daemon, powered by Slate


This repository contains functionality for programmatically pulling API information from lncli -h and rpc.proto on the lnd Github, using a Python script and Jinja2 template to output Slate markdown, which itself generates the fully rendered static site.

Pay special attention to these files:

  • templates/ The Jinja2 template fed into the Python script, holding the basic format and introductory information for the site
  • Update local docs to the latest version available
  • The Python script that uses local docs and Jinja template to output Slate markdown
  • Build static site from Slate markdown and deploy to Google Cloud Platform

Running the site locally


You're going to need:

  • Linux or OS X — Windows may work, but is unsupported.
  • Ruby, version 2.2.5 or newer
  • Python, version 3 or newer
  • Bundler — If Ruby is already installed, but the bundle command doesn't work, just run gem install bundler in a terminal.

Running locally

git clone

# Start a local server for testing purposes
bundle install --path vendor/bundle
bundle exec middleman server

You can now see the docs at http://localhost:4567.

Regenerating documentation

# Install Jinja for python templating.
pip3 install Jinja2

# Set your $GOPATH to a directory that has access to lncli.
export GOPATH="/path/to/lnd"
export PATH=$PATH:$GOPATH/bin

# Install annotations and protoc-gen-doc.
go get -u
go get -u

# Get the latest rpc.proto.
curl -o rpc.proto -s
curl -o rpc.swagger.json -s

# Generate the rpc.json file from rpc.proto, so that can parse it.
protoc -I. -I$GOPATH/src/ --doc_out=json,rpc.json:. rpc.proto

Now, ensure that you have lnd installed and your $GOPATH set, so that lncli is available from the command line. Let's run the script to render our local Slate docs:


Now that you're all set up, you can just run ./ to automatically pull the latest rpc.proto and render the local Slate docs.


The Lightning API is deployed with Google Cloud Platform. Visit this blog post for more information.


  1. Install Google Cloud SDK and authenticate into it:
brew cask install google-cloud-sdk
gcloud auth login
  1. Build
bundle exec middleman build --clean
  1. Push to Google Cloud Bucket
# -m use faster multithreaded uploads
# -d delete remote files that aren't in the source
# -r recurse into source subdirectories
gsutil -m rsync -d -r ./_site gs://

In the future, you can just run ./ to deploy automatically.

Automatic Updates and Deployment

Updates to the protobuf definitions can be detected by running the Flask server within

Running the server locally

The server uses Flask in order to receive POST requests from GitHub whenever a new commit has been pushed to the respository. These POST requests will include the HMAC of a secret token set up within the Webhook settings of a repository. This token will need to be exported so that the server can verify the request from GitHub has been authenticated.

First, ensure that Flask is installed with:

$ pip3 install flask

Then, the server can be run with:

$ flask run

Once a POST request from GitHub has been received, the server will check if there were any commits which included a change to the protobuf definitions. If there was, then the documentation will be automatically regenerated and deployed.