Current section: Project Setup and First Deployment 4 exercises

Intro to Deploy Distributed Apps with Node.js & Fly

Hello everyone! My name is Kent C. Dodds and I'm thrilled that you have decided to join me on this tutorial to learn how to deploy distributed Node.js apps with your data all over the world.

In this tutorial, we'll be deploying our Node.js app and our SQLite database on fly.io.

This has multiple r

Loading lesson


Kent C. Dodds: 0:00 Hey, everybody. My name is Kent C. Dodds, and I am so excited that you have decided to join me on this tutorial to learn how to deploy distributed Node.js apps with your data all over the world. I am excited about this because I feel like it makes for better user experiences and we have some really fantastic tools.

0:19 In this tutorial, we're going to be deploying our Node.js app and our SQLite database on Fly.io, which has multiple regions all over the world so you can get your data and your app as close to the user as possible.

0:33 Their tagline is "Deploy App Servers Close to Your Users. Run your full-stack apps all over the world. No ops required." Fly is amazing at this, so I'm excited to take you through this.

0:45 I want to give you a quick look at our demo app of what we're going to be using and then we can get into this. The demo app itself is actually really simple. It's literally just a counter, but this count is actually persisted in the database and so we can make sure that deploying migrations and stuff happens and we have persistent volumes and all of that.

1:06 We should be able to get pretty good exposure to what Fly is capable of and then you can extrapolate that to more complex applications. The application, like I said, very simple. We have HTTP from Node.js, so it's just like the regular HTTP module, not even using Express or Fastify or any of those.

1:26 We do have Prisma because Prisma has nice migrations. Frankly, Prisma is by far the best ORM for JavaScript, and TypeScript, and Node that I have experienced. It's fantastic. Then we just have basic application code going on in here.

1:42 Nothing that you need to worry yourself too much about. There's not a whole lot here. Like I said, it's pretty simple. It is written in TypeScript, so we make sure that we know where we run things like a build and the same sort of thing for any tests or something like that.

1:58 Then also we have Prisma here so that we know when it's appropriate to run migrations and that sort of thing as well. We're going to get started with this. I hope that you're ready and excited like I am to deploy your distributed app all over the world.

2:14 I'll add one other thing, and that is that deploying distributed apps is a pretty complicated thing in general. Fly makes it straightforward, but the way that I'm going to do this tutorial is that you can follow along with me in your own app and then stop at the point where you feel like I'm getting the right tradeoffs for my application.

2:35 Because in a lot of cases, you don't need to run in multiple regions. You're probably just fine with your particular constraints and use cases and requirements to just deploy to a single region.

2:46 If that's you, then go ahead and stop partway through this tutorial and you can feel free to watch the rest. If you feel like your application necessitates the complexities of multi-region, then continue to follow along with the extra multi-region stuff.

3:03 Maybe eventually our tools will get so good that you won't even be able to feel the difference between deploying in a single region and deploying in multiple.

3:11 With all of that said, I hope that you enjoy this journey with me and that you can build excellent user experiences with the tools that we have these days. See you in the tutorial.