Skip to content

Building an IndieAuth Comment System for Your Static Site

A journey through authentication, CORS issues, and the joy of owning your comments! Learn how to build a comment system for your static site using IndieAuth and Netlify Functions, storing the comments in your git repository.

B♾️

ello, webcrafter! I added a functional comment section to my static site using IndieAuth and thought it might be helpful to explain how I implemented things. There were quite a few pitfalls along the way that I want to make point of to help anybody else that wants to do something similar. Enjoy the read!

## Why Not Just Use Disqus?

Before I start, I know that there are already more convenient solutions. But when you use 3rd-party comment systems, you're giving away conversations, community engagement, and often user data to someone else. Creating your own means you have full ownership and possibility, and you don't have to worry about the bloat from pre-created widgets.

But there's something else. I think it's important we figure out solutions for the IndieWeb and frontend-only JAMstack static websites. It can be tempting to try to figure out databases or start looking at a LAMP stack with PHP and SQL in the back, but I've been a firm believer that the Internet has evolved to a point where we no longer require a full-stack solution, especially when you're dealing with something as simple as a blog or a personal site or something informational.

The onus is on us as developers in this space to figure out solutions for dynamic content within the static space, that is the definition of JAMstack. And that's why I founded [Berry House](https://berry.house) in the first place.

I enjoy having a personal site because it means I can write and display my own personal work however I want. But I think it's also important to implement access to the commons—to have the ability for others to share their thoughts and respond just as easily as it is for me to present my own. I think aa lot of personal sites I've encountered does not have this capability, and they are simply exercising the act of sharing without feedback. Typically. people go to Mastodon or email or [webmentions](https://webmention.io/) as a way to have communication with other people on the IndieWeb, but that doesn't satisfy the idea I have of commons and communication.

My wants are: - Comments stored in my GitLab repository via a .JSON file - Authentication via users' own websites (IndieAuth) - No tracking, no ads, minimal JavaScript - Respect of privacy, open web, and digital commons

To do this: - Comment form that authenticates users via IndieAuth - Server-side functions to handle the authentication and comment storage - A lightweight frontend playing nice with the rest of my site

The tools I am using: - **11ty** (Eleventy) for our static site - **Netlify Functions** for serverless backend - **GitLab** for comment storage - **IndieAuth** for authentication

## Getting Started with IndieAuth

First, what is IndieAuth? It's a way to sign in to websites using your own domain name. If you ha

Did you enjoy this article?

Recommend it — Standard Reader surfaces well-loved writing to more readers across the network.

Across the AtmosphereDiscussions