Giter Club home page Giter Club logo

fastapi-template's Introduction

Hi there ๐Ÿ‘‹

Who am I?

Grant Ramsay, also known as 'Seapagan'. Coder, Dev-ops, Full-Stack developer and unashamed Trekkie.

I have been programming in one form or other since I was 10 (ZX81 BASIC FTW), which is over 40 years of wrist strain and no dates.

For 27 years of this time I also had an amazing life and career in the offshore Oil and Gas Industry working on (and then running) Seismic Survey Ships, traveling almost the whole world and finding new and unique local customs to be arrested for breaking, usually while imbibing new and unique local alcohol. I was a Doodlebugger, it's a lifestyle not a job.

Those days are way past now and I have returned to coding as a way of life. I am fascinated with new technologies and continuously want to learn more and more.

My current languages of choice are Python, HTML/CSS etc, React, Vanilla Javascript and Ruby (though I spend less time using the latter these days sadly).

I'm also trying to improve my Frontend skills using the Frontend Mentor challenges. These will be stored in a GitHub Organization I created specifically for this purpose, to keep the noise down in my main account. Find them here.

Visit my Portfolio page for more.

Anurag's github stats

I also have more public repositories on my @gnramsay account

fastapi-template's People

Contributors

dependabot[bot] avatar pdrivom avatar pre-commit-ci[bot] avatar seapagan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fastapi-template's Issues

DB Connection / release error

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
multiple requests which hit the db simultaneously or in quick succession

