Giter Site home page Giter Site logo

fasthtmx's Introduction

Fast-HTMX

Description

Fast-HTMX is a demo project of FastAPI and HTMX. The purpose of this project is to illustrate how to create a website with no JavaScript, using only HTML, CSS, and Python. HTMX is a plugin that allows this to be possible.

HTMX Attributes

The following HTMX attributes are used in this project:

  • hx-get
  • hx-post
  • hx-trigger
  • hx-target
  • hx-push-url
  • hx-indicator
  • hx-swap

Structure

db - Database setup

models - Data models

schema - Pydantic models

services - Database services

static - Static files

templates - Contains files for each page and partials for all partial pages that are related to the main page of the directory which it is under.

viewmodels - View models for gathering data for pages and partials.

main.py - Main operational file for running FastAPI.

How to run

  • Create virtual environment
  • Activate virtual environment
  • Install requirements pip3 install -r requirements.txt
  • Run project python3 -m uvicorn main:app --reload

    Using Docker

    • Build image docker build -t fast-htmx .
    • Create Database touch sql_app.db
    • Run container docker run -v $(pwd)/sql_app.db:/code/sql_app.db -d --name fast-htmx -p 8000:8000 fast-htmx

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.