Skip to content

Tiim/IndieGo

Repository files navigation

IndieGo

This project is a simple, modular but extendable webserver to enable your website to join the IndieWeb.

IndieGo currently supports native comments, sending and receiving webmentions, IndieAuth as well as Micropub. All components are built in a modular way, they can be extended for your own needs or disabled by just commenting them out in the main method.

The API can be queried for comments and webmentions of all pages or just of a single page.

Blogposts about IndieGo

Image of the Go gopher with a speech bubble

Demo

You can try out this project on my Blogpost about this project.

Installation

Using docker

The easiest way to run the go-comment-api is via docker compose. There is a sample docker-compose.yml that I use to host the comments for my website. To see how I deploy it on my webserver see deploy.sh.

  • TODO: document how to use the default config with env variables.
  • TODO: document how to use a custom config file.

Compile it to a static binary

You need a recent go version installed. Run the following command to compile:

go mod download
CGO_ENABLED=0 go build -o comment-api -a .

This binary is self contained and only needs a config file to run. Run it with

./comment-api -config config.json

For an example config file see config.json.

Development

Running Tests

go test ./...

Running migrations in the cli

# Up
goose -dir model/sqlite-migrations/ sqlite3 db/comments.sqlite up
# Down
goose -dir model/sqlite-migrations/ sqlite3 db/comments.sqlite down

Tools

Exposing tunnel to the web

npx ngrok http 8080

For testing IndieAuth:

NGROK_URL=https://<ngok-url> go run . -config config-local.json

Testing indieauth websub / indie reader with aperture

  • Expose app to web via ngrok
  • Register with ngrok url
  • Restart app with APPERTURE_ID=xxx

Node Webmention Testpinger

Source

  • npx webmention-testpinger --endpoint=http://localhost:8080/wm/webmentions --target https://tiim.ch/target -p 8081
  • npx webmention-testpinger --endpoint=http://localhost:8080/wm/webmentions --target http://localhost:5173/projects/lenex-split-sheet -p 8081

Sending single webmention with curl

cd test-data/
python3 -m http.server
curl -i -d source=http://localhost:8000/html/webmention-rocks.html -d target=https://tiim.ch/blog/2022-07-12-first-go-project-commenting-api http://localhost:8080/wm/webmentions

About

Tiny go api that serves your websites comments. The comments are stored in a lightweight sqlite database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages