-->
I’m currently working on a new project (still in stealth mode), and I’ve been trying figure out what architecture would work best for my situation. So, lately I’ve been messing around with the latest web stack technologies to assess their production-readiness, to check out for how easy (or hard) it would be to develop in them, and get a feel for the community surrounding them.
First, I needed to figure out what my requirements where, keeping in mind that this was a consumer-oriented application.
My bread and butter framework over the last 6 years has been Ruby on Rails, but it looks like it doesn’t really fit the bill in this particular situation. While it feels like I’ve wasted a few weeks with not much progress to show, laying out the groundwork and doing thing right the first time will save you months of work down the road. Now, without going into too much detail (like how I questioned my sanity trying to set up a working environment with webpack), here’s what I decided on.
Since I needed this to work with serverless, Ruby was unfortunately out of the question. Based on what’s popular in the community, as well as the few languages supported on AWS Lambda, I narrowed it down to JS and Python. JS has been growing in popularity in the backend, but after creating a barebones app in NodeJS, it felt like all the tools and libraries were a bit too divided. There’s too much focus on chasing the next hot thing, and “standards” become deprecated much too fast. It’s like there’s not a tried and true way of doing things. It’s like everthing was in the CADT Model. I need stability here!
So that leaves good ol’ Python. After learning about the existence of Zappa, it turns out you can have your cake and eat it too! With authentication, admin interface, database migrations, and many more useful features out of the box, going with Django and the Django REST Framework (DRF) was a no brainer.
I’ve also decided to keep using PostgreSQL as my database engine. Most of the serverless guides out there recommend diving into the deep end with your cloud provider and their services (e.g. AWS Cognito, DynamoDB, etc.), but I wanted the option to migrate to something else easily. For example, at the time of writing this article, there was no way to export data out of AWS Cognito; it looks like I’ll be managing users myself. Plus, as far as cost is concerned, it seems like RDS can be cheaper than DynamoDB when considering performance to cost ratio, especially if you have a lot of tables.
Since I wanted a clean separation between frontend and backend, I’ve decided to stay away from Django’s templates. Considering that I’d like to have mobile apps of my service in the future, I ended up going with ReactJS since a lot of the knowledge can be transferred to React Native.
And yes, I realize I said JS development is a hot mess earlier, but in this case I decided to overlook it. I’ve spent about two weeks working with ReactJS so far and I’m just starting to enjoy using it. The declarative approach is way better than what I was doing before with jQuery and manually updating DOM elements after AJAX calls.
That said, you absolutely must spend the time getting your environment, code structure, and workflow set up correctly. Why? Because despite the many improvements that ReactJS provides, it’s still incredibly easy to write terrible frontend code. To prevent this, I recommend going with at least the following libraries to get you in the right mindset and keep your sanity: React Router, Redux(with Redux Dev Tools, Redux Thunk), Babel, fetch, and Webpack to tie it all together. I also recommend starting with Ant Design over bootstrap to make your UI shine (Ant Design has spent a lot of effort translating their docs into English lately, and everything just makes a lot of sense).
I went through a lot of trouble figuring things out, especially since pure frontend development was out of my comfort zone, so next time I’ll make a full-stack boilerplate app with all of the technologies above so that it’s easy for others to get started.
Disclaimer: In order to provide you with ongoing content, this website participates in affiliate advertising programs, such as Viglink, which are designed to provide a means for sites to earn advertising fees by advertising and linking to commercial websites. This means that we may sometimes get paid if you click one of those links and purchase a product or service.