Back in 2016, when the idea that would become NewsWave was humming in my head, I was sipping my morning coffee while listening to an episode of Under the Radar.
In that episode, Marco Arment and David Smith were discussing how they used servers to manage Overcast and Feed Wrangler. I was already considering using servers but after that I had decided.
NewsWave Reader was the first app I developed that includes a server component, two years since release here are some of the learnings and experiences that can help if you’re planning to get into servers too.
Depending on the app/service you want to create, using a server comes with many benefits: easily syncing devices, managing payments, providing a searchable repository of information, offloading data tasks from the device to the server, running ML models, crawling the web…
Now, let me clarify something, if you do not need a server, do not use a server. They are overhead, they add another layer of complexity to take care of. Not only that but you’ll need to account for privacy (how much information should you store vs. not store), security (are you covering all the bases to avoid being hacked), scalability (how would your service handle exponential growth)… In addition to that, the more people use your app the more cost you’ll have, API call optimization is key.
But what if you need to use a server, what if your new awesome idea for an app/service requires it. If that’s the case, I have great news, it really is not that hard.
Before starting any discussion on setup I’d suggest you to think about your business model. As I just mentioned, servers have cost, and the more users you have the more cost you’ll have. Make sure you have a business model that’s sustainable, and that’s easier said that done these days. I don’t say that lightly, during the first year of NewsWave I lost money almost every single month, be sure to learn from my mistakes.
Once you have a solid business plan, what about the setup? As Marco suggested in his episode, if you’re an app developer you’re better off sticking with server-side ‘boring’ technologies: they are reliable, efficient and there’s plenty of documentation on the web. I could not be more thankful for his advice, my server stack is using what’s called LAMB: Linux, Apache, MySQL and PHP/Python. Let’s touch on each quickly:
Linux: I use the most solid and stable option possible: Debian. And when choosing what Debian version to use I went with the latest Long Term Release (at the time Debian 9), which gives me years of security updates before I need to update to the next major release.
Apache: Old and trusted, it manages all my websites and web services. Plenty of documentation online, strengths and weaknesses are well known and very reliable. Also, it works easily with certbot for open source HTTPS free certification.
MySQL: Here I was doubting between PostgreSQL and MySQL, both are reliable, scalable and heavily used in the industry. In the end I went with MySQL for the simple reason there was more documentation available in Linode (my host provider, more on that in a minute).
PHP/Python/Pearl: I use a combination of PHP and Python: API’s are all PHP while internal server tasks and Machine Learning models are coded in Python. Again, plenty of documentation online, both languages widely used and not cutting edge.
So let’s say you’ve decided to give it a go, you want to start experimenting, what are the next steps? How do you get started?
First you’ll need a host provider, someone that will host the server in a datacenter. There’s many options out there, I’ve been using Linode and am very happy with it. If you’re just getting started they have what’s called a nano plan for $5/month.
Once you’ve signed up, you can easily create a new linode with the latest Debian 10 LTS and then…
…just follow this instructions to get your server setup & secured with LAMB. Trust me, you’ll be up and running in no time.
Once all is secured and installed, easily connect to it from your terminal and setup your SSH file editor of choice -I personally use terminal for mysql and all server maintenance and Visual Studio Code for Python & PHP development-.
And that’s it, you’re good to go. From here you can start adding websites, training models, creating web services, adding crawlers, sky is the limit… If you mess up, just drop the server and start fresh. Backups are one click away as well, for when things are more solid and the option to rebuild does not look as enticing 🙂
– – –
Looking back I’m very happy to have gone this route, not only I could create NewsWave in the way I wanted but I’ve learned a ton. If you can I’d recommend listening to the Under the Radar episodes: into to servers and follow up questions.
If you don’t need a server don’t get one, but if it will allow you to bring your idea to life, go for it. It looks a lot more scary than it is.
Comments / questions? You can reach me @MarcMasVi on Twitter.
Until next time,
Marc