Freelance Web App with Rails 5.1 API and React Frontend, Part 0: Why?
Chazona Baum Nov 14 '17
In my rush to try to earn something from my code learning so far, I've had to shelve some of my plans to dive deeper into Ruby on Rails and to learn front end frameworks like Angular and React. When marketing freelance work to non-coders, the most common request seems to be to make something fast, pretty and cheap, which means focusing on static or WordPress sites.
But I'm finding that trying to reach out to potential clients the traditional way is extremely inefficient, especially when conversion rates as a newbie freelancer are basically nonexistant. And solutions for non-technical folks to manage their clients and improve their sales are expensive when it might take several months to actually earn anything.
So it seems to make sense to go ahead and put together an app that will allow me to keep track of and reach out to leads, as well as managing proposals and project documents, and provide clients with access to materials relevant to them. Once the basics are there, I'll look at integrating an invoicing API like FreshBooks to get more out of the app.
And since it's been a while since I've blogged about what I'm learning, this seemed like a great opportunity.
Over the next few weeks I'll be building a freelance dashboard app, using Rails 5.1 for the API backend, and React.js on the front end.
You can either wait for the next post to start building, or feel free to dig a bit deeper into why I went with this stack below:
I'm setting aside for a moment the fact that I love working with Ruby, since it's not always going to be the best tool for the job.
For one, Rails is pretty fast and easy to set up compared to other options. Given that I intend to use this toward trying to make some income soon, being able to get something up quickly and iterate improvements is a huge advantage.
If I wanted to build the back end and front end in the same application, Rails makes that easy, too. Starting with 5.1, Rails includes Webpack and makes it easy to create apps that use front end frameworks and libraries like Angular, React, Vue, or Ember rather than jQuery. I've played around with that a bit, but I think I'd still rather separate out these two key parts into an API and a front end app.
Rails is also well-known for being a great framework for building RESTful APIs. Rails 5 even provides an API mode that makes getting a JSON API up and running even smoother.
And I have some basic experience building applications with Rails. While I want to learn new things, having some familiarity with the back end will help get this built quicker, especially since I'm picking a front end framework I have no experience with.
If I didn't go with Rails, I would have considered:
- Phoenix - Phoenix is built on Elixir, and the framework was recently brought to my attention as a more performant alternative to Rails. I definitely want to play around with the pair some, but possibly on a different project. Plus, the performance issues with Rails are generally more of a problem when it's a lot bigger than I expect this to get.
- Sinatra - Sinatra is another Ruby-based option, one that's supposed to be great for tinier applications where Rails might just get in the way. I'm expecting this app to be a little larger than one I might use Sinatra for, though I'm eager to try it out on a project one of these days.
React has gotten a lot of attention lately between concerns about licensing issues (which it seems were ultimately much ado about nothing) and its parent company Facebook constantly ending up in the headlines.
React is also a more mature framework than Vue, while having fewer breaking changes than Angular.
And React also has the benefit of React Native. If I wanted to implement a native mobile app for this web application, which I eventually do, React Native makes it much easier.
If I didn't go with React, I would have considered:
- Vue.js - Vue, like Ruby, is a joy to use. I've tinkered with it before to build a simple Pokémon-based monster battle game. If I wasn't going with React, I would have definitely gone with Vue to have the most flexibility with my front end.
- Angular - The other pragmatic approach, Angular is used by a lot of companies I know. It's also frequently paired with Rails.
I considered breaking this project up into microservices to make individual features easier to develop and maintain, and initially started it that way. However, it's been brought to my attention that microservices should be left to situations where teams of people will be working on different services, so this project will take a monolithic approach.
And since I'll be attending RubyConf this week, posts about this project may be interrupted by posts about the conference.
This should be a fun project to work on, and I look forward to showing you along!