🚀 Strapi quickstart with Docker

How to run this promising CMS immediately and start right now on an innovative technology that will make you delighted !

What is it ?

Strapi is the most advanced Node.js API Content Management Framework. Halfway between a Node.js Framework and a Headless CMS, it saves weeks of API development time.

Why this quickstart ?

I discovered Strapi while looking after a Headless CMS a few months ago to build the API for a project, and it made my day! 🤗

After contributing to the documentation and fixing some typo in the code, I am feeling excited to also contribute to the core code.

The Strapi’s roadmap contains a lot of features which are implemented by the rest of the team quite quickly. Therefore, I decided to focus on the deployment part to find an easy way for people to start using Strapi.

You’ll learn in this quickstart article how to use Strapi without any configuration. This example is made with the MongoDB database as it’s easier to learn and it is the most used one in the NodeJS community.

Here we go !

🛠 Prerequisite softwares

🚀 Starting Strapi

In a terminal, type the below commands:

$ git clone https://github.com/strapi/strapi-docker && cd strapi-docker
$ docker-compose up

After few minutes, your application is ready to be used at http://localhost:1337. You can, now, create your first user and APIs.

🔥 For hackers, you could find the generated application in the strapi-app folder. Check out the concepts of Strapi, and start building your custom behaviors !

🦄 How does it works ?

Behind the scene

To achieve that, I have performed several contributions on the core:

I officially joined the Strapi’s organization as a contributor to maintain these features.

Deep explanations…

For the end user

Here’s explained how services are orchestrated within the docker-compose.yml file:

  • db is the MongoDB image, customize this to use another database provider supported by Strapi actually MongoDB, Postgres, MySQL, Sqlite3, and Redis.
  • api is the Strapi Docker image that includes the CLI to create and start your application.

Use environment to customize variable used to bootstrap your api (configuration of others connectors aren’t explained in this post):

  • APP_NAME to override the strapi-app generated folder name (you should also update the volumes paths).
  • DATABASE_CLIENT mongo, postgres, mysql, sqlite3, redis.
  • DATABASE_HOST database service name.
  • DATABASE_PORT depends on your database client.
  • DATABASE_NAME initializes a database with a specific name (default strapi). When using MongoDB, you should also update the MONGO_INITDB_DATABASE environment in the db service.
  • DATABASE_USERNAME set the username of the database connection.
  • DATABASE_PASSWORD set the password of the database connection.

💡 What’s next…

This tutorial is made to start your development environment as easy as possible. The next step, for you, will be the deployment of the Docker container to the cloud. (I’ll cover that part in a future post)

In the future, Pepper will deploy for you !

Thanks to the team !

It was a nice experience working with Strapi’s team, they were reactive to my pull requests and relevant to code reviews.

I’m confident that this startup will grow up and will make content management easy and powerful, for smaller or bigger projects.

Finally, I’m glad to be part of the team and looking forward to contribute to the future of bootSTRaping APIS 👈