Seeing error:

   |     user_data = await db.fetch_one(
   |   File "/usr/local/lib/python3.9/site-packages/databases/core.py", line 152, in fetch_one
   |     return await connection.fetch_one(query, values)
   |   File "/usr/local/lib/python3.9/site-packages/databases/core.py", line 251, in __aexit__
   |     await self._connection.release()
  |   File "/usr/local/lib/python3.9/site-packages/databases/backends/postgres.py", line 174, in release
 |     assert self._database._pool is not None, "DatabaseBackend is not running"
  | AssertionError: DatabaseBackend is not running

Feature Request: Social Auth

Is your feature request related to a problem? Please describe.
I'd like to be able to use social accounts for authentication(GitHub, twitter, Google etc). Is it possible to integrate that into this project?

Key Management secrets engine

Is your feature request related to a problem? Please describe.
Storing JWT encryption key on a server, it's not the most secure option. Using a Key Management engine, makes it safer for production setting.

Describe the solution you'd like
Use Hashicorp Vault integration for DB credentials (with auto-rotating), JWT secrets, etc.

Poetry install broken under Docker

Describe the bug
Cloning the repo, and running docker compose up --build fails.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the main branch locally
  2. Run docker compose up --build
19.53   โ€ข Installing pygithub (2.1.1)
19.79 
19.79   ChefBuildError
19.79 
19.79   Backend subprocess exited when trying to invoke get_requires_for_build_wheel
19.79   
19.79   Traceback (most recent call last):
19.79     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
19.79       main()
19.79     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
19.79       json_out['return_val'] = hook(**hook_input['kwargs'])
19.79                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19.79     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
19.79       backend = _build_backend()
19.79                 ^^^^^^^^^^^^^^^^
19.79     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 74, in _build_backend
19.79       ep = os.environ['PEP517_BUILD_BACKEND']
19.79            ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
19.79     File "<frozen os>", line 679, in __getitem__
19.79   KeyError: 'PEP517_BUILD_BACKEND'
19.79   
19.79 
19.79   at /usr/local/lib/python3.11/site-packages/poetry/installation/chef.py:166 in _prepare
19.85       162โ”‚ 
19.85       163โ”‚                 error = ChefBuildError("\n\n".join(message_parts))
19.85       164โ”‚ 
19.85       165โ”‚             if error is not None:
19.85     โ†’ 166โ”‚                 raise error from None
19.85       167โ”‚ 
19.86       168โ”‚             return path
19.86       169โ”‚ 
19.86       170โ”‚     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
19.87 
19.87 Note: This error originates from the build backend, and is likely not a problem with poetry but with jsmin (3.0.1) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "jsmin (==3.0.1)"'.
19.87 
19.88 
19.88   ChefBuildError
19.88 
19.88   Backend subprocess exited when trying to invoke get_requires_for_build_wheel
19.88   
19.88   Traceback (most recent call last):
19.88     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
19.88       main()
19.88     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
19.88       json_out['return_val'] = hook(**hook_input['kwargs'])
19.88                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19.88     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
19.88       backend = _build_backend()
19.88                 ^^^^^^^^^^^^^^^^
19.88     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 74, in _build_backend
19.88       ep = os.environ['PEP517_BUILD_BACKEND']
19.88            ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
19.88     File "<frozen os>", line 679, in __getitem__
19.88   KeyError: 'PEP517_BUILD_BACKEND'
19.88   
19.88 
19.88   at /usr/local/lib/python3.11/site-packages/poetry/installation/chef.py:166 in _prepare
19.91       162โ”‚ 
19.91       163โ”‚                 error = ChefBuildError("\n\n".join(message_parts))
19.91       164โ”‚ 
19.91       165โ”‚             if error is not None:
19.91     โ†’ 166โ”‚                 raise error from None
19.91       167โ”‚ 
19.91       168โ”‚             return path
19.91       169โ”‚ 
19.91       170โ”‚     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
19.91 
19.91 Note: This error originates from the build backend, and is likely not a problem with poetry but with csscompressor (0.9.5) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "csscompressor (==0.9.5)"'.
19.91 
19.91   โ€ข Installing pytest (8.2.0)
19.91   โ€ข Installing python-multipart (0.0.7)
19.91   โ€ข Installing pytz (2023.3.post1)
19.97 
19.98   ChefBuildError
19.98 
19.98   Backend subprocess exited when trying to invoke get_requires_for_build_wheel
19.98   
19.98   Traceback (most recent call last):
19.98     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
19.98       main()
19.98     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
19.98       json_out['return_val'] = hook(**hook_input['kwargs'])
19.98                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19.98     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
19.98       backend = _build_backend()
19.98                 ^^^^^^^^^^^^^^^^
19.98     File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 74, in _build_backend
19.98       ep = os.environ['PEP517_BUILD_BACKEND']
19.98            ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
19.98     File "<frozen os>", line 679, in __getitem__
19.98   KeyError: 'PEP517_BUILD_BACKEND'
19.98   
19.98 
19.98   at /usr/local/lib/python3.11/site-packages/poetry/installation/chef.py:166 in _prepare
20.02       162โ”‚ 
20.02       163โ”‚                 error = ChefBuildError("\n\n".join(message_parts))
20.03       164โ”‚ 
20.03       165โ”‚             if error is not None:
20.03     โ†’ 166โ”‚                 raise error from None
20.03       167โ”‚ 
20.03       168โ”‚             return path
20.03       169โ”‚ 
20.03       170โ”‚     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
20.03 
20.03 Note: This error originates from the build backend, and is likely not a problem with poetry but with paginate (0.5.6) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "paginate (==0.5.6)"'.
20.03 
20.03   โ€ข Installing regex (2023.12.25)
20.11   โ€ข Installing simple-toml-settings (0.6.1)
20.14   โ€ข Installing single-source (0.3.0)
20.31   โ€ข Installing sqlalchemy (2.0.29)
20.32   โ€ข Installing starlette (0.37.2)
20.38   โ€ข Installing termcolor (2.4.0)
20.45   โ€ข Downgrading tomlkit (0.12.5 -> 0.12.3)
20.55   โ€ข Downgrading trove-classifiers (2024.4.10 -> 2024.1.8)
20.55   โ€ข Installing typer (0.9.4)
20.62   โ€ข Installing ujson (5.9.0)
20.71   โ€ข Installing uvicorn (0.29.0)
20.75   โ€ข Downgrading virtualenv (20.26.1 -> 20.25.0)
------
failed to solve: process "/bin/sh -c poetry install" did not complete successfully: exit code: 1

Expected behavior
Image builds successfully.

Additional context
This is something about the build backend, this PEP-517 build stuff is a common error (See python-poetry/poetry#8287) but none of the fixes worked, except removing the create.venv = false stuff in the Dockerfile.
But then the image builds successfully, but crashes shortly (alembic not found)

Docker Support

Is your feature request related to a problem? Please describe.
Add the possibility to run api+db on docker containers.

Describe the solution you'd like
Create a Dockerfile and docker-compose and provide the commands to run it.

Additional info
Forked the repo and already added this files. Also added Websec middlewares to improve security. (PR can be created)

Extra info
Nice idea creating the template, it can be very usefull if all right features are in place. Good job man!

Run Tests against Postgres database

Is your feature request related to a problem? Please describe.
It would be better to use the same type of database to run tests. If any breaking changes on database connection layer (either code or package update) would not be hidden on tests.

Describe the solution you'd like
Switch from SQLite to Postgres.

Extra info
I can work on it.

Advanced User Management

Is your feature request related to a problem? Please describe.
It would be really nice to have a complete paginated CRUD management of Users, Roles, Groups, Permissions with the option to search.

Describe the solution you'd like
Possibility to create User with Roles/Groups with a set of Permissions, all previously created.

Describe alternatives you've considered
User can be created with a 'default' Role/Group but can be edited later on.

Projects generated from template fail tests d/t codacy key

Describe the bug
Projects generated from this template fail tests d/t Codacy key not existing. A simple Fork, however, should still work.

To Reproduce
Click the use this template button. Once the first commit is made, all tests fail at the upload coverage part because no CODACY key is set.

Expected behaviour
Test work out the box

Improvements to the CLI metadata setup

Improvement suggestions for the ./api-admin custom metadata command:

  1. Enter the current year into the template.
  2. Allow changing the API version, option to set to 0.0.1

Cache Integration

Is your feature request related to a problem? Please describe.
For larger applications with a lot of data, caching architecture can increase greatly the performance of retrieving data.

Describe the solution you'd like
On the database query layer, first check if data exists on Redis, otherwise get on Postgres.

Intermittent test failures with 3.9 and 3.10

Describe the bug

Tests (on develop branch) fail intermittently under Python 3.9 and 3.10, only on GitHub CI not locally

To Reproduce

Run the CI manually or automatically after a PR/Commit push

Expected behavior

Tests all pass

Screenshots

fastapi-template-test-fails

Additional context

Looks to be an issue with the pyfakefs package, or more likely the way I am using it.

Internal Links on the web documentation site are broken.

Describe the bug
Internal Links on the web documentation site are broken.

  • Some links use absolute paths which fail since the GitHub pages are served from a sub-directory.
  • The Relative paths look bolloxed too

We could use a CNAME and custom domain so everything is served from the root which should work. I have a couple of personal domains we can use.

Error when creating user from CLI

using ./api-admin user create from the command line results in the following error :

-> ERROR adding User : UserManager.register() missing 1 required positional argument: 'background_tasks'

This is due to the new email-sending functionality - it needs a background_tasks parameter which is not available on the CLI.

Add unit tests

Please add unit tests so we can check if the project works.

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.