Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Full Stack FastAPI, React, and MongoDB

You're reading from   Full Stack FastAPI, React, and MongoDB Fast-paced web app development with the FARM stack

Arrow left icon
Product type Paperback
Published in Aug 2024
Publisher Packt
ISBN-13 9781835886762
Length 312 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (4):
Arrow left icon
Shrey Batra Shrey Batra
Author Profile Icon Shrey Batra
Shrey Batra
Rachelle Palmer Rachelle Palmer
Author Profile Icon Rachelle Palmer
Rachelle Palmer
Shubham Ranjan Shubham Ranjan
Author Profile Icon Shubham Ranjan
Shubham Ranjan
Marko Aleksendrić Marko Aleksendrić
Author Profile Icon Marko Aleksendrić
Marko Aleksendrić
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Chapter 1: Web Development and the FARM Stack 2. Chapter 2: Setting Up the Database with MongoDB FREE CHAPTER 3. Chapter 3: Python Type Hints and Pydantic 4. Chapter 4: Getting Started with FastAPI 5. Chapter 5: Setting Up a React Workflow 6. Chapter 6: Authentication and Authorization 7. Chapter 7: Building a Backend with FastAPI 8. Chapter 8: Building the Frontend of the Application 9. Chapter 9: Third-Party Services Integration with FastAPI and Beanie 10. Chapter 10: Web Development with Next.js 14 11. Chapter 11: Useful Resources and Project Ideas 12. Index 13. Other Books You May Enjoy

Why use MongoDB?

MongoDB is a free, fast, and scalable database with a JSON format and simple syntax. It enables flexible schemas and, thus, iterative and rapid development. MongoDB is able to accommodate data structures of varying complexities. Additionally, its querying and aggregation methods make it an excellent choice for a flexible REST API framework such as FastAPI, coupled with an official Python driver such as Motor. It has a high level of adoption and maturity and is one of the pillars of the NoSQL data storage movement that took the web development world by storm a decade ago.

The following are some other features that will be detailed for use in this book:

  • Complex nested structures: MongoDB documents allow other documents and arrays of documents to be embedded, which naturally translates into the data flow of a modern data web app (for example, you can embed all comments into the blog post they respond to). Denormalization is encouraged.
  • Simple, intuitive syntax: The methods for performing basic create, read, update, delete (CRUD) operations, coupled with powerful aggregation frameworks and projections, allow you to achieve almost all data reads quite easily through the use of drivers. The commands should be intuitive for anyone with a bit of SQL experience.
  • Community and documentation: MongoDB is backed by a mature company and a strong community, and it offers various tools to facilitate the development and prototyping process. For instance, Compass is a desktop application that enables users to manage and administer databases. The framework of the serverless functions is constantly being updated and upgraded, and there are excellent drivers for virtually every programming language.

Of course, MongoDB is not a silver bullet, and some challenges are worth noticing upfront. On the one hand, the schema-less design and the ability to insert any type of data into your database might be a bit panic-inducing but translates to the need for stronger data integrity validation on the backend side. You will see how Pydantic—an excellent Python validation and type-enforcement library—can help you with stronger data integrity. The absence of complex joins, which are present in the SQL world, might be a dealbreaker for some types of applications.

Now that you understand what MongoDB brings to the table in terms of scalability and flexibility, with its schema-less approach, take a look at the REST API framework of choice, FastAPI, and learn how it can help you implement that schema-less approach and simplify your interactions with the data.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime