All Projects → tiangolo → full-stack-flask-couchdb

tiangolo / full-stack-flask-couchdb

Licence: MIT License
Full stack, modern web application generator. Using Flask, CouchDB as database, Docker, Swagger, automatic HTTPS and more.

Programming Languages

python
139335 projects - #7 most used programming language
typescript
32286 projects
Vue
7211 projects
Dockerfile
14818 projects
shell
77523 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to full-stack-flask-couchdb

Full Stack
Full stack, modern web application generator. Using Flask, PostgreSQL DB, Docker, Swagger, automatic HTTPS and more.
Stars: ✭ 451 (+1510.71%)
Mutual labels:  letsencrypt, jwt, generator, swagger, cookiecutter, marshmallow, celery
Full Stack Fastapi Postgresql
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.
Stars: ✭ 7,635 (+27167.86%)
Mutual labels:  letsencrypt, jwt, swagger, cookiecutter, celery, traefik
Full Stack Fastapi Couchbase
Full stack, modern web application generator. Using FastAPI, Couchbase as database, Docker, automatic HTTPS and more.
Stars: ✭ 243 (+767.86%)
Mutual labels:  letsencrypt, jwt, swagger, cookiecutter, celery
Cookiecutter Flask Restful
Flask cookiecutter template for builing APIs with flask-restful, including JWT auth, cli, tests, swagger, docker and more
Stars: ✭ 556 (+1885.71%)
Mutual labels:  jwt, cookiecutter, marshmallow
Spring Boot Plus
🔥 Spring-Boot-Plus is a easy-to-use, high-speed, high-efficient,feature-rich, open source spring boot scaffolding. 🚀
Stars: ✭ 2,198 (+7750%)
Mutual labels:  jwt, generator, swagger
Train Ai With Django Swagger Jwt
Train AI (Keras + Tensorflow) to defend apps with Django REST Framework + Celery + Swagger + JWT - deploys to Kubernetes and OpenShift Container Platform
Stars: ✭ 66 (+135.71%)
Mutual labels:  jwt, swagger, celery
Study
全栈工程师学习笔记;Spring登录、shiro登录、CAS单点登录和Spring boot oauth2单点登录;Spring data cache 缓存,支持Redis和EHcahce; web安全,常见web安全漏洞以及解决思路;常规组件,比如redis、mq等;quartz定时任务,支持持久化数据库,动态维护启动暂停关闭;docker基本用法,常用image镜像使用,Docker-MySQL、docker-Postgres、Docker-nginx、Docker-nexus、Docker-Redis、Docker-RabbitMQ、Docker-zookeeper、Docker-es、Docker-zipkin、Docker-ELK等;mybatis实践、spring实践、spring boot实践等常用集成;基于redis的分布式锁;基于shared-jdbc的分库分表,支持原生jdbc和Spring Boot Mybatis
Stars: ✭ 159 (+467.86%)
Mutual labels:  jwt, swagger
Spring Rest Ecommerce
Java Spring Boot - Ecommerce REST API
Stars: ✭ 164 (+485.71%)
Mutual labels:  jwt, swagger
Hospital
医院预约挂号微信小程序(Spring Boot、Vue、Uni-app)
Stars: ✭ 182 (+550%)
Mutual labels:  jwt, swagger
Nest Permissions Seed
A simple application demonstrating the basic usage of permissions with NestJS.
Stars: ✭ 121 (+332.14%)
Mutual labels:  jwt, swagger
Api Generator
PHP-code generator for Laravel framework, with complete support of JSON-API data format
Stars: ✭ 244 (+771.43%)
Mutual labels:  jwt, generator
traefik-letsencrypt-compose
Basic Traefik configuration which includes automatic Let’s Encrypt certificate management and password protected dashboard
Stars: ✭ 38 (+35.71%)
Mutual labels:  letsencrypt, traefik
Spring Boot Examples
个人学习 SpringBoot2.x 写的一些示例程序,目前正在持续更新中.....
Stars: ✭ 159 (+467.86%)
Mutual labels:  jwt, swagger
Ssm
👅基于RESTful风格的前后端分离的SSM框架,集成了shiro和swagger等框架
Stars: ✭ 141 (+403.57%)
Mutual labels:  jwt, swagger
Spring Boot Quick
🌿 基于springboot的快速学习示例,整合自己遇到的开源框架,如:rabbitmq(延迟队列)、Kafka、jpa、redies、oauth2、swagger、jsp、docker、spring-batch、异常处理、日志输出、多模块开发、多环境打包、缓存cache、爬虫、jwt、GraphQL、dubbo、zookeeper和Async等等📌
Stars: ✭ 1,819 (+6396.43%)
Mutual labels:  jwt, swagger
baghdad
Distributed CI/CD for microservices
Stars: ✭ 15 (-46.43%)
Mutual labels:  traefik, swarm-mode
docker-nextcloud
Nextcloud Docker image
Stars: ✭ 209 (+646.43%)
Mutual labels:  letsencrypt, traefik
self-hosted-services
A core set of privacy-preserving services that can be easily self-hosted via Docker Compose.
Stars: ✭ 123 (+339.29%)
Mutual labels:  letsencrypt, traefik
Aspnetcore Ddd
Full ASP.NET Core 3.1 LTS application with DDD, CQRS and Event Sourcing
Stars: ✭ 88 (+214.29%)
Mutual labels:  jwt, swagger
Netcoreblockly
.NET Core API to Blockly - generate from WebAPI, Swagger, OData, GraphQL =>
Stars: ✭ 121 (+332.14%)
Mutual labels:  jwt, swagger

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.

  • FastAPI (and its project generators), would give you about 800% (8x) the performance achievable with this one.
  • Writing code in FastAPI is about 200% to 300% faster. Because you write a lot less code, it is designed for web APIs, and you have auto-complete everywhere.
  • About 40% of the human (developer) induced errors can be reduced (FastAPI does a lot of the data validation, conversion and documentation for you).

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. 🙂

