Skip to content

LXwaru/backend-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a backend boiler plate using FastAPI and PostgreSQL

  • create users
  • secure login using JWT token exchange
  • create/read items specific for each user
  • To use this boilerplate, follow these directions:

    TC = terminal command


    create a virtual environment:

    TC: python -m venv .venv
    TC: source .venv/bin/activate


    download dependencies

    TC: pip install fastapi
    TC: pip install sqlalchemy
    TC: pip install alembic
    TC: pip install pyjwt
    TC: pip install "passlib[bcrypt]"
    TC: pip install psycopg2


    download/setup postgreSQL

    There are a few ways to do this. Click here for the PostgreSQL documentation


    migrations

    migrate down:
    TC: alembic downgrade base
    migrate up:
    TC: alembic revision


    setup an .env file

    create a secret key for the security protocol TC: openssl rand -hex 32
    copy the string and paste it in the .env as:
    SECRET_KEY={your secret key}

    after you've created a postgreSQL database, put the following code into the .env file: DATABASE_URL=postgresql://{username}:{password}@localhost/{dbname}


    open DEV environment on localhost:8000/docs

    TC: fastapi dev app/api/main.py

    About

    Python - FastAPI | PostgreSQL | JWT/OAuth2. This project serves as a starting point for any project that will require secure login, or user authenticaion/authorization.

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

     
     
     

    Contributors