This repo contains the source code used to generate the API docs websites for LND, Loop, Pool, Faraday, and Taproot Assets Protocol: https://lightning.engineering/api-docs/
The websites are automatically generated from the protobuf definition files
(*.proto
) and Swagger/OpenAPI files (*.swagger.json
) found in the Github
repositories of each application. These files are sourced from the following
repos:
- LND: https://github.com/lightningnetwork/lnd
- Loop: https://github.com/lightninglabs/loop
- Pool: https://github.com/lightninglabs/pool
- Faraday: https://github.com/lightninglabs/faraday
- Taproot Assets Protocol: https://github.com/lightninglabs/taproot-assets
- Lightning Terminal (LiT): https://github.com/lightninglabs/lightning-terminal
There is a multi-stage pipeline to consume the protobuf & Swagger files and convert them into an HTML static website. The process is as follows:
+ ./generate.sh
|
| - downloads the master branch of each repo
| - uses protoc to convert *.proto to generated.json
| - compiles `cmd/mdgen/main.go` into ./mdgen console app
|
+ ./mdgen
|
| - outputs markdown files into site/docs/
|
+ yarn build
|
| - builds the Docusaurus site
| - converts the markdown pages into HTML
|
+ Output Static Website
This process is run every day at midnight UTC by a cron job. After the build, the static sites are deployed.
Follow these steps to run the pipeline locally. You can modify the source
code for the mdgen
tool and the markdown templates (in templates/
), to
alter the generated static pages.
System Requirements
- Clone this repo
$ git clone https://github.com/lightninglabs/lightning-api-ng.git $ cd lightning-api-ng
- Install NodeJS dependencies
$ cd site/ $ yarn
- Run the script to generate JSON files for each daemon from their proto files
$ ./generate.sh
- In one terminal, start the script to watch for changes of source
files and automatically regenerate the markdown files
$ ./watch.sh
- In a second terminal, start the Docusaurus site
$ cd site/ $ yarn start
- A new browser window should automatically open http://localhost:3000/api-docs/
- Run the script to generate JSON files for each daemon from their proto files
$ ./generate.sh
- Build the static site
$ cd site/ $ yarn build