GithubHelp home page GithubHelp logo

dheemanthbhat / fastapi-mongodb-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 31 KB

FastAPI+MongoDB Boilerplate Code

License: MIT License

Dockerfile 0.56% Python 99.44%
docker docker-compose fastapi mongodb prisma-orm pymongo python3

fastapi-mongodb-boilerplate's Introduction

FastAPI+MongoDB Boilerplate Code

1 About

fastapi-mongodb-boilerplate is a boilerplate code containing REST APIs developed using FastAPI and MongoDB as database.

2 Technical Specifications

2.1 Technologies

Below are the list of technologies used in this project:

  1. Python - Programming language (version >= 3.11).
  2. FastAPI - Python Web framework used in Backend API development.
  3. MongoDB - NoSQL Database for storing data.
  4. Docker - Containerizing the services.

2.2 Libraries

Libraries used in this project:

  1. PyMongo - Native Python driver for MongoDB.
  2. Motor - Asynchronous Python driver for MongoDB built on top of PyMongo.
  3. Prisma - ORM (or ODM) for Python and MongoDB.

3 Setup

This project can be setup in two ways.

3.1 Local setup

Steps to setup fastapi-mongodb-boilerplate on your local machine.

STEP 1: Clone repository

Clone this repository and traverse to the project folder using below commands:

git clone https://github.com/DheemanthBhat/fastapi-mongodb-boilerplate.git
cd fastapi-mongodb-boilerplate

STEP 2: Setup virtual environment

Create and activate virtual environment.

Windows
python -m venv .venv
.venv\Scripts\activate
Linux
python -m venv .venv
source .venv/bin/activate

STEP 3: Install python packages

pip install -r requirements.txt

STEP 4: Setup Environment variables

  1. Create duplicate of .env.sample file and rename it to .env.
  2. Update environment variables with proper values based on your requirements.
  3. For example change MONGO_CONNECTION_STRING to a valid MongoDB Atlas URL.

STEP 5: Start web server

uvicorn src.main:app --reload

3.2 Container setup

To setup fastapi-mongodb-boilerplate using Docker, open Docker Desktop and run below command.

docker-compose up -d

4 API docs

4.1 Swagger docs

Launch Swagger docs in browser: http://127.0.0.1:8000/docs

4.2 Redoc

Launch Redoc docs in browser: http://127.0.0.1:8000/redoc

fastapi-mongodb-boilerplate's People

Contributors

dheemanthbhat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.