🚀 Cookiecutter Template for FastAPI + React Projects. Using PostgreSQL, SQLAlchemy, and Docker

Overview

FastAPI + React · build license Dependabot Status

fastapi-logo react-logo     react-admin     react-logo     react-logo sql-alchemy

A cookiecutter template for bootstrapping a FastAPI and React project using a modern stack.


Features

Table of Contents

Background

It is often laborsome to start a new project. 90% of the time you have to decide how to handle authentication, reverse proxies, docker containers, testing, server-side validation, linting, etc. before you can even get started.

FastAPI-React serves to streamline and give you that functionality out of the box.

It is meant as a lightweight/React alternative to FastAPI's official fullstack project. If you want a more comprehensive project in Vue, I would suggest you start there. A lot of the backend code is taken from that project or the FastAPI official docs.

Quick Start

First, install cookiecutter if you don't already have it:

pip3 install cookiecutter

Second, install docker-compose if you don't already have it:

docker-compose installation official docs.

Then, in the directory you want your project to live:

cookiecutter gh:Buuntu/fastapi-react

You will need to put in a few variables and it will create a project directory (called whatever you set for project_slug).

Input Variables
  • project_name [default fastapi-react-project]
  • project_slug [default fastapi-react-project] - this is your project directory
  • port [default 8000]
  • postgres_user [default postgres]
  • postgres_password [default password]
  • postgres_database [default app]
  • superuser_email [default [email protected]]
  • superuser_password [default password]
  • secret_key [default super_secret]

Develop

Change into your project directory and run:

chmod +x scripts/build.sh
./scripts/build.sh

This will build and run the docker containers, run the alembic migrations, and load the initial data (a test user).

It may take a while to build the first time it's run since it needs to fetch all the docker images.

Once you've built the images once, you can simply use regular docker-compose commands to manage your development environment, for example to start your containers:

docker-compose up -d

Once this finishes you can navigate to the port set during setup (default is localhost:8000), you should see the slightly modified create-react-app page:

default create-react-app

Note: If you see an Nginx error at first with a 502: Bad Gateway page, you may have to wait for webpack to build the development server (the nginx container builds much more quickly).

Login screen: regular login

The backend docs will be at http://localhost:8000/api/docs. API Docs

Admin Dashboard

This project uses react-admin for a highly configurable admin dashboard.

After starting the project, navigate to http://localhost:8000/admin. You should see a login screen. Use the username/password you set for the superuser on project setup.

NOTE: regular users will not be able to access the admin dashboard

React Adming Login

You should now see a list of users which you can edit, add, and delete. The table is configured with the REST endpoints to the FastAPI /users routes in the backend.

React Admin Dashboard

The admin dashboard is kept in the frontend/src/admin directory to keep it separate from the regular frontend.

Security

To generate a secure key used for encrypting/decrypting the JSON Web Tokens, you can run this command:

openssl rand -hex 32

The default is fine for development but you will want something more secure for production.

You can either set this on project setup as secret_key or manually edit the Python SECRET_KEY variable in backend/app/core/security.py.

Testing

This project comes with Pytest and a few Pytest fixtures for easier mocking. The fixtures are all located in backend/conftest.py within your project directory.

All tests are configured to run on a test database using SQLAlchemy transactions to reset the testing state on each function. This is to avoid a database call affecting the state of a different test.

Fixtures

These fixtures are included in backend/conftest.py and are automatically imported into any test files that being with test_.

test_db

The test_db fixture is an empty test database and an instance of a SQLAlchemy Session class.

def test_user(test_db):
    assert test_db.query(models.User).all()

test_user

def test_user_exists(test_user):
    assert test_user.email == "[email protected]"

test_superuser

def test_superuser(client, test_superuser):
    assert test_superuser.is_superuser

client

To use an unauthenticated test client, use client:

def test_get_users(client):
    client.get("/api/v1/users")
    assert response.status_code == 200

user_token_headers

If you need an authenticated client using OAuth2 and JWTs:

def test_user_me(client, user_token_headers):
    response = client.get(
      "/api/v1/users/me",
      headers=user_token_headers,
    )
    assert response.status_code == 200

Since OAuth2 expects the access token in the headers, you will need to pass in user_token_headers as the headers argument in any client request that requires authentication.

superuser_token_headers

def test_user_me(client, superuser_token_headers):
    response = client.get(
      "/api/v1/users",
      headers=superuser_token_headers,
    )
    assert response.status_code == 200

Background Tasks

This template comes with Celery and Redis Docker containers pre-configured for you. For any long running processes, it's recommended that you handle these using a task queue like Celery to avoid making the client wait for a request to finish. Some examples of this might be sending emails, uploading large files, or any long running, resource intensive tasks.

There is an example task in backend/app/tasks.py and an example Celery test in backend/app/tests/test_tasks.py. This test runs synchronously, which is what Celery docs recommend.

