Image for The Lucky Roll Platform
Dev Blog


The Lucky Roll Platform

Picture of Travis Woodward, the author
Published on 07/01/2023 12:49


Today I am very excited to announce the Lucky Roll Platform has officially launched!

The Platform

What exactly is the Lucky Roll Platform? Great question! It's a way for users to create an account with us and access all their save data and game data in one place. Your Lucky Roll User account is going to be how you are known throughout the Lucky Roll Studio community. As more games are released this gives us the ability to showcase your skills and achievements to other players. I am going to go into a technical talk below to cover how our platform works and why we made the choices we made.

First our platform is composed of three main elements.

  1. Strapi (Our CMS)
  2. Angular (Our Web Application)
  3. AWS (Our Cloud Service Provider)

Let's talk about what each of these core components do in our stack and why they are important.

Strapi

Strapi is a headless CMS for developing websites, mobile apps, eCommerce sites, and APIs without knowing any backend or database. I really like the headless approach here because from our point of view, we need a CMS portal to log in to, create content and have something "just work". That is exactly what Strapi does. We did consider other CMS providers such as Contentful but Strapi gives us a self-host option which we is really nice for a company of our size.

Strapi is living on a rather small 2GB, 60GB SSD, 3TB Transfer Ubuntu AWS Lightsail instance. We can cache our images and content as it does not change that frequently and that will help with our transfer limits. Note that we originally had Strapi living on an EC2 but felt it was overkill for what we need our CMS to accomplish. Strapi allows us to create end points on our subdomain that we can query to build cool widgets like our home page carousel, dynamic game pages and even the footer of our website. This allows us to move very fast once setup and make changes with very low risk to breaking something. Strapi's only job is generate content so that our Angular application can access it via API. And that bring us to...

Angular

Angular is a development platform, built on TypeScript. In short, we built everything you see on our website using Angular and Typescript. Angular for us is a preference, we like static typing and the options that Angular give us. You could build the same web application in React, Vue, Eleventy or any of the other frontend frameworks... but we like Angular. We are also using Bootstrap 5 components and some custom SCSS to provide the appearance that our website has. We really wanted our web application to have remnants of the past when it came to the style, almost like a nod to the early 2000's when the web was a little more lawless.

We are using AWS Amplify with our Angular application. This gives us the ability to make calls to our AWS services in a safe and structured way. We call our Lambda endpoints directly as our platform does not have a public facing API. I realize that the "new norm" is to query API Gateway first however for a studio of our size, that was a potential added cost that we are able to avoid. In the future should we create any public APIs we will most certainly use API Gateway as the interface. Our web appliction is hosted on AWS S3 instead of an EC2 since it is a static site. This will save us a ton of money in the future as we grow as storage space is significantly cheaper than computing costs. Speaking of AWS...

AWS

First, everything we are doing is behind a Web-Application Firewall (WAF). Our angular application communicates to AWS through AWS Amplify. By using Amplify we have access to functions (Lambdas) so that we can directly query our RDS relational database. For our use case, we really wanted to keep a relational database. It's likely we could have done what we're doing with DynamoDB or Mongo but this was another point of preference for us. We are currently using MySQL but do see benefits in Aurora and that may be an "upgrade" in the future once we grow past a certain point.

Another beautiful thing about AWS Amplify is the compability to talk directly to Cognito. AWS Cognito is where our user data is stored and it is highly secure. We don't have to give much thought to passwords for example because the Lucky Roll Platform does not store them! We don't need to hash or salt, we simply let the experts at AWS handle this while we focus on building a great user experience. This also means if there ever were a data breach on our end, passwords are not compromised, because we do not store them! When a user signs up or makes any changes to their password, they will need to verify their email. We handle this by integrating AWS Cognito with AWS SES (Simple Email Service). Seamless.

Finally we decided to go with Cloudflare for our purposes. We could have achieved the same thing from Amazon Cloudfront and Route53 but we love the simplicity of Cloudflare. Since Strapi does not server HTTPS automatically, setting up Certbot with Cloudflare and added a reverse proxy on Nginx to cover our bases. The result is a fully functional platform and web application.

Hopefully this is somewhat interesting or useful to someone. For us, the biggest win here is going from having 3 EC2 instances or one large EC2 to Lightsail, S3 and RDS. We are in all aspects "serverless" at this point and our architecture will continue to grow as we build more games and add more APIs in the future.

Best wishes~

Lucky Roll Team

Author

Picture of Travis Woodward, the author
Hello, I'm
Travis Woodward



Co-Founder and Head of Engineering.

Help I'm stuck in an infinite loop, Help I'm stuck in an infinite loop, Help I'm stu-