Threaded commenting engine using golang for server backend and plain html/js/css frontend. Learning, straight to guts project, don't expect any standards and extensibility.
-
Threaded comments, sanitization and supported by markdown (minus images)
-
Authentication for anonymous users with jwt tokens, stored in cookies.
-
Single Sign On (SSO) using Ouath2 and google as the identity provider
-
Golang for backend server, using BoltDB for storage. CORS handling.
-
Plain HTML/JS for frontend
-
Email notifications via Sendgrid
-
Posts are sorted by time/replies
Requires go 1.18.
-
Generate rsa keypairs via
openssl genrsa -out app.rsa 4096andopenssl rsa -in app.rsa -pubout > app.rsa.puband place them in the same location as the executable generated. -
go mod vendorto vendor a local copy of dependencies. -
go buildcompiles allgofiles tomain.exe -
./main.exeto run the server, port 3000 by default. -
Host the frontend by running
cd frontend_sampleandpython -m http.server, launch a browser and direct the url tolocalhost:8000 -
Post as an anonymous guy
-
Go to https://console.cloud.google.com (using Chrome, firefox is bugged) and create a project. Create a ClientID and navigate to
Credentials. Add toAuthorized redirect URIsan entry that is the url of your server's auth callback, eg.http://localhost:3000/auth/google/callback -
Also, take note of the entries on the right,
Client IDandClient secret. Replace all instances of{GOOGLE_CLIENT_ID}with the value inClient IDand{GOOGLE_CLIENT_SECRET}with the value inClient Secret -
To test, click on the Google Signin link in the reply box, it should take and redirect you to google's signin page.
-
Sign up with Sendgrid
-
Replace
{ADMIN_EMAIL}with the admin's email -
Replace
{SENDGRID_KEY}with the key provided by sendgrid, and{SENDGRID_FROM}with the sender's name and{SENDGRID_FROM_EMAIL}with the sender's email (both of which you set in the sendgrid admin panel)
-
XSRF and CSRF protection: Need to setup a flow that requests for html of a reply box with a hidden unique id, and require the user to send that for posting the comment
-
Signing out, proper refreshing