Fireship · @fireship
Make Money from your API Tutorial
Uploaded October 28, 2021 · Length 13:10
Summary
Learn how to build and monetize an API with Node.js, Express, and Stripe, handling authentication and metered billing subscriptions.
- api monetization
- node.js api
- stripe payments
- metered billing
- api keys
- express framework
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
APIs are big business. If you build one that developers love, you've got a billion-dollar
- 0:04
startup on your hands. And thanks to modern cloud technology, you can throw a monetized API together
- 0:09
in your mom's basement in just a few minutes. In today's video, you'll learn how to 1. Build an
- 0:13
API with Node.js and Express, 2. Handle authentication and generate API keys for your
- 0:19
users, and 3. Monetize it with metered billing subscriptions using Stripe, where the customer is
- 0:25
billed for each API request. By the end of the video, you'll understand the steps required to
- 0:29
make money from your SideHustle API. If you're new here, like and subscribe, and if you want to learn
- 0:33
more about payments, check out my full-stripe course on Fireship.io. Let's start by taking a
- 0:38
look at how APIs work from a high level. The owner of the API deploys some code to a server. That
- 0:43
server might have a bunch of HTTP endpoints that do something useful, like maybe retrieve the current
- 0:48
weather from a set of GPS coordinates. Other developers out there want to use this data,
- 0:52
but they don't want to have to implement a solution on their own, so they reach out to
- 0:56
you for permission to make requests to your server. You say sure, no problem, just create
- 1:00
an account and put a credit card on file and I will give you an API key.
- 1:04
Sounds good, how will this work? Whenever you make a request to my server,
- 1:08
just attach this API key and I'll keep track of the number of requests you make each month.
- 1:11
How much does one API request cost? It'll cost $1 per request and I'll charge your credit card
- 1:17
for the volume of usage at the end of the month. You got yourself a deal, take my money.
- 1:22
To build something like this, we'll need both front-end and back-end code.
- 1:25
On the front-end, we'll need a place for a user to add a credit card and manage their subscription details.
- 1:30
Luckily, Stripe will host and manage all of the front-end code for us,
- 1:34
which is made possible with a product known as Stripe Checkout that allows us to focus on the back-end.
- 1:39
Now, even though Stripe makes our lives much easier, there are even more simplified solutions out there like Rapid API.
- 1:45
If you want to learn more about it, Anya Kubo has an excellent video about it.
- 1:48
It's basically API monetization as a service, but the main drawback is they take a much larger cut of your revenue.
- 1:55
What we're doing in this video is more low-level, but allows us to keep all of our money minus the Stripe fees.


