tiangolo / full-stack-flask-couchdb

Full stack, modern web application generator. Using Flask, CouchDB as database, Docker, Swagger, automatic HTTPS and more.
MIT License
31 stars 10 forks source link
angular api apispec celery cookiecutter couchdb docker flask generator jwt letsencrypt marshmallow python swagger swarm-mode token-authetication traefik webargs

🚨 DEPRECATION WARNING 🚨

As FastAPI and the equivalent project generators provide a much better solution to all the use cases this project was built for, all the future development will be done there.

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, but it won't receive any new features, changes, or bug fixes.

Full Stack Flask CouchDB - project generator

Build Status

Generate a backend and frontend stack using Python, including interactive API documentation.

Screenshot

Notice: Flask or FastAPI

If you are using this project (or Flask in general to create web APIs) you would probably benefit more from FastAPI.

You can use one of the equivalent sibling project generators based on FastAPI:

They both have more features than this one.

FastAPI was created from the learnings acquired while creating and using these project generators for Flask, with all the plug-ins and ideas.

Note

If you are still interested in CouchDB and would like to have a project generator based on FastAPI, please create a new issue to let me know. I'm currently not having enough work "bandwidth" to create a project generator based on FastAPI and CouchDB, but I could change my mind if there are many users requesting it, etc. 🙂


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/full-stack-flask-couchdb

Generate passwords

You will be asked to provide passwords and secret keys for several components. Open another terminal and run:

openssl rand -hex 32
# Outputs something like: 99d3b1f01aa639e4a76f4fc281fc834747a543720ba4c8a8648ba755aef9be7f

Copy the contents and use that as password / secret key. And run that again to generate another secure key.

Input variables

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

The input variables, with their default values (some auto generated) are:

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.

History

Note about Angular: a previous version of this project generated a basic default Angular frontend application, but without any view or interaction with the rest of the stack (the backend API). I recently switched to Vue for frontend and used it to created the basic frontend views for this project (that didn't exist before). If you are interested in keeping the Angular version, let me know in an issue, I can create an Angular version of the project (without the current default views), then you can integrate your Angular app with the basic Dockerfile and additional files.

License

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