Skip to main content
Before deploying NutriFit to production, ensure all items in this checklist are completed. This systematic approach helps prevent common deployment issues and ensures optimal performance.

Environment Configuration

Critical Settings

1

Set Production Environment

Update your .env file:
APP_ENV=production
APP_DEBUG=false
Never enable APP_DEBUG=true in production. It exposes sensitive application details and stack traces.
2

Generate Application Key

Ensure your application key is set:
php artisan key:generate
This key is used for encrypting sessions, cookies, and other sensitive data.
3

Set Application URL

Configure your production domain:
APP_URL=https://yourdomain.com

Database Configuration

Switch from SQLite to MySQL for production:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=nutrifit
DB_USERNAME=nutrifit_user
DB_PASSWORD=your_secure_password
Use a strong, unique password for database access
Execute database migrations:
php artisan migrate --force
The --force flag is required in production environments.
Create the admin user and initial data:
php artisan db:seed

Mail Server Configuration

SMTP Settings

Configure your production mail server:
MAIL_MAILER=smtp
MAIL_HOST=smtp.yourdomain.com
MAIL_PORT=587
MAIL_USERNAME=[email protected]
MAIL_PASSWORD=your_mail_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME="NutriFit"

Test Email Delivery

Verify email notifications are working:
php artisan tinker
# Then run:
Mail::raw('Test', function($msg) {
    $msg->to('[email protected]')->subject('Test');
});
Replace Mailtrap credentials with a real SMTP server. Mailtrap only works in development.

Performance Optimization

Caching Strategy

1

Compile Assets

Build optimized frontend assets:
npm run build
2

Optimize Composer Autoloader

Generate optimized autoload files:
composer install --optimize-autoloader --no-dev
The --no-dev flag excludes development dependencies.
3

Cache Configuration

Cache all configuration files:
php artisan config:cache
4

Cache Routes

Cache route definitions:
php artisan route:cache
Don’t use route caching if you use closure-based routes.
5

Cache Views

Pre-compile Blade templates:
php artisan view:cache

Database Caching

Configure cache to use database for better performance:
CACHE_STORE=database
SESSION_DRIVER=database
For even better performance, consider Redis:
CACHE_STORE=redis
SESSION_DRIVER=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

Security Hardening

Ensure your application is served over HTTPS:
  1. Obtain an SSL certificate (Let’s Encrypt recommended)
  2. Configure your web server to redirect HTTP to HTTPS
  3. Update APP_URL to use https://
Verify SSL is working: https://www.ssllabs.com/ssltest/
Protect your .env file:
chmod 600 .env
Ensure .env is in .gitignore and never committed to version control.
Set correct permissions:
chmod -R 755 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
Configure security headers in your web server:
  • X-Frame-Options: SAMEORIGIN
  • X-Content-Type-Options: nosniff
  • X-XSS-Protection: 1; mode=block
  • Strict-Transport-Security: max-age=31536000

Queue Workers

Queue workers are critical for NutriFit. Email notifications won’t be sent without them.
Configure queue connection:
QUEUE_CONNECTION=database
For better performance, use Redis:
QUEUE_CONNECTION=redis
See Queue Workers for complete setup instructions.

Scheduled Tasks

NutriFit sends appointment reminders 24 hours in advance. Configure the Laravel scheduler:
crontab -e
Add this entry:
* * * * * cd /path/to/nutrifit && php artisan schedule:run >> /dev/null 2>&1

Backup Strategy

1

Database Backups

Set up automated daily database backups:
# Example backup script
mysqldump -u nutrifit_user -p nutrifit > backup-$(date +%F).sql
Store backups securely off-server.
2

File Backups

Back up uploaded files and storage:
tar -czf storage-backup-$(date +%F).tar.gz storage/
3

Environment Backup

Keep a secure backup of your .env file in a password manager or secure vault.

Final Verification

Before going live, verify:
  • APP_ENV=production is set
  • APP_DEBUG=false is set
  • Database is MySQL (not SQLite)
  • SMTP server is configured
  • Assets are compiled (npm run build)
  • Composer is optimized (--no-dev)
  • All caches are generated
  • Queue worker is running
  • Cron job is configured
  • SSL certificate is installed
  • Backups are configured
  • Admin account is created
  • Test email notifications work
  • Test appointment booking works
  • Test PDF generation works

Rollback Plan

Before deployment, prepare a rollback strategy:
  1. Keep previous version files accessible
  2. Have database backup ready to restore
  3. Document rollback commands
  4. Test rollback procedure in staging
# Example rollback commands
git checkout previous-stable-tag
composer install --no-dev
npm run build
php artisan migrate:rollback
php artisan cache:clear
Consider using a staging environment to test deployment procedures before production.

Next Steps

Environment Setup

Detailed production environment configuration

Deployment Platforms

Choose and configure your hosting platform

Queue Workers

Set up background job processing

Monitoring

Monitor your production application

Build docs developers (and LLMs) love