Mike Rankin Games, Tech and other oddities

HobbyWorks website
By Mike Rankin on Monday, Jan 7, 2019

An eCommerce Playground

I feel that it is important for most developers to have some side project where they can experiment and hone their craft. Luckily for me, HobbyWorks has given me pretty much free reign to build out their site using the technologies I’m investigating.

The site is hosted on AWS as a docker image on elastic beanstalk. On the docker image, we have installed tomcat, nginx and lucee for the webservers. The database is a mysql clone running on Amazon Aurora. Given a choice, we would definitely prefer the postgres option, but Aurora can’t currently support an instance small enough to keep our costs under control, so it’s MySQL for now.

Pay with Amazon

The application has a custom library built to use the amazon payment service. I can’t recommend this payment processor strongly enough. It provides the ability for our customers to use any of the payment methods they currently have on amazon.com as well as any of their normal shipping destinations. The exchange fees are very competitive as well as providing our customers with the assurance of being covered under the amazon AtoZ guarantee. Because of the way it’s implemented, AmazonPay isolates us from any card data or detailed customer information. We don’t collect or store any cardholder data which protects us from any sort of customer breach.

Building the payment gateway code is really easy if you use one of the mainstream programming platforms since amazon provides libraries in php, java, ruby, python, and C#. I probably could have made short work of it by using the java library, but I wound up coding a custom solution using native cfml in lucee and hitting the api directly. It was quite challenging because there are several layers of encryption and tokenization required, but I slogged through it. It has been very stable and provides decent information for problem transactions.

Order Fulfillment and Site Admin

The hobby shop site has a pretty robust administration app that provides content management, inventory control and order fulfillment. Split shipments can be handled as well is integrated inventory counts with the retail locations. Inventory movement on the site is handled in real-time, although periodic inventory refreshes must be done to sync with in-store sales.

Publishing new code

Updates to the site code are very easy and consist of uploading an updated .war file generated with a webpack build process. Updates generally take less than a minute to roll out.

Webpack

Speaking of webpack, we’re currently using version 4 to build and compress both our javascript and css (from sass) into a deployable .war package. Webpack had a bit of a learning curve for me. It’s not really a full build tool so we had to investigate using several extensions to manage building our war file and doing a little file manipulation that is not native. It’s working pretty reliably now and it’s pretty easy to make minor changes to the process as new feature are added to the site.

AWS S3

We also had to write some custom code to interract smoothly with the amazon s3 service. Lucee has some native s3 capability, but we found that it just didn’t perform well, so we wound up writing some custom code that calls the aws s3 api directly. The code is wrapped up in a couple of components that allows us to invoke all of the S3 functions exposed by the s3 API as opposed to just simple put, get and delete. It’s important to be able to control the rights on files you upload so they can be used by the website.

AWS Lambda

The site uses a lot of product images that get standardized and optimized for the site. In conjunction with our custom s3 library to upload image files to s3, we also have a lambda script that gets triggered whenever a file gets dropped in the product images bucket. The lambda process takes the dropped image, crops it to the proper dimensions for use on the site and them make 3 different resolutions and puts them back in the appropriate s3 buckets. Pretty neat. Since the image manipulation is handled asynchronously, the response time for the users uploading the images is really fast. We used to use the image manipulation capabilities of lucee for this, but it took an eternity. The lambda process saves us a lot of time when working with images. It easily handles uploading 6 or more high resolution images which would blow out the java heap when trying to do it with lucee.

Wrapup

Having this site available to work on in my spare time has been a great help. I’ve been able to use a ton of technologies I’ve implemented on this site at my day job. Being able to explore new technologies as they become available on a production site really suits the way I like to work. While I doubt I will build another side project using the exact same tech stack, I’ve certainly learned a lot and look forward building the site into something that scales well and provides a decent end user experience.

comments powered by Disqus
comments powered by Disqus