If you are not happy with Celery or Redis, it should be easy to swap these containers out with your favorite tools. Some suggested alternatives might be Huey as the task queue and RabbitMQ for the message broker.

Flower

You can monitor tasks using Flower by going to http://localhost:5555

Frontend Utilities

There are a few helper methods to handle authentication in frontend/src/utils. These store and access the JWT returned by FastAPI in local storage. Even though this doesn't add any security, we prevent loading routes that might be protected on the frontend, which results in a better UX experience.

Utility Functions

login

// in src/utils/auth.ts

/**
 *  Handles authentication with backend and stores in JWT in local storage
 **/
const login = (email: string, password: string) => boolean;

logout

// in src/utils/auth.ts

// clears token from local storage
const logout = (email: string, password: string) => void;

isAuthenticated

// Checks authenticated state from JWT tokens
const isAuthenticated = () => boolean;

Routes

Some basic routes are included (and handled in frontend/Routes.tsx).

  • /login - Login screen
  • /logout - Logout
  • / - Home
  • /protected - Example of protected route

Higher Order Components

PrivateRoute

This handles routes that require authentication. It will automatically check whether the correct token with the "user" permissions is present or redirect to the home page.

// in src/Routes.tsx
import { Switch } from 'react-router-dom';

// Replace this with your component
import { ProtectecComponent } from 'components';

const Routes = () => (
  <Switch>
    <PrivateRoute path="/protected_route" component={ProtectedComponent} />
  </Switch>
);

Deployment

This stack can be adjusted and used with several deployment options that are compatible with Docker Compose, but it may be easiest to use Docker in Swarm Mode with an Nginx main load balancer proxy handling automatic HTTPS certificates, using the ideas from DockerSwarm.rocks.

Please refer to DockerSwarm.rocks to see how to deploy such a cluster easily. You will have to change the Traefik examples to Nginx or update your docker-compose file.

Contributing

Contributing is more than welcome. Please read the Contributing doc to find out more.

