Backend Settings (Laravel)
Navigate to the root directory. Copy and paste the
.env.example file and rename it to
cp .env.example .env
Now open the
.env file and fill in the values as needed. You might notice that the file is very similar to the default
.env file that ships with Laravel, but it’s not 100% the same. Some values are already set or changed (e.g.,
SESSION_DRIVER) and some new ones are added. These configurations are necessary in order to hook the backend up to the frontend.
If you run your frontend on the default URL and Port (
http://localhost:3000), you only need to replace the XXXXXXXXXXXXXXXX values. If you do not want to use the Next.js default URL and Port, you also need to adjust the
SANCTUM_STATEFUL_DOMAINS variable. Please only provide ONE value here. This means NO comma separated URLs.
E-Mail env variables are required
The Starter Kit uses some email functionality (registration, password reset). If you do not want these features, you must make some small tweaks. However, if you do want to take advantage of these features you MUST configure you email settings correctly. The app will break otherwise. Luckily, Laravel makes this extremely easy. More on that later on.
If you worked with Laravel before you are probably familiar with
artisan. In order to prepopulate our database with all the necessary tables, you must execute the following command:
php artisan migrate --seed
--seed flag is optional but useful, since it creates some users and an admin for you (more on that later).
Once this is done, we can move to the frontend environment settings