Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI NotesApp

This guide walks you through setting up and running the FastAPI NotesApp on your local machine.

🚀 Getting Started

Step 1: Create a Project Directory

Create a new directory on your local machine where the project will reside.

Step 2: Open the Directory in VS Code or PyCharm

Open your newly created directory in VS Code or PyCharm.

Step 3: Clone the Repository

Open the terminal and run the following command to clone the project:

git clone <repo_url> .

(Ensure to replace <repo_url> with the actual repository URL.)

Step 4: Create and Activate a Virtual Environment

python -m venv venv  # Create virtual environment
source venv/bin/activate  # Activate virtual environment (Linux/Mac)
venv\Scripts\activate  # Activate virtual environment (Windows)

Step 5: Install Dependencies

Run the following commands to install the necessary dependencies:

pip install "fastapi[standard]"
pip install jinja2
pip install -r requirements.txt

Step 6: Configure MongoDB Connection

  1. Create a config directory inside the project root (if it doesn’t already exist):

    mkdir config
  2. Create a new file inside the config directory named db.py.

  3. Open db.py and paste the following content:

    from pymongo import MongoClient
    
    MONGO_URI = "your_mongo_uri"
    conn = MongoClient(MONGO_URI)

(Replace your_mongo_uri with your actual MongoDB connection string.)

Step 7: Set Up MongoDB

  1. Login to MongoDB Atlas via the web application.

  2. Create a new free cluster and wait for the setup to complete. MongoDB Cluster

  3. Dont forget to add current IP address in network access section.

  4. Connect to the cluster:

    • Click on the Connect button as shown in above image. MongoDB Compass
    • Select MongoDB Compass. MongoDB Compass setup
    • If you don’t have MongoDB Compass installed, download and install it.
    • Copy the connection string displayed in the second step.
  5. Connect via MongoDB Compass:

    • Open MongoDB Compass.
    • Click Add Network.
    • Paste the copied connection string. MongoDB Connection
    • Save and connect.
  6. Update db.py file which you've created in step 6:

    • Replace YOUR_MONGO_URI with the copied connection string from MongoDB Compass.

Step 8: Run the FastAPI Server

Start the FastAPI server using the following command:

fastapi dev index.py

Once the server is running, your app should be accessible and look something like this:

FastAPI Running

FastAPI UI


Now you're ready to start using the FastAPI NotesApp! 🚀

About

A simple and efficient notes application built with FastAPI and MongoDB. This app allows users to create, store, and display notes with a title and description, and marks important notes. It utilizes FastAPI for the backend API and MongoDB for data storage

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages