Accelerate your next web development project with this FastAPI/React/MongoDB base project generator.
This project is for developers looking to build and maintain full-feature progressive web applications using Python on the backend / Typescript on the frontend, and want the complex-but-routine aspects of auth 'n auth, and component and deployment configuration, taken care of, including interactive API documentation.
This is an experimental fork of Sebastián Ramírez's Full Stack FastAPI and PostgreSQL Base Project Generator and Whythawk's Full Stack FastAPI and PostgreSQL Base Project Generator. FastAPI is updated to version 0.103.2, MongoDB Motor 3.4, Beanie ODM 1.23, and the frontend to React.
This FastAPI, React, MongoDB repo will generate a complete web application stack as a foundation for your project development.
- Docker Compose integration and optimization for local development.
- Authentication user management schemas, models, crud and apis already built, with OAuth2 JWT token support & default hashing. Offers magic link authentication, with password fallback, with cookie management, including
access
andrefresh
tokens. - FastAPI backend with Inboard one-repo Docker images:
- MongoDB Motor https://motor.readthedocs.io/en/stable/
- MongoDB Beanie for handling ODM creation https://beanie-odm.dev/
- Common CRUD support via generic inheritance.
- Standards-based: Based on (and fully compatible with) the open standards for APIs: OpenAPI and JSON Schema.
- Many other features: including automatic validation, serialization, interactive documentation, etc.
- Nextjs/React frontend:
- Authorisation via middleware for page access, including logged in or superuser.
- Form validation with Vee-Validate 4.
- State management with Redux
- CSS and templates with TailwindCSS, HeroIcons, and HeadlessUI.
- Celery worker that can import and use models and code from the rest of the backend selectively.
- Flower for Celery jobs monitoring.
- Load balancing between frontend and backend with Traefik, so you can have both under the same domain, separated by path, but served by different containers.
- Traefik integration, including Let's Encrypt HTTPS certificates automatic generation.
- GitLab CI (continuous integration), including frontend and backend testing.
- Getting started
- Development and installation
- Deployment for production
- Authentication and magic tokens
- Websockets for interactive communication
After using this generator, your new project (the directory created) will contain an extensive README.md
with instructions for development, deployment, etc. You can pre-read the project README.md
template here too.
This current release (October 2023) is for FastAPI version 0.103 and introduces support for Pydantic 2. Since this is intended as a base stack on which you will build complex applications, there is no intention of backwards compatability between releases, and the objective is to ensure that each release has the latest long-term-support versions of the core libraries so that you can rely on your application core for as long as possible.
To align with Inboard, Poetry has been deprecated in favour of Hatch. This will also, hopefully, sort out some Poetry-related Docker build errors.
This stack is in an experimental state, so there is no guarantee for bugs or issues. Please open an issue ticket against this repository to make us aware of issues and we will do our best to respond to them in a timely manner. Please leave feedback on features that would be very beneficial for developers who often leverage mongodb in their FastAPI stack.
The tests are broken and it would be great if someone could take that on. Other potential roadmap items:
- Translation: docs are all in English and it would be great if those could be in other languages.
- Internationalisation: nuxt/i18n is added, but the sample pages are not all translated.
- Code review and optimisation: both the front- and backend stacks have seen some big generational changes, so would be good to have more eyes on the updates to this stack.
See notes:
- Replaced Next/Vue.js frontend framework with entirely React/Redux
- Replaced Backend native connection of PostgreSQL/SQLAlchemy with MongoDB Motor/Beanie ODM
- Removed Neo4j plugin
- Removed Alembic Usage
- Introduced new cookiecutter environment variables
mongodb_uri
, andmongo_database
- Introduced support for Pydantic 2
Historic changes from whythawk Historic changes from original
This project is licensed under the terms of the MIT license.