Coder Social home page Coder Social logo

dilshankarunarathne / secure-fastapi-template Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 38 KB

A template repository for a FastAPI back-end. It is secured with OAuth 2.0 and uses JWT tokens for authentication and authorization. Uses MySQL for database management.

License: Other

Python 100.00%
fastapi jose mysql oauth2 passlib pydantic python rest-api template

secure-fastapi-template's Introduction

FastAPI Project Template

The REST API template repository for a FastAPI back-end project.

Version License

Table of Contents

Description

This is a template repository for a FastAPI back-end project. It is intended to be used as a starting point for a new project. It has OAuth2 authentication and JWT token generation. It also has a basic user model and CRUD operations for users.

Installation

Prerequisites

  • Python 3.8 or higher
  • pip 20.0 or higher
  • fastapi
  • uvicorn
  • pydantic
  • jose
  • passlib
  • mysql

Installation Steps

  1. Clone the repository
git clone https://github.com/dilshankarunarathne/secure-fastapi-template.git
  1. Install the dependencies
pip install -r requirements.txt
  1. Create a MySQL database
mysql -u root -p
CREATE DATABASE fastapi;
  1. Create a .env file in the root directory and add the following environment variables
MYSQL_USER="your mysql user"
MYSQL_PASSWORD="your mysql password"
MYSQL_HOST="localhost"
MYSQL_DATABASE="fastapi"
MYSQL_PORT=3306
  1. Run the project
uvicorn main:app --reload
  1. Open the local URL in a browser to access the Swagger UI
http://127.0.0.1:8000/auth/login

Contributing

If you'd like to contribute to this project, please check the contribution guidelines for more information.

License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. CC BY-NC-SA 4.0
CC BY-NC-SA 4.0

Contact Information

For questions or feedback, please contact the author:

secure-fastapi-template's People

Contributors

dilshankarunarathne avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

sunrise2075

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.