- Overview
- Tools Used
- Requirements
- Setup
- Backend API Endpoints
- Serverless Deployment
- Cloud Architecture
- Architecture Diagram
- Front End
- Demo
- License
- Contact Me
This project is a backend application built using FastAPI, PyMongo, and Docker. It demonstrates building RESTful APIs that interact with a MongoDB database and includes a serverless deployment option using AWS Lambda and API Gateway.
- FastAPI for building RESTful APIs
- PyMongo for interacting with MongoDB
- Docker for containerized deployment
- JSON Web Tokens for User Authentication
- Hosted on AWS
- ECR to host containerized images
- Lambda Functions to respond to requests
- API Gateway to manage server-client communications
- React
- Next.js
- ShadCN (component library)
- Skeleton Loaders
- Motion Elements
- Fallback functionality
- Python 3.11
git clone https://github.com/unsupervised-machine/habit_backend
cd habit_backendpython -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -r requirements.txtCreate a .env file with the following:
(For illustrative purposes I will expose the secrets below.)
MONGO_URI=[REDACTED - REQUEST FROM AUTHOR]
DATABASE_NAME=habit_db
SECRET_KEY=[REDACTED - REQUEST FROM AUTHOR]
ALGORITHM=[REDACTED - REQUEST FROM AUTHOR]
ACCESS_TOKEN_EXPIRE_MINUTES=30
uvicorn main:app --reload --port 8000
You can also visit the live website here: https://habit-frontend-five.vercel.appThis will start both the FastAPI Uvicorn service running on http://127.0.0.1:8000
- This projects database is currently being hosted on MongoDB Atlas server, whether you hit the API from the API Gateway routes or from the locally hosted routes the database will reflect the changes.
- The project was containerized using docker, the container image was stored in a ECR repo, a Lambda instance is spun up on calls from an API Gateway.
- The database is hosted on the cloud using MongoDB Atlas.
- All CRUD operations with the database are done through the official MongoDB driver pymongo.
- The Front end was built using Next.js, React,
None
If you have any questions, suggestions, or issues, feel free to reach out!
- Email: taran.s.lau@gmail.com
- GitHub: https://github.com/unsupervised-machine
