Rerolling the Dragonlash Backend

Jul 08, 2018


Have you ever got stuck so far in the mud that you were better off just gunning it and trying to make it to the other side? Yea, that was pretty much where I was with this website over the last month. For several months I had been working on a major overhaul of the website's backend and managed to make some changes to the database that weren't backwards compatible with the live site, and that I wasn't able to back out. So even though the update wasn't fully ready, I had no choice but to just go all-in.

So, you may have noticed things were pretty rough on the site for the past few weeks. A lot of it was the fact that my update reorganized the site urls, but I didn't have a way to easily redirect the thousands of pages that this site has. I was able to write some regex rules to redirect the major pages to the new locations, but a lot of them just returned "404 Not Found" errors until Google delisted them. At this point, Google has finally updated their indexes, so you shouldn't be seeing any more of those bad links.

Better, Faster, Stronger...

Sometimes things need to get worse before they get better, and now with this overhaul things are better than before with a whole lot of improvements to tell you about.

Frontend stuff

  • Sidebar Nav: Subpages can now be expanded without first visiting the parent page. The current page is highlighted and expanded. On smartphones the nav slides in on the left side of the screen using the hamburger menu in the upper right.
  • Table of Contents Nav: The sidebar nav was working so good, I decided to use it for the table of contents too! Here the links all smooth-scroll to anchor tags on the page.
  • Darkmode theme: If you're browsing in a dark room, or if you just prefer light text on a dark background, look on the bar on the bottom of the page for the "toggle theme" option.

Backend stuff

  • Backend CMS: I've had people offer to help with aspects of the site's content, but for non-programmers, dealing directly with a database is a difficult thing. This content management system (CMS) allows anyone, even non-programmers, to log into the website and edit pages or add items, abilites, spells, etc. to the database directly through an easy-to-use website interface.
  • Exit SQLite + Elasticsearch, enter PostgreSQL: I've been using ElasticSearch, which is very powerful, but was sort of awkwardly bolted onto the project. Over the last year or two, PostgreSQL has added some incredibly powerful full text search capabilities. I'll be able to do this in a much simpler way with PostgreSQL, plus it has some "NoSQL" capabilities which I was thinking might be useful in some cases (like for starships, or when I add character sheets). The PostgreSQL search is still a work in progress, what's on the site now is a very basic search, so stay tuned for improvements here.
  • Speed and size improvements: I've been squeezing every last millisecond and every last kilobyte out of the website by stripping out bloated javascript libraries like bootstrap and jquery, and by optimizing page rendering code. Even on the slowest connections and devices, things should feel pretty darn snappy, and the site will sip bandwidth for those worried about bandwidth usage caps.