Skip to content

Backend: Setting up a local development environment

Tim K edited this page Sep 3, 2018 · 10 revisions

Why do I need a local development environment?

Note: VSTS stands for Visual Studio Team Services.

Since Fizzyo backend is a complex system, there are multiple non-trivial steps you have to follow to setup your own local backend instance. Some developers think that this initial effort is not worth it, and choose to use the online staging environment instead. This approach is not desirable, as it makes development less efficient in the long-term.

What you lose if you only use the staging environment:

  • ❌ You have to wait for your code to be deployed every time you make a change. This means that even if you change a single letter in your code, you need to spent at least a minute to see your change in action. This is because you'll need to open the VSTS web portal to trigger a new deploy, and then wait 40 or more seconds for VSTS to build the source code, upload it to the server and wait for apps to be restarted.
  • ❌ You never know if your data will be there tomorrow. Imagine you're testing a new feature and you added some dummy data to the staging database, just to play around with the implementation. Since safety of the staging database is not guaranteed, someone can delete all of your data or drop the whole database entirely.
  • ❌ Your work can clash with the work done by someone else. If you're both trying to deploy a new feature to the staging environment at the same time and there's a bug in your code, trying to figure out whose code was the culprit becomes a nightmare.

What you gain if you setup a local development environment:

  • ✅ You can test your changes almost instantly. Since you're working locally, there is no need to push any code online. There's also no need to wait for Visual Studio Team Services to deploy your code to the Fizzyo server.
  • ✅ Your local database is safe. Since your local database is hosted on your machine, you're the only one who can make changes to it, meaning you will never lose development data because someone else dropped the database.
  • ✅ You are less likely interrupt someone else's work. Oftentimes the staging environment is used for demos and presentation to end users. You don't want to ruin someone's presentation by pushing broken code online because you couldn't test it locally.
  • ✅ The Git commit log for Fizzyo-backend stays nice and clean. Since you can debug everything locally, you don't have to create any new commits until you're confident that the new feature works as expected. Once you're done, you can push the feature as a single commit (with a descriptive commit message).