Monthly Update May 2020

Strapi
4 min readJun 15, 2020

--

The month of May was a very singular one for us. We announced our latest 10M$ fundraising with Index Ventures, and the next week, we also officially released the stable version. Two major milestones for the sustainability of the project and the community!

We are thrilled to welcome Sunny as a Marketing Coordinator! She’s going to promote the feature releases, social events, and more. As a fast-growing company, we have to reinforce our marketing team to respond to all the internal and external requests. Feel free to ping her and say hi on the community public Slack 🙂

We are still looking for new awesome people to join the team. If you want to be part of the journey, send us through your application!

As you might know, we officially released the stable version. We started five years ago by making the first commit. Since then, the initial framework had became a product called an Headless CMS. The vision is still the same: being the most flexible and customizable solution to manage content.

Read the official announcement.

Dump & restore commands

The stable introduced two new commands to dump and restore the settings. More precisely, it dumps the core_store table into a file. Many users reported it was hard to migrate a project from an environment to another. Even if the following commands don't solve the entire issue, as we don't migrate data but only settings, it's the first step to an easier migration setup.

Use the commands is dead-simple! Open your terminal at the root of the Strapi project and execute the command.

yarn strapi config:dump -f dump.json

or

npm run strapi configuration:dump -- -f dump.json

Note: The file will be saved at the root of your project folder.

Then, deploy your project on production and run the restore command before launching the server.

yarn strapi config:restore -f dump.json

That’s it! Your project will have the same settings in development and production. Here is the list of settings which can be migrated:

Content Manager — Layout, placeholders and labels of the Edit and List views. — Filters, search and bulk actions settings. Users & Permissions — Providers settings — Email template — Advanced settings Media Library — Settings (responsive-friendly, file optimization, etc).

Configurations management

Managing configurations can be challenging sometimes. In order to follow best practices, we introduced a new Configuration API within the core. Instead of only using JSON files to set configurations, you can also use JavaScript file and enjoy the new API.

We’d always used the JSON format before the Configuration API. For instance, if you want to create a custom configuration file called config/frontend.json and you are done!

{ "url": "https://strapi.io" }

To access the value, you can easily do it like this in any file.

module.exports = () => { console.log(strapi.config.get('frontend.url')) // It will return "https://strapi.io" };

Moreover, the Configurations API also introduces a better way to manage environment variables using .env file. Let's keep the same example, but instead of using the JSON format, we will create a configuration file with JavaScript config/frontend.js.

module.exports = () => ({ url: 'https://strapi.io', });

Note: Don’t forget to delete the previous config/frontend.json file.

It does the exact same thing as we did with the JSON configuration files. However, we can now get access to the Configurations API using parameters available in the function.

module.exports = ({ env }) => ({ url: env('FRONTEND_URL', 'https://strapi.io'), });

The code-block above uses the environment function (env) to define a global name to this configuration. It means that if you create a .env in your project, it will use the value set for FRONTEND_URL into the .env file.

For example, if you’ve created a .env file at the root of your project like this:

FRONTEND_URL=https://myfrontend.com

Then, you start your project running the following command:

ENV_PATH=.env yarn develop

The value of the strapi.config.get('frontend.url') will be [https://myfrontend.com](https://myfrontend.com) . If there is no .env file, the value will be [https://strapi.io](https://strapi.io) .

If you want to dig deeper, please take a look at the documentation.

Next month, I’ll give more details about the RBAC feature coming and what are the impacts on the open-source project as it is our first partial paid feature. Regarding the Enterprise Edition, if you want more details about the pricing and the ETA, please give us a shout.

Feel free to engage with us and ask any questions you have. We look forward to answering you!

See you soon 👋

Originally published at https://strapi.io.

--

--

Strapi

The open source Headless CMS Front-End Developers love.