• This repository has been archived on 14/Nov/2022
  • Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language Vue
  • License
    MIT License
  • Created almost 6 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Minimal project generator with a Flask backend, a modern frontend (Vue, React or Angular), a Traefik load balancer with HTTPS, all based on Docker.

🚨 DEPRECATION WARNING 🚨

I'm currently not actively using this generator for any project.

You might still find some internal pieces of code useful for your own use cases, but I won't be able to fix bugs and add features.

If you are starting a new project from scratch, check the alternatives at the FastAPI docs: Project Generation.

You are still free to use this project if you want to, you might still find some internal pieces of code useful for your own use case. And if you already have a project generated with it that's fine as well (and you probably already updated it to suit your needs).

Flask Frontend Docker - project generator

Build Status

Generate stack with a a Flask backend and a modern (Vue.js, React, Angular) frontend.

Each in its own container, with routes handled by a Traefik proxy.

With automatic HTTPS certificate generation using Let's Encrypt.

Features

  • Full Docker integration (Docker based)
  • Docker Swarm Mode deployment
  • Docker Compose integration and optimization for local development
  • Production ready Python web server using Nginx and uWSGI
  • Python Flask backend:
    • CORS already configured, to be used by the frontend.
  • Vue frontend
    • Easily updated to be Angular or React.
    • Docker server based on Nginx (configured to play nicely with Vue-router)
    • Docker multi-stage building, so you don't need to save or commit compiled code
    • Easily enable frontend tests at build time
  • Load balancing between frontend and backend with Traefik:
    • So you can have both backend and frontend under the same domain, separated by path, but served by the two different containers
  • Automatic (free) HTTPS certificate generation with Let's Encrypt and Traefik

How to use it

Go to the directoy where you want to create your project and run:

pip install cookiecutter
cookiecutter https://github.com/tiangolo/flask-frontend-docker

Input variables

The generator (cookiecutter) will ask you for some data, you might want to have at hand before generating the project.

To see the variables asked, check the cookiecutter.json file.

How to deploy

This stack can be adjusted and used with several deployment options that are compatible with Docker Compose, but it is designed to be used in a cluster controlled with pure Docker in Swarm Mode with a Traefik main load balancer proxy handling automatic HTTPS certificates, using the ideas from DockerSwarm.rocks.

Please refer to DockerSwarm.rocks to see how to deploy such a cluster in 20 minutes.

More details

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.

Alternatives

This is a very simple project generator, with just the minimum to have:

  • Flask in one Docker container.
  • A modern frontend in a separate Docker container:
    • With an example minimal Vue application, that can easily be changed to React, Angular, etc.
  • Both backend and frontend being served using a single proxy/load-balancer with Traefik:
    • Generating automatic HTTPS certificates with Let's Encrypt.

This doesn't include many useful tools for building APIs, database integrations, more sophisticate frontend features, etc.

It is just to show the minimum configurations to achieve that.

If you are building a backend that would be used by a modern frontend (like in this minimal project generator) you might benefit from other additional tools made for APIs.

This project generator has several bigger (more complete) sibling project generators that you might want to check and use.

FastAPI

If you are building a backend to be used as an API and a modern frontend that communicates with it (as in this project), you might benefit from using FastAPI instead of Flask, and a corresponding project generator, including a NoSQL database, security, authentication, asynchronous jobs, email notifications, etc:

https://github.com/tiangolo/full-stack-fastapi-couchbase

Flask

If for some reason you can't (or don't want to) use FastAPI and want to keep using Flask, there are also bigger sibling projects:

https://github.com/tiangolo/full-stack

https://github.com/tiangolo/full-stack-flask-couchbase

https://github.com/tiangolo/full-stack-flask-couchdb

License

This project is licensed under the terms of the MIT license.

More Repositories

1

fastapi

FastAPI framework, high performance, easy to learn, fast to code, ready for production
Python
73,897
star
2

full-stack-fastapi-template

Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more.
TypeScript
24,890
star
3

typer

Typer, build great CLIs. Easy to code. Based on Python type hints.
Python
14,943
star
4

sqlmodel

SQL databases in Python, designed for simplicity, compatibility, and robustness.
Python
13,694
star
5

uwsgi-nginx-flask-docker

Docker image with uWSGI and Nginx for Flask applications in Python running in a single container.
Python
2,986
star
6

uvicorn-gunicorn-fastapi-docker

Docker image with Uvicorn managed by Gunicorn for high-performance FastAPI web applications in Python with performance auto-tuning.
Python
2,699
star
7

asyncer

Asyncer, async and await, focused on developer experience.
Python
1,517
star
8

pydantic-sqlalchemy

