wotlwedu Tech Details

TLDR; The github repositories are at https://github.com/ravelox/wotlwedu-backend and https://github.com/ravelox/wotlwedu-frontend.

The backend is a REST (like) API written using Node.js talking to a mariadb database. The frontend is an Angular project talking to the API.

The demo system I setup is using 3 small virtual servers at https://ionos.com. One for frontend, one for backend and one for the database.

The whole app is total CRUD. By that, I mean it’s a relatively simple Create, Read, Update and Delete app.

The underlying database structure looks similar to this

That was the first design I came up with and it stayed pretty stable with a few extra columns in some tables as needed.

The ORM I used was Sequelize. It was the one that was used in the training classes so I could lean on some of the examples for code suggestions. It does get a little complicated when you’re trying to do INNER JOINs to handle some of the relationships but I’ve got it to work. I chose mariadb as the database because that’s what I’m used to. I’ve seen MongoDB in action briefly and I need to get my head around the ORM (Mongoose) to be able to replicate the results of the queries I get from mariadb. I will dump the schema and add it to Github for reference.

The UI does leave a lot to be desired. It doesn’t look modern and it’s certainly not responsive. For those of you not familiar with responsive UI design (and neither was I before I started all this), it’s how the UI changes form depending on the size of the view window. In other words, if the same app was being used on a regular PC browser vs a tablet vs a phone screen. The real estate changes and so should the UI. Lots of YouTube videos about how to change the layout but most of the examples are for repeatable containers such as news articles or shop fronts etc. There isn’t that much I could find that related to what is, essentially, an admin interface. So, this is the best I could come up with that works on Chrome on a PC.

That said, I’ve learned a lot of techniques using Javascript and CSS to achieve context menus, drag and drop features and scrollable containers with sticky headers. I didn’t cover it in my original post but I have also included 2FA using an authenticator app. I was quite smug about getting that to work 🙂

There is a long list of things that I’d like to change:

  • The UI should look more like an app and must be responsive.
  • The REST API is heavily-entangled with the database. I’d like to abstract the database layer so that someone could use MongoDB as the data store if they so choose.
  • I added the ability to create categories, I want to code the UI to handle that so that lists of things are presented as a pseudo directory structure.
  • Lists of things need to have timers to refresh data periodically. At the moment, list updates are made when a subscription is notified and that only happens in the scope of the browser. That relieves some of the pressure from the REST API but, for the dashboard, I want notifications to be in (near) real time so that a friend can take an action that generates a notification for their friend and the other friend will see it happen without needing to manually refresh.
  • There are some housekeeping tasks that need to occur on a regular basis. For example, notifications have an expiration time of 30 days, elections have an expiration time which needs to clean up the underlying vote records. Additionally, some of the tokens like refresh, password reset have expiration times too. I need to clean those up.
  • It’s important to have an understanding of how I can harden my app to prevent abuse. I created a security model that prevents users from seeing other users’ data unless the authenticated user has a role that allows them to do that. However, I have nothing in place to prevent abuse from multiple registrations in a short period of time, logins from different places for the same user etc etc. I need a better understanding of CORS too.
  • I want a proper install process. At the moment, there are a number of steps that have to happen to create the database. Setting up mariadb needs to happen first with some manual steps. I have a script that handles that but it’s a piece of SQL that gets redirected into a mysql command-line call. WordPress has an install routine once the app is copied into the appropriate HTTP server directory. With wotlwedu, the frontend is on a different server from the backend which is on a different server from the database. Somewhere I need to be able to get to the database efficiently. I’d also like the install to be idempotent.
  • While most of the lists have the ability to filter on a string, if you’re an admin, your view is of every object so you get to see everybody’s images, items, lists etc. I want the ability to also filter on creator. That means adding a creator field to all the detail containers.
  • The REST API needs to be reviewed and documented. It’s pushing the limits of the definition of REST and some of the endpoints are there for convenience rather than adhering to the definition. I’ve looked briefly at Swagger and it might be possible to document it using that.
  • Email notifications. I already have the functionality to email links for confirmation of registration and also password resets. I’d like to be able to do email notifications too.
  • Email sending in general. I’m currently using my test API keys for Amazon SES. I’m prepared to switch to production ($) mode which is why I restricted email sending to password resets and registrations. In test mode, I have to configure which domains that mail can be sent to. In production mode, I can send every where. That all said, I want to abstract the sending layer so that different mailers can be used. I tried setting up a SMTP server on ionos but there were issues trying to get through port 25 and also having Gmail not classing it as spam because of the IP address. This is why I switched to using SES.

If anyone can help with any of those items, I’d be happy to talk with you but this is a learning exercise for me. If you feel you can contribute, please be prepared to have me continually asking “How did you do that?” or “Why did you do that?”. I would gratefully appreciate any time you can give.

Leave a Reply

Your email address will not be published. Required fields are marked *