A comprehensive template for building fullstack web applications using FastAPI and HTMX. This project is designed to provide a robust starting point for developing modern, dynamic, and scalable web applications.
- FastAPI: A high-performance web framework for building APIs with Python 3.7+.
- HTMX: Simplifies building dynamic web applications without the need for a frontend framework.
- SQLModel & SQLAdmin: Seamless database integration and ORM with SQLModel and Admin interface with SQLAdmin.
- Jinja2: Server-side templating for rendering dynamic HTML.
- User Authentication: Secure user authentication with
bcrypt
,passlib
, andfastapi-sessions
. - Environment Configuration: Easy-to-manage environment variables using
python-dotenv
. - Production-Ready: Includes tools like
uvicorn
anduvloop
for deploying high-performance applications.
- Python 3.10+
-
Clone the repository:
git clone https://github.com/RexsyBima/fastapi-htmx-fullstack-template.git
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
- Create a
.env
file in the root directory. - Add required variables, e.g.,
DATABASE_URL=sqlite:///./test.db SECRET_KEY=your-secret-key
- Create a
-
Run the development server:
uvicorn app.main:app --reload
- Build dynamic pages with HTMX by integrating HTML snippets in
templates/
. - Leverage FastAPI's dependency injection for robust API design.
- Manage SQL databases with SQLModel's ORM capabilities.
- Use the integrated session management for user authentication.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Push to your fork.
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.