What is the Cookiecutter?

Tram Ho

When I first started working on a flask or django related project with python language, there were several sample project templates that could be customized quickly with it, I saw the phrase cookiecutter appear. It is strange to find out how it looks.

The root cause

Normally we would start a repo in an always cumbersome project, especially a combination of microservices. We have all sorts of compliant configs, which are the A + folder and the B folder, the system configuration and the father.

For example: I have a frontend service, Vue + backend, Laravel + dockerfile config (redis, mysql, php-fpm, node …). Suppose we have 3 projects that use the same technology but each new project, we have to fix a bunch of things when we scoop one after another. This does not always work well, missed we forget rather old private name-secret project for the project such as the public has not always stick or incident. Sometimes this project doesn’t need a library to run unit tests like the old project, so I took the time to delete it.

Using cookiecutter and templates will reduce that pressure and save a lot of time building base projects.

What is the Cookiecutter?

Cookiecutter is a CLI tool with a command-line interface on the terminal to create an application summary from the template available. Normally CLI we often use as a base build with React.js, Vue, … there are custom feature options and CLI will build the base in accordance with their own criteria for simple tutorial code, but that CLi does. how can it fit into many microservices base code.

Cookiecutter is built in Python language

How to use ?

Cookiecutter we can use with repo on Git, folder or .zip file.

Modeling is always hot

we set cookiecutter with

Let’s try the tutorial with the repo, who created the cookiecutter

Directory structure here:

After running, we have a series of custom options, project name, slug, author, license … Or have additional features such as pytest, other libraries depending on the purpose of use.


The next part I will go deeper to create a base project that combines this custom cookiecutter CLI.

Share the news now

Source : Viblo