⚠️ 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.

You are still free to use this project, but it won't receive any new features, changes, or bug fixes.


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 with:
    • Flask-apispec: Swagger live documentation generation
    • Marshmallow: model and data serialization (convert model objects to JSON)
    • Webargs: parse, validate and document inputs to the endpoint / route
    • Secure password hashing by default
    • JWT token authentication
    • Basic starting functionality for users and roles (modify and remove as you need)
    • CORS (Cross Origin Resource Sharing)
  • Celery worker that can import and use code from the rest of the backend selectively (you don't have to install the complete app in each worker)
  • NoSQL CouchDB database that supports direct synchronization for offline-first applications
  • REST backend tests based on Pytest, integrated with Docker, so you can test the full API interaction, independent on the database. As it runs in Docker, it can build a new data store from scratch each time (so you can use ElasticSearch, MongoDB, or whatever you want, and just test that the API works).
  • Easy Python integration with Jupyter Kernels for remote or in-Docker development with extensions like Atom Hydrogen or Visual Studio Code Jupyter
  • Vue frontend:
    • Generated with Vue CLI
    • JWT Authentication handling
    • Login view
    • After login, main dashboard view
    • Vuex
    • Vue-router
    • Vuetify for beautiful material design components
    • TypeScript
    • 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
    • Frontend tests ran at build time (can be disabled too)
    • Made as modular as possible, so it works out of the box, but you can re-generate with Vue CLI or create it as you need, and re-use what you want
  • Swagger-UI for live interactive documentation
  • Flower for Celery jobs monitoring
  • Load balancing between frontend and backend with Traefik, so you can have both under the same domain, separated by path, but served by different containers
  • Traefik integration, including Let's Encrypt HTTPS certificates automatic generation
  • GitLab CI (continuous integration), including frontend and backend testing

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:

  • project_name: The name of the project

  • project_slug: The development friendly name of the project. By default, based on the project name

  • domain_main: The domain in where to deploy the project for production (from the branch production), used by the load balancer, backend, etc. By default, based on the project slug.

  • domain_staging: The domain in where to deploy while staging (before production) (from the branch master). By default, based on the main domain.

  • docker_swarm_stack_name_main: The name of the stack while deploying to Docker in Swarm mode for production. By default, based on the domain.

  • docker_swarm_stack_name_staging: The name of the stack while deploying to Docker in Swarm mode for staging. By default, based on the domain.

  • secret_key: Backend server secret key. Use the method above to generate it.

  • first_superuser: The first superuser generated, with it you will be able to create more users, etc. By default, based on the domain.

  • first_superuser_password: First superuser password. Use the method above to generate it.

  • backend_cors_origins: Origins (domains, more or less) that are enabled for CORS (Cross Origin Resource Sharing). This allows a frontend in one domain (e.g. https://dashboard.example.com) to communicate with this backend, that could be living in another domain (e.g. https://api.example.com). It can also be used to allow your local frontend (with a custom hosts domain mapping, as described in the project's README.md) that could be living in http://dev.example.com:8080 to cummunicate with the backend at https://stag.example.com. Notice the http vs https and the dev. prefix for local development vs the "staging" stag. prefix. By default, it includes origins for production, staging and development, with ports commonly used during local development by several popular frontend frameworks (Vue with :8080, React, Angular).

  • couchdb_user: CouchDB main user to be used by the application (code). By default admin.

  • couchdb_password: Password of the main user, for the backend code. Generate it with the method above.

  • couchdb_cors_origins: List of CORS origins that the database should allow to talk to directly. Similar to backend_cors_origins.

  • traefik_constraint_tag: The tag to be used by the internal Traefik load balancer (for example, to divide requests between backend and frontend) for production. Used to separate this stack from any other stack you might have. This should identify each stack in each environment (production, staging, etc).

  • traefik_constraint_tag_staging: The Traefik tag to be used while on staging.

  • traefik_public_network: This assumes you have another separate publicly facing Traefik at the server / cluster level. This is the network that main Traefik lives in.

  • traefik_public_constraint_tag: The tag that should be used by stack services that should communicate with the public.

  • flower_auth: Basic HTTP authentication for flower, in the formuser:password. By default: "root:changethis".

  • sentry_dsn: Key URL (DSN) of Sentry, for live error reporting. If you are not using it yet, you should, is open source. E.g.: https://1234abcd:[email protected]/30.

  • docker_image_prefix: Prefix to use for Docker image names. If you are using GitLab Docker registry it would be based on your code repository. E.g.: git.example.com/development-team/my-awesome-project/.

  • docker_image_backend: Docker image name for the backend. By default, it will be based on your Docker image prefix, e.g.: git.example.com/development-team/my-awesome-project/backend. And depending on your environment, a different tag will be appended ( prod, stag, branch ). So, the final image names used will be like: git.example.com/development-team/my-awesome-project/backend:prod.

  • docker_image_celeryworker: Docker image for the celery worker. By default, based on your Docker image prefix.

  • docker_image_frontend: Docker image for the frontend. By default, based on your Docker image prefix.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].