The project is about a keychain containing a QR code. The code when scanned for the first time, takes you to a page to register the keychain with information about the owner of that object. From then on, every time it is scanned, it will take us to a page with that information.
Site: https://howiti.com/
- Language: Python 3.11+.
- Testing: PyTest.
- Framework: FastAPI.
- Authentication: OAuth 2.0 or Hanko.
- DB: MongoDB.
- Linter: Ruff.
- Other tech: Docker, GitHub Copilot, Hanko, uv, VSCode, FastCRUD.
- Optional: LLM, Ollama, Orbstack, Playwright
- First Commit with basic code, tests, Dockerfile and dependencies. 🚀
- Make an algorithm to generate QR IDs.
- Separate logic on main.py into Controllers.
- Add process to generate pdf from QR.
- Add View form for getting/show QR info.
- +tests.
- Add OAuth 2.0 support.
- Add MongoDB support.
- Add Hanko support.
- Clone the repo using
git clone https://github.com/jmcerrejon/howiti.git
. - Rename/Copy .env.example to .env and fill the variables.
- Install the dependencies with
pip install -r requirements.txt --no-cache-dir
. - Run the
tools/recreate_db.py
script to create the database. - For developer mode, run the app with
fastapi dev main.py
. For production use:fastapi run
- Open your browser and go for example to
http://127.0.0.1:8000/items/5?q=somequery
- For testing, run
pytest
in the terminal.
If you are a Mac/Linux user, I recommend you https://orbstack.dev/ to manage your Docker containers.
You have a containerized version of the app. To build the image, run:
docker build -t howiti . && docker run -d -p 8000:8000 --name howiti-container howiti
# docker-compose up --build is an alternative
This project uses PyTest for testing. To run tests, execute on root directory PYTHONPATH=. pytest path_to_test_dir
where proceed in the terminal.
- You can see the docs through the Swagger(http://127.0.0.1:8000/docs) or ReDoc(http://127.0.0.1:8000/redoc) endpoint.
- https://python.plainenglish.io/fastapi-project-setup-with-scalability-in-mind-3daef823ed83
- https://levelup.gitconnected.com/fastapi-pagination-limits-and-limitations-f1020bcc3ef4
- https://medium.com/@simeon.emanuilov/the-evolution-of-fastapi-pydantic-models-for-query-header-and-cookie-parameters-version-0-115-0-0d7e138c5dd4
Both Uvicorn and Gunicorn are popular for running APIs with FastAPI, but they have differences in process management:
- Uvicorn is a lightweight and efficient ASGI server, ideal for simple, smaller-scale scenarios.
- Gunicorn, on the other hand, is a more robust WSGI server that can manage multiple processes more efficiently, especially in large-scale production environments. It also offers additional features like better worker control and automatic failure recovery, making it more suitable for high-availability scenarios.
However, to get the best of both worlds, it’s common to use Gunicorn in combination with Uvicorn (via uvicorn.workers.UvicornWorker), resulting in a powerful server with greater control over processes, and more suited for complex production scenarios. Check the next examples about how to use them:
CMD ["uvicorn", "main:app", "--proxy-headers", "--port", "8000", "--workers", "4", "--restart"]
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "main:app", "--workers", "4", "--bind", "0.0.0.0:8000"]
Read the GPL-3.0 License.
We are using Conventional Commits v1.0.0. More information can be found at https://www.conventionalcommits.org/en/v1.0.0/.
This repository is hosted at GitHub. You can find the repository at https://github.com/jmcerrejon/howiti
Howiti is a project made with ♥ by Jose Cardenas (WordPress, SEO) & Jose Cerrejon(Back/Frontend).