- 26
- 109 499
microapis
United Kingdom
เข้าร่วมเมื่อ 5 พ.ค. 2006
Hi! I'm Jose Haro Peralta, or just Jose. I'm a consultant, author, and insturctor based in London. I'm the author of Microservice APIs (www.manning.com/books/microservice-apis), the founder of microapis.io, and the creator of some popular open source libraries like fencer (github.com/abunuwas/fencer).
Check out my latest online course: 𝐁𝐮𝐢𝐥𝐝 𝐀𝐏𝐈𝐬 𝐰𝐢𝐭𝐡 𝐏𝐲𝐭𝐡𝐨𝐧: 𝐅𝐚𝐬𝐭𝐀𝐏𝐈 𝐄𝐝𝐢𝐭𝐢𝐨𝐧 👇
✅ microapis.teachable.com/p/build-apis-with-fastapi
For years I've worked with companies big and small all around the world to help them build microservices, deliver API integrations, automate their infrastructure, write better code, and adopt best practices.
My goal in this channel is to share with you everything I've learned over the past years about writing software and architecting systems.
I also write regularly in my newsletter 👇
✅ microapis.substack.com/
If you find my content interesting, don't forget to subscribe to my channel!
Check out my latest online course: 𝐁𝐮𝐢𝐥𝐝 𝐀𝐏𝐈𝐬 𝐰𝐢𝐭𝐡 𝐏𝐲𝐭𝐡𝐨𝐧: 𝐅𝐚𝐬𝐭𝐀𝐏𝐈 𝐄𝐝𝐢𝐭𝐢𝐨𝐧 👇
✅ microapis.teachable.com/p/build-apis-with-fastapi
For years I've worked with companies big and small all around the world to help them build microservices, deliver API integrations, automate their infrastructure, write better code, and adopt best practices.
My goal in this channel is to share with you everything I've learned over the past years about writing software and architecting systems.
I also write regularly in my newsletter 👇
✅ microapis.substack.com/
If you find my content interesting, don't forget to subscribe to my channel!
Running applications in Docker [2024] (Python + FastAPI example)
Run applications with Docker!
The code for this tutorial is available here: github.com/abunuwas/short-tutorials/tree/main/fastapi-docker
To follow along with the tutorial, please install Docker (www.docker.com/) in your system and follow the instructions to the get Docker daemon up and running. The Daemon must be running to be able to run Docker processes.
What is Docker? Docker is a virtualization technology that allows you to build lightweight images. Docker shares the kernel with the host machine instead of running its own kernel as traditional virtual machines do.
Say what...?
Let's put in simple terms: Docker is an engine that allows you to run your code in completely isolated environments. Docker builds are called images. When we run an application based on a Docker image, we create a container. Think of containers as instances of the image.
The great thing about Docker is that you can use the same build (image) and run it anywhere, so you get reproducible environments. You can get the same code that runs in production and run it in your machine. This is great for debugging and troubleshooting problems in production.
Docker images can be run on any platform that has a Docker engine, which allows us to replicate the same environment in production and in local. The process that runs off a Docker image is called a container.
This tutorial shows you how to dockerize a FastAPI application, but you can apply the same approach to any other Python application or applications from any other stack.
Let's go!
00:00 Introduction
01:39 Walk through the code
03:30 Installing dependencies and running the application
04:57 Install Docker
05:39 Creating a Dockerfile (touch Dockerfile)
13:37 Building a Docker image (docker build -t image:tag)
14:47 Listing Docker images (docker image ls)
15:35 Run the application as a Docker container (docker run)
17:56 Running the Docker container in the background (docker run -d)
18:24 docker ps (get a list of running Docker containers)
18:40 Step within a running Docker container (docker exec)
21:09 Stop Docker containers running in the background (docker ps + docker stop)
21:20 Run containers with a bash session
22:18 List all stopped containers (docker ps -a)
23:03 Resume execution of a stopped container (docker start)
24:22 Deleting stopped containers
25:31 Deleting a Docker image
26:05 Tutorial followups
26:54 Wrapup
#python #fastapi #render #devops #deployments #rdocker
The code for this tutorial is available here: github.com/abunuwas/short-tutorials/tree/main/fastapi-docker
To follow along with the tutorial, please install Docker (www.docker.com/) in your system and follow the instructions to the get Docker daemon up and running. The Daemon must be running to be able to run Docker processes.
What is Docker? Docker is a virtualization technology that allows you to build lightweight images. Docker shares the kernel with the host machine instead of running its own kernel as traditional virtual machines do.
Say what...?
Let's put in simple terms: Docker is an engine that allows you to run your code in completely isolated environments. Docker builds are called images. When we run an application based on a Docker image, we create a container. Think of containers as instances of the image.
The great thing about Docker is that you can use the same build (image) and run it anywhere, so you get reproducible environments. You can get the same code that runs in production and run it in your machine. This is great for debugging and troubleshooting problems in production.
Docker images can be run on any platform that has a Docker engine, which allows us to replicate the same environment in production and in local. The process that runs off a Docker image is called a container.
This tutorial shows you how to dockerize a FastAPI application, but you can apply the same approach to any other Python application or applications from any other stack.
Let's go!
00:00 Introduction
01:39 Walk through the code
03:30 Installing dependencies and running the application
04:57 Install Docker
05:39 Creating a Dockerfile (touch Dockerfile)
13:37 Building a Docker image (docker build -t image:tag)
14:47 Listing Docker images (docker image ls)
15:35 Run the application as a Docker container (docker run)
17:56 Running the Docker container in the background (docker run -d)
18:24 docker ps (get a list of running Docker containers)
18:40 Step within a running Docker container (docker exec)
21:09 Stop Docker containers running in the background (docker ps + docker stop)
21:20 Run containers with a bash session
22:18 List all stopped containers (docker ps -a)
23:03 Resume execution of a stopped container (docker start)
24:22 Deleting stopped containers
25:31 Deleting a Docker image
26:05 Tutorial followups
26:54 Wrapup
#python #fastapi #render #devops #deployments #rdocker
มุมมอง: 397
วีดีโอ
Deploy with render.com tutorial (FastAPI example)
มุมมอง 9313 หลายเดือนก่อน
Deploy FastAPI applications to render.com! The code for this tutorial is available here: github.com/abunuwas/short-tutorials/tree/main/fastapi-render To follow along with the tutorial, please create an account with Render here: render.com/. I recommend signing in with GitHub to automatically link Render to your GitHub account. You don't need a paid subscription to follow the tutorial. How do yo...
Validate JWTs issued by Auth0 in FastAPI
มุมมอง 8534 หลายเดือนก่อน
Validate JSON Web Tokens (JWTs) issued by Auth0 in FastAPI To follow along with this tutorial, you need an account on auth0.com. Also make sure you follow all the steps in the previous videos: - "Setting up Auth0 for API Authentication and Authorization" (th-cam.com/video/PbUcQUQ7K2o/w-d-xo.html) to set up your Auth0 account - "Login and issue API access tokens with Auth0 and FastAPI" (th-cam.c...
Login and issue API access tokens with Auth0 and FastAPI
มุมมอง 2.6K4 หลายเดือนก่อน
Login and issue API access tokens with Auth0 and FastAPI To follow along with this tutorial, you need an account on auth0.com. Also make sure you follow all the steps in the previous video, "Setting up Auth0 for API Authentication and Authorization" (th-cam.com/video/PbUcQUQ7K2o/w-d-xo.html), since we'll use that set up to integrate FastAPI with Auth0. The code repository for this tutorial is a...
Setting up Auth0 for API authentication and authorization
มุมมอง 4.4K4 หลายเดือนก่อน
Setting up Auth0 for API authentication and authorization. To follow along with this tutorial, you'll need to create an account on auth0.com. Go with the free tier. You won't need paid features for most applications. Login, user registration, managing sessions, issuing access tokens... these are some of the most complex things when building a new web service or an API. For junior developers, it...
Git tutorial for beginners [2024]
มุมมอง 805 หลายเดือนก่อน
Git is the most popular and widely used source control management tool. If you're a developer, you probably use git. And if you're not using it, you should! The problem is, in my experience, most developers are not familiar with Git. And this is a big blocker in their work. Becoming a proficient Git user is fundamental for any software developer, so I thought I'd put this short tutorial togethe...
FastAPI severless deployments on AWS
มุมมอง 5715 หลายเดือนก่อน
The GitHub repository for this video is here: github.com/abunuwas/short-tutorials/tree/main/fastapi-serverless What's the best way to deploy a FastAPI application? I hear the question a lot. The truth is, there are many different ways to deploy a FastAPI application! When looking for a deployment model, we have to look at 3 parameters: 1) Cost 2) Scalability 3) Easy of deployment The first para...
Create IAM users on AWS with temporary credentials (the right way)
มุมมอง 5535 หลายเดือนก่อน
Do you have an AWS account? Are you adding users directly through IAM? If that's your case, watch this video! Traditionally, we'd add users to AWS accounts through the IAM service. We'd log in directly to the account using those profiles, and we'd create AWS access keys for the CLI. This way of managing access to AWS is deprecated and highly insecure. Why? Because those AWS access keys are long...
Create custom middleware with FastAPI
มุมมอง 1.1K5 หลายเดือนก่อน
Create custom middleware with FastAPI The code for this tutorial is available on GitHub: github.com/abunuwas/short-tutorials/tree/main/fastapi-middleware What is middleware? Middleware is a layer that pre-processes requests in web servers. Before a request reaches our controllers, i.e. the functions that implement endpoints/URLs in our API, there's a pre-processing stage. In that stage, the fra...
API pagination with FastAPI and SQLAlchemy
มุมมอง 2.9K10 หลายเดือนก่อน
Pagination is the ability to sequence a collection of items into smaller chunks. For APIs, pagination is incredibly important to safeguard the health of our services. Imagine you have a very large collection of items in your database (millions of records). If you were to return the whole collection to every user in a single fetch, that would put tremendous pressure on your system and cause perf...
Build APIs with Flask (the right way)
มุมมอง 13K10 หลายเดือนก่อน
Flask is a hugely popular Python web development framework. Tons of websites are built with Flask, and tons of them contain APIs. I've had the privilege to work with many companies building APIs with Flask, I've seen some common errors and anti-patterns, and I've put together a bunch of best practices. This video teaches you how to avoid some common mistakes when building APIs with Flask and ho...
Using the Repository Pattern for better data access encapsulation (in Python)
มุมมอง 12K2 ปีที่แล้ว
Using the Repository Pattern for better data access encapsulation (in Python)
Thank you. Simple and sweet. Easy step by step
Thanks for video, but I don't understand, should I create my own API ( I mean API resource inside Auth0 dashboard). Because right now I don't see need and not clearly understand. I have an Admin app with React and iOS app with content and backend On UI I authorize through password grant via Authentication Auth0 API, on backend side I just validate the ID token to access resources of my API Why to create API inside auth0 dashboard?
Very helpful thank you
Your coverage is below 20% 😮
Why do you call _id a class property instead of a private property?
Very clear explanation. I just miss the explanation of a change in the data model, so you had shown the power of alembic. Anyway, thank you a lot for this introduction
Hola Jose, thank you for your video. As a .NET developer currently working with Python, I feel uneasy when I see global dependencies, loosely typed parameters... I find your more professional demos to be particularly useful. Have a question: could you explain the purpose of the RepositoriesRegistry? I'm wondering if it would be possible to simply pass the BookingsRepository as a parameter instead of creating a RepositoriesRegistry. What is the benefit of using RepositoriesRegistry in this context?
It’s not repository pattern, it’s trash, gl
Happy to help if you have any questions or difficulties understanding how it works!
@@microapis u need to read Martin Fowler, why u try to teach someone?
@@jcatstreams8550 Fowler is a good start, but it only scratches the surface. To learn more about repositories, check out Eric Evan's "Domain-Driven Design". In addition to reading these books, I always recommend to work through the examples, and to think of how to apply them to different situations. Again, if you have any questions or difficulties working out the repository pattern I'm here to help!
Would be great if you showed the imports whenever you added one... i was importing fields incorrectly... also having code would be great :)
In one of my projects, I added a middleware to check a header value (like an API KEY value) and blocked the requests if value was not validated. Is it a right approach to authorize requests to our API?
I really appreciated the way how you explain. Thank you. It came at the right time that I stumbled into your video.
Good. Alex Tech Projects
Thank you, this is very helpful. One thing is that I don't see Groups. Is there a feature for Groups? I only see Users, Roles and Permissions but it seems Groups is missing. Also I saw someone saying about Authorization Extension, have you tried that? Does it work? That extension seems to have Groups but I'm not sure if it works.
Thats cool Now it feels like we are a real developers will share resources for what to do next Thanks, keep up ❤
Thank you @allalonetech 🙌!! I have more Docker videos coming up, about SQLAlchemy, Django, GraphQL, and API security 🚀🚀
@@microapis we need FastApi first
Thanks for watching! Don't forget to like and subscribe! What other topics would you like me to over in future videos?
Your presentation is always helpful for me. Thank you so much!
Thank you for your kind comment 🙏! I'm really glad to hear you find the content helpful 🙌!
Hello, I am currently learning FastAPI and Python after working as an Android developer for 6 years. Your channel is very helpful to me, thank you! Could you please cover the topic of deploying on AWS? For example, I have FastAPI and Celery, and I'm finding it difficult to figure out how to deploy them on AWS Lambda. Right now, I am using a regular VPS for hosting, but it is expensive for me, especially when my server is not under load.
Hi sorry for my late reply! I have a tutorial about deploying FastAPI applications to AWS serverless: th-cam.com/video/CTcBLrR32NU/w-d-xo.html. Deployment is straightforward and works fairly well for most use cases. The only thing to bear in mind about AWS serverless is that you'll have a max timeout of 30 seconds and the process will exit after that. Only question is how are you using Celery? Is it for long-running background tasks?
@@microapis Thank you for the response! Yes, my background task takes a long time, from a few minutes to an hour. I generate images for my content using OpenAI.
@@vladyslavprykhodko2155 sorry for my late reply! Background tasks won't do well in serverless since the whole process will exist as soon as the API returns or times out. In this setup, I'd recommend using an SQS queue to manage the tasks and a separate Lambda to process those tasks asynchronously. That way, the asynchronous Lambda will have up to 15 minutes to do the job. If what you're doing is generating images, you can upload those images to s3 and you can serve them from there. All of those would be fairly cheap to operate since the Lambdas only run when needed and s3 costs are minimal for a task like this
Thanks for watching! Don't forget to like and subscribe! Did you deploy something after following this tutorial? Share the link with in the comments! What other topics would you like me to cover in future tutorials?
Hey man, thanks for your work. Im spinning up a personal project and i chose Flask for the RESTapi. This video is perfect, thank you. Subbed btw haha
Thank you I'm so glad you found it useful 🙌! Flask is an excellent choice and very powerful when used properly. Good luck with your project and feel free to reach out if you have any questions!
And I'am sorry, can we talk about programming in some messangers? Like Discord I want create project with react and fastapi, but i don't understand how i can do it
with auth0 i don't understand))
Sure! Feel free to ping me on Discord, my handle is @joseharoperalta. I've also created a Discord community for people interested in APIs, feel free to join if you'd like to: discord.gg/fCjxmfJv
Hi! Great videos of theme auth0. Can u create simple project with auith0? I want to see how i can use rbac with endpoints in fastapi. In my mind okta's docs is not userfriendly((
Hi Pavel thank you for your kind words! That's a great idea I'll put together an example of using RBAC in an API!
Thanks for the video, does this work with the standard /callback flow that they talk about? I'm finding with my own implementation, I'll redirect to the auth0 page, user will sign up, and then on the callback I will get a CSRF issue because there is no persistence with the sessions
Great video! Thanks for this, life saver
Thank you for your kind words 🙏! Really glad to hear you found it useful 🙌🙌!
Your lecture is very useful for me. Thank you so much.
Thank you for your comment I'm really glad to hear you found it helpful 🚀!
Thanks for watching! Don't forget to like and subscribe! What other topics would you like me to cover?
the best
Thank you 🚀🚀!!
cant believe this is free....
Trying to help as many people as possible 😄!
appreciate of your working!
Thank you 🙌!
THANK YOU! so much love from Korea ㅜㅜ
Thank you for your kind words 🙏🙏! Will be in Korea 🇰🇷 in September, looking to arrange an API security workshop!
Fantastic video, easy to follow and straightforward process that builds on the each previous step. Looking forward to the next video in the series. Thank you for this video José! Danny
Thank you for your supportive comment Danny 🙌!! Aiming to post the next video later this week 🚀🚀!!
Good video, straight to the point and easy to understand, I will be waiting for more videos about the authorization flow more specifically about the use of refresh tokens and logout.
Thank you for your kind comment and for the suggestions 🙏!! I have those videos in the pipeline for the coming weeks 🙌!
Thanks for watching! Don't forget to like and subscribe! Let me know in the comments what other topics you'd like me to cover in future videos!
Really nice video, and I appreciate your experiential knowledge. This is something that isn't easy to find.
Thank you for your kind words 🙏! This is the exact reason why I created this channel 🚀🚀!
Thanks for your video
Thanks for your support 🙌!
Thank you so much.
Thanks for your support 🙌!
Thanks for watching! Don't forget to like and subscribe! What other topics would you like me to cover in future videos?
Great video an Example with springboot would be helpful
@@ankitpatil5231 Thank you for your support and your suggestion 🙌! I'll look into putting together a tutorial as soon as I can!
Very nice.
Thank you Kelvin 🙌!
so can I implement this IAM Identity Center to limit the number of servers and databases the user can access using permission sets right? my company wants to properly implement strict measures on who and when some devs/data engineers can access some resources.
Thanks for your question! Permission sets are collections of IAM policies. With IAM policies, you can be absolutely granular on how users can access resources. So you can create a policy that gives read-only access to a specific S3 bucket, or a certain path within that bucket. Another policy with specific permissions to an EC2 instance or an RDS database, and so on. Then you can bring those policies together under a permission set. Is that the kind of access control you're looking for?
Thanks for watching! Don't forget to like and subscribe!
I think your performance is outstanding. It will be great help to me. Thank you so much.
Thank you for your kind comment and your support 🙌!
Thanks for your efforts. That'll be helpful for us.
It's my pleasure thank you for your comment 🙌!
Thanks for everything
Thank you for your support 🙌!
Thank you for watching! Don't forget to like and subscribe!
Thanks for watching! Don't forget to like and subscribe!
this explain is a joke? do you mean a program that are PROGRAMED DÃ to answer without a response of the home server from the "page". yes economy data sharing = only download, no upload. _l_ that would not be fake avertising from server providers?
Not sure if you’re commenting on the right video but to clarify this is a video about middleware, specifically about web middleware. Middleware is a layer of software that sits between the receiving end of your server and your controllers and allows you to apply various processing steps on each request
Thank you for watching! What other concepts would you like me to explain?
thank you
Thank you!
Thank you for watching!
Thank you very much, you help me a lot! Congrats for this video.
Thank you for your kind comment @rafaelfurquim745 🙌!