- 1. Clone the Repository
- 2. Gitleaks Setup (Secret Scanning)
- 3. Environment Configuration
- 4. Switching Between DDEV and Native
- 5. Email Viewing
- 6. Tips - General Guidelines
- 7. Where to Go From Here
- 8. Troubleshooting
git clone git@github.com:scify/laradev-react.git
cd laradev-reactThe pre-commit hook scans staged files for secrets (API keys, passwords, tokens) before each commit. It requires a ./gitleaks binary in the project root. The binary is gitignored, so each developer must install it once.
Download the binary for your platform:
# Linux (x64)
curl -sSL https://github.com/gitleaks/gitleaks/releases/download/v8.28.0/gitleaks_8.28.0_linux_x64.tar.gz | tar -xz gitleaks
# macOS (Apple Silicon)
curl -sSL https://github.com/gitleaks/gitleaks/releases/download/v8.28.0/gitleaks_8.28.0_darwin_arm64.tar.gz | tar -xz gitleaks
# macOS (Intel)
curl -sSL https://github.com/gitleaks/gitleaks/releases/download/v8.28.0/gitleaks_8.28.0_darwin_x64.tar.gz | tar -xz gitleaksMake it executable and verify:
chmod +x gitleaks
./gitleaks versionThe hook runs automatically on every git commit. If it finds a potential secret, the commit is blocked with a clear error message. For false positives, see docs/GITLEAKS-SECURITY.md.
Laradev-React uses different environment configurations based on whether you are running with DDEV or Native.
The application automatically loads the appropriate environment variables, based on the APP_DEVELOPMENT_ENV
environment variable.
The default .env file contains the general configuration, and is used by both DDEV and Native.
Copy the .env.example file to create a new .env file, and edit as needed:
cp .env.example .env
# then edit the APP_DEVELOPMENT_ENV variable to either 'ddev' or 'native'
APP_DEVELOPMENT_ENV=native # or 'ddev'If you are using DDEV, you need a .env.ddev file with the following:
APP_URL = "https://laradev-react.ddev.site:8443"
DB_HOST = "db"
DB_DATABASE = "db"
DB_USERNAME = "db"
DB_PASSWORD = "db"
VITE_DEV_URL = "https://laradev-react.ddev.site"
VITE_APP_PORT = "8443"
VITE_DEV_PORT = "5179"You can copy the .env.ddev.example file to create a new .env.ddev file:
cp .env.ddev.example .env.ddevFirst you will need to set up a local database (MySQL, SQLite, etc) and create a new database for the application. Then, you can create a .env.native file with the appropriate database credentials.
If you are using a Native environment (Composer, PHP, SQL etc running locally), create a .env.native file with the following:
APP_URL = http://localhost:8000
DB_HOST = 127.0.0.1
DB_DATABASE = "my_app"
DB_USERNAME = "admin" # Change to your database username
DB_PASSWORD = "pass" # Change to your database password
VITE_DEV_URL = "http://localhost"
VITE_APP_PORT = "8000"
VITE_DEV_PORT = "5173"You can copy the .env.native.example file to create a new .env.native file:
cp .env.native.example .env.nativeIf you want to switch between DDEV and Native for development, you can set the APP_DEVELOPMENT_ENV
environment variable to either ddev or native.
Note: After switching environments, you will need to clear the config cache (both DDEV and Native):
ddev restart # If using DDEV
./clear-cache.shFirst generate an application key:
ddev artisan key:generateTo start the development environment using DDEV:
ddev startRun migrations:
ddev artisan migrateRun the database seeder:
ddev artisan db:seedStart the frontend development server:
ddev npm run devFirst generate an application key:
php artisan key:generateTo switch back to using Native for local development:
composer installRun migrations:
php artisan migrateRun the database seeder:
php artisan db:seedStart the development server:
composer run devWhen using DDEV, you can view emails sent by the application using Mailpit. Read more here.
When using Native, you can view emails sent by the application using one of the methods described here.
Run composer outdated --direct to check for outdated Composer dependencies, and update them as needed.
Use tools like ncu to check for outdated NPM dependencies.
- Take a look at
app/Providers/AppServiceProvider.phpto check the configuration.
- Ensure the correct environment file is loaded using
env('DB_HOST')in Tinker.- For DDEV, run
ddev exec php artisan tinker, and then runenv('DB_HOST'). - For Native, run
php artisan tinker, and then runenv('DB_HOST').
- For DDEV, run
- If the frontend fails to load, ensure the correct environment variables are set.
- For DDEV, ensure the
VITE_DEV_URLandVITE_APP_PORTare set correctly. - For Native, ensure the
VITE_DEV_URLandVITE_APP_PORTare set correctly.
- For DDEV, ensure the
- If Vite fails due to port conflicts, restart it using
pkill -f node. - Run
ddev restartif database issues persist.
Enjoy developing! 🚀