How to Get Started with Directus as a Headless CMS
The Directus documentation shows three ways to get started. One is using Directus Cloud. The remaining two are self-hosting methods, which are more developer-oriented ways to begin.
Directus Cloud can be started by signing up, but if you want to actually run it locally and check its behavior, I recommend starting locally.
The easiest way to start Directus locally is to run the Docker command in the Quickstart Guide.
If you only want to try it very simply, you can run the documented Docker command. But for container management, adding the name option prevents the container name from becoming something unclear and also makes deletion easier.
docker run \
-p 8055:8055 \
-e SECRET=replace-with-secure-random-value \
--name <container-name> \
directus/directus
When Directus is started with the method above, logs like the following are output to the terminal at startup. This is the initial account, so do not miss it.
[01:04:22.687] INFO: No admin email provided. Defaulting to "[email protected]"
[01:04:22.689] INFO: No admin password provided. Defaulting to "XXXXXXXXXXXXXX"
However, if you want to run it a little more properly locally, I recommend creating the Docker Compose file described in the following documentation.
With this method, you can configure the admin account and various database settings in docker-compose.yml.
The other option is the npm-based method, which feels closer to a common CMS installation method. However, as the documentation says, Directus recommends operation with Docker, so it may be best to use this only in environments where Docker cannot be used.
> Docker is Recommended > > While this method works and is maintained, it is not recommended. Docker removes environment-specific quirks that can lead to Directus not running properly in some contexts. > > Running Directus without Docker may result in errors as a result of environment-specific characteristics. In such a case, make sure you have the required system dependencies for isolated-vm, sharp, and argon2 installed.
With that, enjoy your Directus life!