Tools to convert SQLAlchemy models to Pydantic models
Python
1,173
star
9

nginx-rtmp-docker

Docker image with Nginx using the nginx-rtmp-module module for live multimedia (video) streaming.
Dockerfile
1,110
star
10

dockerswarm.rocks

Docker Swarm mode rocks! Ideas, tools and recipes. Get a production-ready, distributed, HTTPS served, cluster in minutes, not weeks.
Python
1,093
star
11

uwsgi-nginx-docker

Docker image with uWSGI and Nginx for applications in Python (as Flask) in a single container.
Python
646
star
12

uvicorn-gunicorn-docker

Docker image with Uvicorn managed by Gunicorn for high-performance web applications in Python with performance auto-tuning.
Python
628
star
13

full-stack

Full stack, modern web application generator. Using Flask, PostgreSQL DB, Docker, Swagger, automatic HTTPS and more.
Python
523
star
14

meinheld-gunicorn-flask-docker

Docker image with Meinheld and Gunicorn for Flask applications in Python.
Python
486
star
15

full-stack-fastapi-couchbase

Full stack, modern web application generator. Using FastAPI, Couchbase as database, Docker, automatic HTTPS and more.
Python
440
star
16

typer-cli

Run Typer scripts with completion, without having to create a package, using Typer CLI.
Python
367
star
17

poetry-version-plugin

Poetry plugin for dynamically extracting the package version from a __version__ variable or a Git tag.
Python
361
star
18

fastapi-cli

Run and manage FastAPI apps from the command line with FastAPI CLI. 🚀
Python
287
star
19

blog-posts

Blog posts and related code by Sebastián Ramírez (@tiangolo)
Python
273
star
20

uvicorn-gunicorn-starlette-docker

Docker image with Uvicorn managed by Gunicorn for high-performance Starlette web applications in Python with performance auto-tuning.
Python
182
star
21

latest-changes

A GitHub Action to add latest changes after each PR merged automatically
Python
172
star
22

babun-docker

Use Docker Toolbox with Babun (Cygwin) in Windows
Shell
170
star
23

meinheld-gunicorn-docker

Docker image with Meinheld managed by Gunicorn for high-performance WSGI (Flask, Django, etc) web applications in Python with performance auto-tuning.
Python
165
star
24

docker-with-compose

Docker image with Docker Compose installed for CI.
Shell
158
star
25

node-frontend

Instrutctions to buid a frontend Docker image built with Node.js and then served with Nginx. Previously a Docker image.
Dockerfile
137
star
26

python-machine-learning-docker

Docker image with Python 3.6 and 3.7 using Conda, with CUDA variants. To serve as base image for Machine Learning projects.
Dockerfile
84
star
27

uvicorn-gunicorn-machine-learning-docker

Docker image for high-performance Machine Learning web applications. With Uvicorn managed by Gunicorn in Python 3.7 and 3.6, using Conda, with CUDA and TensorFlow variants.
Python
67
star
28

issue-manager

Automatically close issues that have a label, after a custom delay, if no one replies back.
Python
62
star
29

full-stack-flask-couchbase

Full stack, modern web application generator. Using Flask, Couchbase as database, Docker, Swagger, automatic HTTPS and more.
Python
59
star
30

label-approved

Label a Pull Request after a number of approvals
Python
34
star
31

full-stack-flask-couchdb

Full stack, modern web application generator. Using Flask, CouchDB as database, Docker, Swagger, automatic HTTPS and more.
Python
31
star
32

tiangolo

16
star
33

github-actions-sandbox

Not useful for you. It's just a sandbox GitHub repo for me to try out stuff and develop GitHub Actions.
Python
16
star
34

tiangolo.com

Python
16
star
35

docker-auto-labels

Generate each Docker constraint label in random nodes in the cluster.
Python
15
star
36

angular-docker-multi-stage-example

Angular in Docker with Nginx, supporting environments, built with multi-stage Docker builds
15
star
37

ngx-http-client

Angular (4.3+) HttpClientModule with parameter encodings compatible with back ends (Node.js, Python, PHP, etc)
TypeScript
11
star
38

compose-to-rancher

Convert Docker Compose V2 to Rancher compatible Docker Compose V1
Python
10
star
39

markdown-include-variants

Markdown extension to expand directives to include source example files to also include their variants. Only useful to tiangolo's projets. Don't use it. 😅
Python
9
star
40

wunderlist2csv

Convert from Wunderlist backup json file to a CSV file importable by TaskCoach
Python
6
star
41

anaconda_cluster_install

Automatically Install Anaconda Python in a cluster of machines, for a specified user.
Shell
5
star
42

bitbucket_issues_to_redmine_csv

Python
3
star