https://github.com/suraj-k-gupta/fastapi-notes
A FastAPI-based note-taking application deployed on Vercel. Features include adding, viewing, and managing notes with MongoDB for data storage.
https://github.com/suraj-k-gupta/fastapi-notes
api fastapi mongodb note-taking python vercel
Last synced: 3 months ago
JSON representation
A FastAPI-based note-taking application deployed on Vercel. Features include adding, viewing, and managing notes with MongoDB for data storage.
- Host: GitHub
- URL: https://github.com/suraj-k-gupta/fastapi-notes
- Owner: SURAJ-K-GUPTA
- Created: 2024-10-24T22:56:23.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-25T12:45:48.000Z (8 months ago)
- Last Synced: 2025-02-16T08:12:44.264Z (5 months ago)
- Topics: api, fastapi, mongodb, note-taking, python, vercel
- Language: HTML
- Homepage: https://fastapi-notes-pi.vercel.app
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FastAPI Note Add Project
This project is a simple note-taking app built with **FastAPI** where users can add notes. It uses **MongoDB** as the database.
## Features
- Add new notes with a title, description, and important flag.
- FastAPI as the backend framework.
- MongoDB for note storage.
- Dynamic page updates.## Requirements
Before you begin, make sure you have the following installed on your system:
- Python 3.7+
- MongoDB (local or hosted)
- pip (Python package installer)## Setup
### Step 1: Clone the Repository
First, clone the repository to your local machine.
```bash
git clone https://github.com/SURAJ-K-GUPTA/fastapi-notes.git
cd fastapi-notes
```### Step 2: Set Up a Virtual Environment
It's recommended to use a virtual environment to manage dependencies.
On macOS/Linux:
```bash
python3 -m venv venv
source venv/bin/activate
```On Windows:
```bash
python -m venv venv
venv\Scripts\activate
```### Step 3: Install Dependencies
Once inside the virtual environment, install the project dependencies using the `requirements.txt` file.
```bash
pip install -r requirements.txt
```### Step 4: Set Up the `.env` File
Create a `.env` file in the root of the project. Inside this file, add your MongoDB connection URI:
```env
MONGO_URI=mongodb+srv://:@cluster0.mongodb.net/?retryWrites=true&w=majority
```Make sure to replace ``, ``, and `` with your MongoDB credentials.
### Step 5: Database Setup
You need a MongoDB database to store notes. Either:
- Use MongoDB Atlas (a cloud MongoDB solution) or
- Run MongoDB locally.Create a collection named `notes` in your MongoDB database.
### Step 6: Running the Application
To run the FastAPI app, use `uvicorn`. Run the following command:
```bash
uvicorn app:app --reload
```The application should now be running at:
```bash
http://127.0.0.1:8000
```## Project Structure
```bash
fast-api-note-add/
├── api/
│ └── app.py # Main FastAPI application file
├── db.py # MongoDB connection configuration
├── templates/ # HTML templates for rendering
├── static/ # Static files (CSS, JS)
├── .env # Environment variables (Mongo URI)
├── requirements.txt # Project dependencies
└── README.md # This README file
```## Routes
- **GET /**: Display the form to add notes and show existing notes.
- **POST /**: Add a new note to the database.## License
This project is licensed under the MIT License.