Fastapi React Mongodb

screenshot of Fastapi React Mongodb
react

A minimal FARM stack boilerplate / template project to get you started with a Python FastAPI backend, React frontend, MongoDB, and JWT user authentication (via FastAPIUsers).

Overview

The FastAPI-React-MongoDB template is a minimal boilerplate project that provides a starting point for developing a web application with a Python FastAPI backend, React frontend, MongoDB database, and JWT user authentication. It includes a React frontend with the React-Bootstrap styling framework and React-Icons library, an authentication system for the FastAPI backend using JWT tokens, examples for creating protected routes and regular routes, and examples for creating MongoDB collection schemas. The template is inspired by other projects such as tiangolo's FastAPI full stack project and Buuntu's fastapi-react project.

Features

  • FastAPI: FastAPI is used as the backend server for the web application.
  • FastAPIUsers: FastAPIUsers is a Python package for backend user authentication using JWT tokens.
  • React: React is used as the frontend library for building the user interface.
  • React-Bootstrap: React-Bootstrap is used as the frontend styling framework.
  • React-Icons: React-Icons is used as the frontend icons library.
  • MongoDB: MongoDB is used as the database server for storing data.
  • Motor: Motor is an async MongoDB connector for Python, used for interacting with the MongoDB database.

A. MongoDB Database

  1. Install MongoDB 4.4.0.

B. Python/FastAPI Backend

  1. Install Anaconda.
  2. Create a new Anaconda virtual environment using the requirements.txt file.
  3. Activate the virtual environment.
  4. Navigate to the root directory where the backend, database, and frontend directories are located.
  5. Install the Python packages to the virtual environment.
  6. Deactivate the virtual environment.

C. React Frontend

  1. Install Node Package Manager (npm).
  2. Navigate to the /frontend directory where the package.json file is located.
  3. Install the React dependencies using npm.

Summary

The FastAPI-React-MongoDB template is a boilerplate project for getting started with a web application that combines a FastAPI backend, React frontend, MongoDB database, and JWT user authentication. It provides essential features such as authentication, protected routes, MongoDB collection schemas, and common frontend libraries like React-Bootstrap and React-Icons. The installation instructions guide users on setting up the MongoDB database, installing the necessary dependencies for the backend and frontend, and starting the servers for development.

react
React

React is a widely used JavaScript library for building user interfaces and single-page applications. It follows a component-based architecture and uses a virtual DOM to efficiently update and render UI components