This code is an example FARM (FastAPI, React, MongoDB) project that implements a simple TODO List system.
The FARM stack is FastAPI, React, and MongoDB. It is a simpler form of the MERN stack that can make developing apps even faster. You will learn how to connect this with a mongoDB database. Then you will learn to connect the backend to the frontend. A React app will send and receive HTTP requests to and from the server.
Before Configure the FARM project, you need to install:
- Python 3.6 or higher Python. (What is recommended for a FastAPI project)
- Node.js 12 or higher Node.js
- MongoDB MongoDB.
- After Providing Python in your computer, you need to create your own virtual environment, don't forget to switch to the project directory
/backend
:
# creating virtual environment
$ virtualenv venv
# activate virtual environment
$ source venv/bin/activate
# install all dependencies
$ pip install -r requirements.txt
- You'll need to set the following environment variables before running the project:
# The following will work on Linux & OSX:
cp env.sample .env
- Run the code with the following command:
uvicorn main:app --reload --port 8000
- Here we need to install all dependencies by running the following command:
# I use here the `yarn` command, you can use `npm` instead.
yarn install
- Then we need to run the following command to start the frontend:
# start the frontend part
npm run start