Comments
  • Maximum call stack size exceeded

    Maximum call stack size exceeded

    I am trying to execute the command chmod +x scripts/build.sh ./scripts/build.sh, using the default configuration, however, I am always getting this error:

    npm notice 
    npm notice New patch version of npm available! 7.0.3 -> 7.0.5
    npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.0.5>
    npm notice Run `npm install -g [email protected]` to update!
    npm notice 
    npm ERR! Maximum call stack size exceeded
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /root/.npm/_logs/2020-10-24T13_56_07_518Z-debug.log
    ERROR: Service 'frontend' failed to build : The command '/bin/sh -c npm rebuild' returned a non-zero code: 1
    Starting fastapi-react-project_postgres_1 ... 
    Starting fastapi-react-project_postgres_1 ... error
    
    ERROR: for fastapi-react-project_postgres_1  Cannot start service postgres: driver failed programming external connectivity on endpoint fastapi-react-project_postgres_1 (64ddcd8b9c18461c2873dfbb73f31a713928de7744232e764ec2fe7ed78b2dd1): Bind for 0.0.0.0:5432 failed: port is already allocated
    
    ERROR: for postgres  Cannot start service postgres: driver failed programming external connectivity on endpoint fastapi-react-project_postgres_1 (64ddcd8b9c18461c2873dfbb73f31a713928de7744232e764ec2fe7ed78b2dd1): Bind for 0.0.0.0:5432 failed: port is already allocated
    ERROR: Encountered errors while bringing up the project.
    Starting fastapi-react-project_postgres_1 ... 
    Starting fastapi-react-project_postgres_1 ... error
    
    ERROR: for fastapi-react-project_postgres_1  Cannot start service postgres: driver failed programming external connectivity on endpoint fastapi-react-project_postgres_1 (31ccd7b0ce884e6658231ae13ef1be29c5c34888676df38322930a3cdbcb67ed): Bind for 0.0.0.0:5432 failed: port is already allocated
    
    ERROR: for postgres  Cannot start service postgres: driver failed programming external connectivity on endpoint fastapi-react-project_postgres_1 (31ccd7b0ce884e6658231ae13ef1be29c5c34888676df38322930a3cdbcb67ed): Bind for 0.0.0.0:5432 failed: port is already allocated
    ERROR: Encountered errors while bringing up the project.
    

    Configuration:

    • Docker version 19.03.13, build 4484c46d9d
    • Mac Os Catalina
    • NPM 7.0.3
    • Node v15.0.1

    I have found this question, however, I have tried every possible solution without success.

    What can be the reason I am getting this?

    opened by robertosannazzaro 10
  • Adding VSCode development configurations (Optional)

    Adding VSCode development configurations (Optional)

    VSCode have an extension for remote container development. It would be pretty cool with the option to have a proper development IDE setup for the project.

    You can even use multiple containers to have autocompletion, linters, formatters etc. in both python backend and React frontend

    opened by NixBiks 8
  • fix: Make sure the backend and front end are available before launching nginx

    fix: Make sure the backend and front end are available before launching nginx

    Currently this may in some cases cause nginx to fail at startup, with error:

    nginx_1     | 2020/07/08 06:13:44 [emerg] 1#1: host not found in upstream "backend" in /etc/nginx/conf.d/default.conf:24
    nginx_1     | nginx: [emerg] host not found in upstream "backend" in /etc/nginx/conf.d/default.conf:24
    
    opened by arihantsurana 6
  • ReadMe Improvements.

    ReadMe Improvements.

    Can the readme.md reflect the coockiecutters pip reccomended setup?

    Is it for a python3 venv or a redirected path for python3? I went with pip3 install

    Secondly, can we have more info on "docker-compose up -d" seems to not work intuitively, requiring un-listed documentation:

    Suggested by CLI all run errors: docker-machine start default docker-machine create

    until finally (maybe add documentation to this step)': docker-machine create none

    Oh, no that didn't do anything either. :(

    It was sudo docker-compose up -d

    Maybe more clarity for the docker-compose installation or maybe my cookiecutter setup was wrong?

    Either way, excited to see this powerful tech here educating <3 Thank you!

    opened by JasonHoku 5
  • PrivateRoute auth vulnerable to user spoofing localStorage?

    PrivateRoute auth vulnerable to user spoofing localStorage?

    I'm very new to auth so sorry if this is all wrong. The code for isAuthenticated which is used to avoid rendering PrivateRoutes to unauthenticated users just checks local storage for a plain string permissions. Wouldn't this make it possible for a user to set 'permissions' to 'user' or 'admin' manually on local storage and then be able to possibly access static information that they shouldn't be able to? I'm guessing this wouldn't let them access any data via the API, but shouldn't isAuthenticated call the server and validate the token? Thank you.

    export const isAuthenticated = () => {
      const permissions = localStorage.getItem('permissions');
      if (!permissions) {
        return false;
      }
      return permissions === 'user' || permissions === 'admin' ? true : false;
    };
    
    opened by rbracco 4
  • Scripts fail with version issues on backend

    Scripts fail with version issues on backend

    while trying to build the backend:

    `INFO: pip is looking at multiple versions of celery to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of bcrypt to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of authlib to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of alembic to determine which version is compatible with other requirements. This could take a while. ERROR: Cannot install -r requirements.txt (line 3) and starlette==0.13.8 because these package versions have conflicting dependencies.

    The conflict is caused by: The user requested starlette==0.13.8 fastapi 0.61.1 depends on starlette==0.13.6

    To fix this you could try to:

    1. loosen the range of package versions you've specified
    2. remove package versions to allow pip attempt to solve the dependency conflict

    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies ERROR: Service 'backend' failed to build : The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt' returned a non-zero code: 1

    opened by lucabotti 3
  • Readme docs updates: pip, composer & sudo build.sh

    Readme docs updates: pip, composer & sudo build.sh

    pip --> pip3 for more global install stability.

    composer docs added for clarity

    sudo build.sh ( this is necessary with the default docker setup )

    :)

    opened by JasonHoku 3
  • click doesn't work on Frontend

    click doesn't work on Frontend

    followed the deployment procedure. I am unable to click hyperlink on the homepage , not even able to click button using for login . I tried different browsers.

    opened by psschand16 2
  • upgrade alembic error

    upgrade alembic error

    When running: alembic upgrade head in my ubuntu console.

    I got this error: Traceback (most recent call last): File "/usr/bin/alembic", line 11, in load_entry_point('alembic==1.1.0.dev0', 'console_scripts', 'alembic')() File "/usr/lib/python3/dist-packages/alembic/config.py", line 540, in main CommandLine(prog=prog).main(argv=argv) File "/usr/lib/python3/dist-packages/alembic/config.py", line 534, in main self.run_cmd(cfg, options) File "/usr/lib/python3/dist-packages/alembic/config.py", line 511, in run_cmd fn( File "/usr/lib/python3/dist-packages/alembic/command.py", line 279, in upgrade script.run_env() File "/usr/lib/python3/dist-packages/alembic/script/base.py", line 475, in run_env util.load_python_file(self.dir, "env.py") File "/usr/lib/python3/dist-packages/alembic/util/pyfiles.py", line 98, in load_python_file module = load_module_py(module_id, path) File "/usr/lib/python3/dist-packages/alembic/util/compat.py", line 174, in load_module_py spec.loader.exec_module(module) File "", line 783, in exec_module File "", line 219, in _call_with_frames_removed File "app/alembic/env.py", line 8, in from app.db.models import Base ModuleNotFoundError: No module named 'app'

    I don't change my Dockerfile.

    My docker file is:

    FROM python:3.8

    RUN mkdir app WORKDIR app/

    RUN apt update &&
    apt install -y postgresql-client

    COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt

    COPY . .

    opened by mrk24251 2
  • Form validation errors on Sign Up and Login pages

    Form validation errors on Sign Up and Login pages

    I found a bug where the frontend errors out when you press the submit button on empty fields for the login and sign up pages.

    Here is a gif of the error for the sign up page. The same error occurred with login page as well.

    error_with_signup_and_signin

    opened by adamnieto 2
  • `E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.`

    `E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.`

    Hello! Thank you for sharing such a helpful starter project! I'm sure it's an issue on my end but when trying to build the Docker containers for the first time. I kept all the defaults for now but I run into E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file. error when trying to build. Many possible solutions I've found involve changing the sources.list but that may be going in the wrong direction. Any help/ideas would be greatly appreciated and thanks again for your contribution!

    Here's the error output when running the script:

    ❯ ~/Code/fastapi-react-project ./scripts/build.sh
    Building worker
    Step 1/7 : FROM python:3.8
     ---> 7f5b6ccd03e9
    Step 2/7 : RUN mkdir /app
     ---> Using cache
     ---> f0116c1f6621
    Step 3/7 : WORKDIR /app
     ---> Using cache
     ---> b7cf3d34ff55
    Step 4/7 : RUN apt update &&     apt install -y postgresql-client
     ---> Running in cfe01c7ac65a
    
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    
    Ign:1 http://deb.debian.org/debian buster InRelease
    Ign:2 http://deb.debian.org/debian buster-updates InRelease
    Ign:3 http://security.debian.org/debian-security buster/updates InRelease
    Err:4 http://deb.debian.org/debian buster Release
      Cannot initiate the connection to deb.debian.org:80 (0.0.15.74). - connect (22: Invalid argument)
    Err:5 http://security.debian.org/debian-security buster/updates Release
      Cannot initiate the connection to security.debian.org:80 (0.0.15.75). - connect (22: Invalid argument)
    Err:6 http://deb.debian.org/debian buster-updates Release
      Cannot initiate the connection to deb.debian.org:80 (0.0.15.74). - connect (22: Invalid argument)
    Reading package lists...
    E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.
    E: The repository 'http://security.debian.org/debian-security buster/updates Release' does not have a Release file.
    E: The repository 'http://deb.debian.org/debian buster-updates Release' does not have a Release file.
    ERROR: Service 'worker' failed to build: The command '/bin/sh -c apt update &&     apt install -y postgresql-client' returned a non-zero code: 100
    Starting fastapi-react-project_postgres_1 ... done
    Building backend
    Step 1/7 : FROM python:3.8
     ---> 7f5b6ccd03e9
    Step 2/7 : RUN mkdir /app
     ---> Using cache
     ---> f0116c1f6621
    Step 3/7 : WORKDIR /app
     ---> Using cache
     ---> b7cf3d34ff55
    Step 4/7 : RUN apt update &&     apt install -y postgresql-client
     ---> Running in a4fe17886f2c
    
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    
    Ign:1 http://security.debian.org/debian-security buster/updates InRelease
    Err:2 http://security.debian.org/debian-security buster/updates Release
      Cannot initiate the connection to security.debian.org:80 (0.0.15.75). - connect (22: Invalid argument)
    Ign:3 http://deb.debian.org/debian buster InRelease
    Ign:4 http://deb.debian.org/debian buster-updates InRelease
    Err:5 http://deb.debian.org/debian buster Release
      Cannot initiate the connection to deb.debian.org:80 (0.0.15.74). - connect (22: Invalid argument)
    Err:6 http://deb.debian.org/debian buster-updates Release
      Cannot initiate the connection to deb.debian.org:80 (0.0.15.74). - connect (22: Invalid argument)
    Reading package lists...
    E: The repository 'http://security.debian.org/debian-security buster/updates Release' does not have a Release file.
    E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.
    E: The repository 'http://deb.debian.org/debian buster-updates Release' does not have a Release file.
    ERROR: Service 'backend' failed to build: The command '/bin/sh -c apt update &&     apt install -y postgresql-client' returned a non-zero code: 100
    Starting fastapi-react-project_postgres_1 ... done
    Building backend
    Step 1/7 : FROM python:3.8
     ---> 7f5b6ccd03e9
    Step 2/7 : RUN mkdir /app
     ---> Using cache
     ---> f0116c1f6621
    Step 3/7 : WORKDIR /app
     ---> Using cache
     ---> b7cf3d34ff55
    Step 4/7 : RUN apt update &&     apt install -y postgresql-client
     ---> Running in 5178718013f2
    
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    
    Ign:1 http://security.debian.org/debian-security buster/updates InRelease
    Ign:2 http://deb.debian.org/debian buster InRelease
    Ign:3 http://deb.debian.org/debian buster-updates InRelease
    Err:4 http://security.debian.org/debian-security buster/updates Release
      Cannot initiate the connection to security.debian.org:80 (0.0.15.75). - connect (22: Invalid argument)
    Err:5 http://deb.debian.org/debian buster Release
      Cannot initiate the connection to deb.debian.org:80 (0.0.15.74). - connect (22: Invalid argument)
    Err:6 http://deb.debian.org/debian buster-updates Release
      Cannot initiate the connection to deb.debian.org:80 (0.0.15.74). - connect (22: Invalid argument)
    Reading package lists...
    E: The repository 'http://security.debian.org/debian-security buster/updates Release' does not have a Release file.
    E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file.
    E: The repository 'http://deb.debian.org/debian buster-updates Release' does not have a Release file.
    ERROR: Service 'backend' failed to build: The command '/bin/sh -c apt update &&     apt install -y postgresql-client' returned a non-zero code: 100
    
    opened by gaylonalfano 2
  • Types and versions

    Types and versions

    There is some issue with types resolution

    /app/src/index.tsx TypeScript error in /app/src/index.tsx(8,4): 'Router' cannot be used as a JSX component. Its instance type 'BrowserRouter' is not a valid JSX element. The types returned by 'render()' are incompatible between these types. Type 'React.ReactNode' is not assignable to type 'import("/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode'. TS2786

     6 | 
     7 | ReactDOM.render(
    

    8 | | ^ 9 | 10 | , 11 | document.getElementById('root')

    opened by tomlinguist 1
  • Fresh build- front end errors

    Fresh build- front end errors

    After a clean install and trying to run this, the frontend locks up and I get the following errors:

    Warning: React does not recognize the `computedMatch` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `computedmatch` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    
    ReferenceError: Can't find variable: process
    
    TypeScript error in /app/src/index.tsx(8,4):
    'Router' cannot be used as a JSX component.
      Its instance type 'BrowserRouter' is not a valid JSX element.
        The types returned by 'render()' are incompatible between these types.
          Type 'React.ReactNode' is not assignable to type 'import("/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode'.  TS2786
    
         6 | 
         7 | ReactDOM.render(
      >  8 |   <Router>
           |    ^
         9 |     <App />
        10 |   </Router>,
        11 |   document.getElementById('root')
    
    TypeScript error in /app/src/Routes.tsx(31,6):
    'Switch' cannot be used as a JSX component.
      Its instance type 'Switch' is not a valid JSX element.
        The types returned by 'render()' are incompatible between these types.
          Type 'React.ReactNode' is not assignable to type 'import("/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode'.  TS2786
    
    TypeScript error in /app/src/views/SignUp.tsx(58,6):
    'Redirect' cannot be used as a JSX component.
      Its instance type 'Redirect' is not a valid JSX element.  TS2786
    

    Any idea how to troubleshoot this?

    opened by BrendanJM 1
  • Frontend build faild

    Frontend build faild

    Frontend build faild, don't know why

    /app/run.sh: line 2: $'\r': command not found
    /app/run.sh: line 3: syntax error near unexpected token `$'in\r''
    'app/run.sh: line 3: `case $1 in
    
    opened by buaaflyaway 2
  • Bump httpx from 0.15.5 to 0.23.0 in /{{cookiecutter.project_slug}}/backend

    Bump httpx from 0.15.5 to 0.23.0 in /{{cookiecutter.project_slug}}/backend

    Bumps httpx from 0.15.5 to 0.23.0.

    Release notes

    Sourced from httpx's releases.

    Version 0.23.0

    0.23.0 (23rd May, 2022)

    Changed

    • Drop support for Python 3.6. (#2097)
    • Use utf-8 as the default character set, instead of falling back to charset-normalizer for auto-detection. To enable automatic character set detection, see the documentation. (#2165)

    Fixed

    • Fix URL.copy_with for some oddly formed URL cases. (#2185)
    • Digest authentication should use case-insensitive comparison for determining which algorithm is being used. (#2204)
    • Fix console markup escaping in command line client. (#1866)
    • When files are used in multipart upload, ensure we always seek to the start of the file. (#2065)
    • Ensure that iter_bytes never yields zero-length chunks. (#2068)
    • Preserve Authorization header for redirects that are to the same origin, but are an http-to-https upgrade. (#2074)
    • When responses have binary output, don't print the output to the console in the command line client. Use output like <16086 bytes of binary data> instead. (#2076)
    • Fix display of --proxies argument in the command line client help. (#2125)
    • Close responses when task cancellations occur during stream reading. (#2156)
    • Fix type error on accessing .request on HTTPError exceptions. (#2158)

    Version 0.22.0

    0.22.0 (26th January, 2022)

    Added

    Fixed

    • Don't perform unreliable close/warning on __del__ with unclosed clients. (#2026)
    • Fix Headers.update(...) to correctly handle repeated headers (#2038)

    Version 0.21.3

    0.21.3 (6th January, 2022)

    Fixed

    • Fix streaming uploads using SyncByteStream or AsyncByteStream. Regression in 0.21.2. (#2016)

    Version 0.21.2

    0.21.2 (5th January, 2022)

    Fixed

    • HTTP/2 support for tunnelled proxy cases. (#2009)
    • Improved the speed of large file uploads. (#1948)

    Version 0.21.1

    ... (truncated)

    Changelog

    Sourced from httpx's changelog.

    0.23.0 (23rd May, 2022)

    Changed

    • Drop support for Python 3.6. (#2097)
    • Use utf-8 as the default character set, instead of falling back to charset-normalizer for auto-detection. To enable automatic character set detection, see the documentation. (#2165)

    Fixed

    • Fix URL.copy_with for some oddly formed URL cases. (#2185)
    • Digest authentication should use case-insensitive comparison for determining which algorithm is being used. (#2204)
    • Fix console markup escaping in command line client. (#1866)
    • When files are used in multipart upload, ensure we always seek to the start of the file. (#2065)
    • Ensure that iter_bytes never yields zero-length chunks. (#2068)
    • Preserve Authorization header for redirects that are to the same origin, but are an http-to-https upgrade. (#2074)
    • When responses have binary output, don't print the output to the console in the command line client. Use output like <16086 bytes of binary data> instead. (#2076)
    • Fix display of --proxies argument in the command line client help. (#2125)
    • Close responses when task cancellations occur during stream reading. (#2156)
    • Fix type error on accessing .request on HTTPError exceptions. (#2158)

    0.22.0 (26th January, 2022)

    Added

    Fixed

    • Don't perform unreliable close/warning on __del__ with unclosed clients. (#2026)
    • Fix Headers.update(...) to correctly handle repeated headers (#2038)

    0.21.3 (6th January, 2022)

    Fixed

    • Fix streaming uploads using SyncByteStream or AsyncByteStream. Regression in 0.21.2. (#2016)

    0.21.2 (5th January, 2022)

    Fixed

    • HTTP/2 support for tunnelled proxy cases. (#2009)
    • Improved the speed of large file uploads. (#1948)

    0.21.1 (16th November, 2021)

    Fixed

    • The response.url property is now correctly annotated as URL, instead of Optional[URL]. (#1940)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump pyjwt from 1.7.1 to 2.4.0 in /{{cookiecutter.project_slug}}/backend

    Bump pyjwt from 1.7.1 to 2.4.0 in /{{cookiecutter.project_slug}}/backend

    Bumps pyjwt from 1.7.1 to 2.4.0.

    Release notes

    Sourced from pyjwt's releases.

    2.4.0

    Security

    What's Changed

    New Contributors

    Full Changelog: https://github.com/jpadilla/pyjwt/compare/2.3.0...2.4.0

    2.3.0

    What's Changed

    ... (truncated)

    Changelog

    Sourced from pyjwt's changelog.

    v2.4.0 <https://github.com/jpadilla/pyjwt/compare/2.3.0...2.4.0>__

    Security

    
    - [CVE-2022-29217] Prevent key confusion through non-blocklisted public key formats. https://github.com/jpadilla/pyjwt/security/advisories/GHSA-ffqj-6fqr-9h24
    

    Changed

    
    - Explicit check the key for ECAlgorithm by @estin in https://github.com/jpadilla/pyjwt/pull/713
    - Raise DeprecationWarning for jwt.decode(verify=...) by @akx in https://github.com/jpadilla/pyjwt/pull/742
    

    Fixed

    
    - Don't use implicit optionals by @rekyungmin in https://github.com/jpadilla/pyjwt/pull/705
    - documentation fix: show correct scope for decode_complete() by @sseering in https://github.com/jpadilla/pyjwt/pull/661
    - fix: Update copyright information by @kkirsche in https://github.com/jpadilla/pyjwt/pull/729
    - Don't mutate options dictionary in .decode_complete() by @akx in https://github.com/jpadilla/pyjwt/pull/743
    
    Added
    
    • Add support for Python 3.10 by @hugovk in https://github.com/jpadilla/pyjwt/pull/699
    • api_jwk: Add PyJWKSet.getitem by @woodruffw in https://github.com/jpadilla/pyjwt/pull/725
    • Update usage.rst by @guneybilen in https://github.com/jpadilla/pyjwt/pull/727
    • Docs: mention performance reasons for reusing RSAPrivateKey when encoding by @dmahr1 in https://github.com/jpadilla/pyjwt/pull/734
    • Fixed typo in usage.rst by @israelabraham in https://github.com/jpadilla/pyjwt/pull/738
    • Add detached payload support for JWS encoding and decoding by @fviard in https://github.com/jpadilla/pyjwt/pull/723
    • Replace various string interpolations with f-strings by @akx in https://github.com/jpadilla/pyjwt/pull/744
    • Update CHANGELOG.rst by @hipertracker in https://github.com/jpadilla/pyjwt/pull/751

    v2.3.0 &amp;lt;https://github.com/jpadilla/pyjwt/compare/2.2.0...2.3.0&amp;gt;__

    Fixed

    
    - Revert &amp;quot;Remove arbitrary kwargs.&amp;quot; `[#701](https://github.com/jpadilla/pyjwt/issues/701) &amp;lt;https://github.com/jpadilla/pyjwt/pull/701&amp;gt;`__
    
    Added
    
    • Add exception chaining [#702](https://github.com/jpadilla/pyjwt/issues/702) &amp;lt;https://github.com/jpadilla/pyjwt/pull/702&amp;gt;__

    v2.2.0 &amp;lt;https://github.com/jpadilla/pyjwt/compare/2.1.0...2.2.0&amp;gt;__

    &lt;/tr&gt;&lt;/table&gt; </code></pre> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary>

    <ul> <li><a href="https://github.com/jpadilla/pyjwt/commit/83ff831a4d11190e3a0bed781da43f8d84352653"><code>83ff831</code></a> chore: update changelog</li> <li><a href="https://github.com/jpadilla/pyjwt/commit/4c1ce8fd9019dd312ff257b5141cdb6d897379d9"><code>4c1ce8f</code></a> chore: update changelog</li> <li><a href="https://github.com/jpadilla/pyjwt/commit/96f3f0275745c5a455c019a0d3476a054980e8ea"><code>96f3f02</code></a> fix: failing advisory test</li> <li><a href="https://github.com/jpadilla/pyjwt/commit/9c528670c455b8d948aff95ed50e22940d1ad3fc"><code>9c52867</code></a> Merge pull request from GHSA-ffqj-6fqr-9h24</li> <li><a href="https://github.com/jpadilla/pyjwt/commit/24b29adfebcb4f057a3cef5aaf35653bc0c1c8cc"><code>24b29ad</code></a> Update CHANGELOG.rst (<a href="https://github-redirect.dependabot.com/jpadilla/pyjwt/issues/751">#751</a>)</li> <li><a href="https://github.com/jpadilla/pyjwt/commit/31f5acb8fb3ec6cdfe2b1b0a4a8f329b5f3ca67f"><code>31f5acb</code></a> Replace various string interpolations with f-strings (<a href="https://github-redirect.dependabot.com/jpadilla/pyjwt/issues/744">#744</a>)</li> <li><a href="https://github.com/jpadilla/pyjwt/commit/5581a31c21de70444c1162bcfa29f7e0fc86edda"><code>5581a31</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://github-redirect.dependabot.com/jpadilla/pyjwt/issues/748">#748</a>)</li> <li><a href="https://github.com/jpadilla/pyjwt/commit/3d4d82248f1120c87f1f4e0e8793eaa1d54843a6"><code>3d4d822</code></a> Don't mutate options dictionary in .decode_complete() (<a href="https://github-redirect.dependabot.com/jpadilla/pyjwt/issues/743">#743</a>)</li> <li><a href="https://github.com/jpadilla/pyjwt/commit/1f1fe15bb41846c602b3e106176b2c692b93a613"><code>1f1fe15</code></a> Add a deprecation warning when jwt.decode() is called with the legacy verify=...</li> <li><a href="https://github.com/jpadilla/pyjwt/commit/35fa28e59d99b99c6a780d2a029a74d6bbba8b1e"><code>35fa28e</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://github-redirect.dependabot.com/jpadilla/pyjwt/issues/740">#740</a>)</li> <li>Additional commits viewable in <a href="https://github.com/jpadilla/pyjwt/compare/1.7.1...2.4.0">compare view</a></li> </ul> </details>

    <br />

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Switch component shouldn't have div as children

    Switch component shouldn't have div as children

    in Routes.tsx there's a piece of code which will throw warnings

    <Switch>
      <Route path="/admin">
        <Admin />
      </Route>
      <div className={classes.app}>
        <header className={classes.header}>
          <Route path="/login" component={Login} />
          <Route path="/signup" component={SignUp} />
          <Route
            path="/logout"
            render={() => {
              logout();
              history.push('/');
              return null;
            }}
          />
          <PrivateRoute path="/protected" component={Protected} />
          <Route exact path="/" component={Home} />
        </header>
      </div>
    </Switch>
    

    This will generate the following warning from React: a warning is prompt from react: React does not recognize the computedMatch prop on a DOM element.

    Reason is that div shouldn't be children of Switch component. Possible solutions: the Switch component should instead be inside the div or each component linked in Route should have their own div.

    See post here

    opened by jogerj 0
Releases(v1.2.0)
Owner
Gabriel Abud
Software engineer interested in bioinformatics, automation, serverless
Gabriel Abud
Cookiecutter template for FastAPI projects using: Machine Learning, Poetry, Azure Pipelines and Pytests

cookiecutter-fastapi In order to create a template to FastAPI projects. ?? Important To use this project you don't need fork it. Just run cookiecutter

Arthur Henrique 225 Dec 28, 2022
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.

Full Stack FastAPI and PostgreSQL - Base Project Generator Generate a backend and frontend stack using Python, including interactive API documentation

Sebastián Ramírez 10.8k Jan 8, 2023
Boilerplate code for quick docker implementation of REST API with JWT Authentication using FastAPI, PostgreSQL and PgAdmin ⭐

FRDP Boilerplate code for quick docker implementation of REST API with JWT Authentication using FastAPI, PostgreSQL and PgAdmin ⛏ . Getting Started Fe

BnademOverflow 53 Dec 29, 2022
Fastapi-ml-template - Fastapi ml template with python

FastAPI ML Template Run Web API Local $ sh run.sh # poetry run uvicorn app.mai

Yuki Okuda 29 Nov 20, 2022
FastAPI-PostgreSQL-Celery-RabbitMQ-Redis bakcend with Docker containerization

FastAPI - PostgreSQL - Celery - Rabbitmq backend This source code implements the following architecture: All the required database endpoints are imple

Juan Esteban Aristizabal 54 Nov 26, 2022
Sample FastAPI project that uses async SQLAlchemy, SQLModel, Postgres, Alembic, and Docker.

FastAPI + SQLModel + Alembic Sample FastAPI project that uses async SQLAlchemy, SQLModel, Postgres, Alembic, and Docker. Want to learn how to build th

null 228 Jan 2, 2023
Cookiecutter API for creating Custom Skills for Azure Search using Python and Docker

cookiecutter-spacy-fastapi Python cookiecutter API for quick deployments of spaCy models with FastAPI Azure Search The API interface is compatible wit

Microsoft 379 Jan 3, 2023
Qwerkey is a social media platform for connecting and learning more about mechanical keyboards built on React and Redux in the frontend and Flask in the backend on top of a PostgreSQL database.

Flask React Project This is the backend for the Flask React project. Getting started Clone this repository (only this branch) git clone https://github

Peter Mai 22 Dec 20, 2022
FastAPI + Postgres + Docker Compose + Heroku Deploy Template

FastAPI + Postgres + Docker Compose + Heroku Deploy ⚠️ For educational purpose only. Not ready for production use YET Features FastAPI with Postgres s

DP 12 Dec 27, 2022
:rocket: CLI tool for FastAPI. Generating new FastAPI projects & boilerplates made easy.

Project generator and manager for FastAPI. Source Code: View it on Github Features ?? Creates customizable project boilerplate. Creates customizable a

Yagiz Degirmenci 1k Jan 2, 2023
High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (w/ Redis and PostgreSQL).

fastapi-gino-arq-uvicorn High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (powered by Redis & PostgreSQL). Contents Get Star

Leo Sussan 351 Jan 4, 2023
REST API with FastAPI and PostgreSQL

REST API with FastAPI and PostgreSQL To have the same data in db: create table CLIENT_DATA (id SERIAL PRIMARY KEY, fullname VARCHAR(50) NOT NULL,email

Luis Quiñones Requelme 1 Nov 11, 2021
Adds simple SQLAlchemy support to FastAPI

FastAPI-SQLAlchemy FastAPI-SQLAlchemy provides a simple integration between FastAPI and SQLAlchemy in your application. It gives access to useful help

Michael Freeborn 465 Jan 7, 2023
SQLAlchemy Admin for Starlette/FastAPI

SQLAlchemy Admin for Starlette/FastAPI SQLAdmin is a flexible Admin interface for SQLAlchemy models. Main features include: SQLAlchemy sync/async engi

Amin Alaee 683 Jan 3, 2023
FastAPI CRUD template using Deta Base

Deta Base FastAPI CRUD FastAPI CRUD template using Deta Base Setup Install the requirements for the CRUD: pip3 install -r requirements.txt Add your D

Sebastian Ponce 2 Dec 15, 2021
Docker image with Uvicorn managed by Gunicorn for high-performance FastAPI web applications in Python 3.6 and above with performance auto-tuning. Optionally with Alpine Linux.

Supported tags and respective Dockerfile links python3.8, latest (Dockerfile) python3.7, (Dockerfile) python3.6 (Dockerfile) python3.8-slim (Dockerfil

Sebastián Ramírez 2.1k Dec 31, 2022
FastAPI with Docker and Traefik

Dockerizing FastAPI with Postgres, Uvicorn, and Traefik Want to learn how to build this? Check out the post. Want to use this project? Development Bui

null 51 Jan 6, 2023
Simple FastAPI Example : Blog API using FastAPI : Beginner Friendly

fastapi_blog FastAPI : Simple Blog API with CRUD operation Steps to run the project: git clone https://github.com/mrAvi07/fastapi_blog.git cd fastapi-

Avinash Alanjkar 1 Oct 8, 2022
Sample-fastapi - A sample app using Fastapi that you can deploy on App Platform

Getting Started We provide a sample app using Fastapi that you can deploy on App

Erhan BÜTE 2 Jan 17, 2022