tiangolo / flask-frontend-docker

Minimal project generator with a Flask backend, a modern frontend (Vue, React or Angular), a Traefik load balancer with HTTPS, all based on Docker.
MIT License
130 stars 26 forks source link
docker docker-compose flask https letsencrypt nginx traefik uwsgi vue

🚨 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

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:

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.