Food managment App using FastAPI and MongoDB on the backend and ReactJS on the frontend.
-
To run the backend, you need to have a local mongodb instance running. To setup a deployed instance using MongoDB Community Download -> Downloading and running Compass is recomended.
-
This project has been built with Python 3.9.0 Python 3.9 Download and Node.js v18.15.0 Node.js v18.15 Download.
To setup .env
file on the backend, create a file named .env
in /backend/app
.
Add the following in the .env
file.
JWT_SECRET_KEY=<RAMDOM_STRING>
JWT_REFRESH_SECRET_KEY=<RANDOM_SECTURE_LONG_STRING>
MONGO_CONNECTION_STRING=<MONGO_DB_CONNECTION_STRING>
# mongodb://localhost:27017/ <-- for local running instances
Assuming you are in the projects base directory
cd backend
pip install -r requirements.txt
Assuming you are in the projects backend directory.
uvicorn app.app:app --reload
Assuming you are in the projects base directory.
cd frontend
npm install
npm start
(Publicly accessible)
Assuming you are in the projects backend directory.
uvicorn app.app:app --reload --host <YOUR_IP_ADDRESS>
In the projects backend directory under app/core/config.py
make the following change:
class Settings(BaseSettings):
...
BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = [
"http://<YOUR_IP_ADDRESS>:3000"
]
...
set HOST=<YOUR_IP_ADDRESS>
npm start
In the projects frontend directory under scr/services/axios.js
make the following change:
const baseURL = "http://<YOUR_IP_ADDRESS>:8000/api/v1/";