Starting up your Development Environment
Spin uses Docker Compose to start up your development environment in a single command. This allows you to exactly replicate your production environment for local development.
Prerequisites
- ✅ Docker must be installed and running
- ✅ Spin must be installed
Configure local, trusted SSL for development
If you want your development URLs to have a trusted SSL certificate, you'll need to install the Server Side Up Certificate Authority on your machine.
This certificate authority is only used for development URLs like *.dev.test
. In production, we use Let's Encrypt from Traefik to generate our certificates. No configuration is necessary to trust a Let's Encrypt certificate.
You can also use your own certificates if you prefer. We use cfssl to generate our certificates, but as long as the certificates are valid and trusted by your machine, you can use them.
Learn how to install and trust the Server Side Up Certificate Authority →
Configure your hosts file
In order to access your development URLs, you will need to create a "hosts" entry to point back to your local machine for each development URL.
When you're developing locally, you'll be able to use domain names like laravel.dev.test
instead of localhost
. This is important because it allows you to mimic a real-world environment where each project has its own domain name. This is especially important if you're working on multiple projects at the same time.
We have an open discussion on GitHub to automate this functionality, but for now this is the best and easiest solution. We also have instructions to customize your development URLs if you want to use a different domain name.
Learn how to configure your hosts file →
Bring up your development environment
Once we have these one-time steps completed, we can now bring up your development environment.
Make sure to run this command from your project directory.
Bring up your development environment
spin up
To stop your development environment, press Ctrl+C
.
Since Spin is running Docker Compose, you can also pass any argument to the up
command. For example, spin up -d
will start your development environment in detached mode. See the full documentation for spin up for more information.
Bringing up Node services
By default, our project is configured to use yarn
. If you want to utilize hot module reloading with Vite, run the following command in a new terminal.
Start Vite
spin run node yarn dev
Accessing your development URLs
When the services are up and running, you can access the following URLs:
- Web Server: https://laravel.dev.test
- Mailpit: https://mailpit.dev.test
- Vite: https://vite.dev.test
- Reverb: wss://reverb.dev.test
Connecting to your database
If you want to connect a database client to your database, you can follow our guide on connecting to your database.
Learn how to connect to your database →
Running commands in development
You can run commands in your development environment using the spin run
or the spin exec
command. We created a guide to help you understand the difference between the two.