Inspiration

I'm currently looking for a comment system for my blog, which is hosted on GitHub Pages. Disqus added advertisements to its free plans, making it a much worse experience. The best alternative to Disqus is isso, but it doesn't support social logins. I thought it would be an interesting exercise to try to create a commenting server.

What it does

commentserv provides a server and rest API for comment hosting. It is only a server; it has no front end, because that is not its purpose.

How I built it

I wrote the webapp in Scala with the following libraries:

Pure functions were used wherever possible.

I used docker-compose to quickly get a PostgreSQL database running. I also added Redis,, but I never ended up using it.

Total programming time is about 10 hours.

Challenges I ran into

I ran into some strange Scala compiler bugs that prevented upickle from automatically generating serialization code. I had to write a small workaround, but it took me 30 minutes to figure out how.

I couldn't figure out how to set up the flyway-db plugin for database migrations for about an hour. It turns out that the Java Postgres driver is org.postgresql.Driver and not org.postgres.Driver!

Debugging the client took way too long because Firebug was deprecated. I didn't realize it until console.log stopped working.

Accomplishments that I'm proud of

  • Having this program compile with no warnings and no errors
  • Writing a free monad for Redis, but I never used it. I intended to use Redis for session caching, but I found that akka-http-session managed sessions nicely in memory.

What I learned

  • Learning how to do purely functional database access
  • How to use akka-http-sessions
  • What foreign keys are in SQL

What's next for commentsrv

I'll probably rewrite it in Rust so it doesn't use so much memory. Also, I might switch the database from Postgres to SQLite (as isso's homepage states, "Because comments are not Big Data").

Built With

Share this project:

Updates