Environment Variables
ServITech Backend API uses environment variables to configure application behavior. This guide provides a comprehensive reference for all available variables.All environment variables are defined in the
.env file in the application root. Never commit this file to version control.Application Configuration
APP_NAME
Type: StringDefault:
ServITechDescription: The name of your application. Used in notifications, emails, and UI elements.
APP_VERSION
Type: StringDefault:
1.0.0Description: Current version of the application. Used for tracking and display purposes.
APP_ENV
Type: StringDefault:
productionOptions:
local, development, staging, productionDescription: Defines the application environment.
APP_KEY
Type: String (Base64)Required: Yes
Description: Encryption key used for securing session data, cookies, and encrypted values.
APP_DEBUG
Type: BooleanDefault:
falseDescription: Enables detailed error messages and stack traces.
APP_URL
Type: URLDefault:
http://localhost:8000Description: The base URL of your application. Used for generating links, emails, and API responses.
Always use HTTPS in production environments for security.
Localization
APP_LOCALE
Type: StringDefault:
esDescription: Default application language.
APP_FALLBACK_LOCALE
Type: StringDefault:
enDescription: Fallback language when translations are missing in the primary locale.
APP_FAKER_LOCALE
Type: StringDefault:
es_ESDescription: Locale for Faker library when generating test data.
Maintenance Mode
APP_MAINTENANCE_DRIVER
Type: StringDefault:
fileOptions:
file, cacheDescription: Storage driver for maintenance mode state.
APP_MAINTENANCE_STORE
Type: StringDefault:
databaseDescription: Cache store to use when driver is set to
cache.
APP_PREVIOUS_KEYS
Type: Comma-separated stringsDescription: Previous application keys for key rotation.
Server Configuration
PHP_CLI_SERVER_WORKERS
Type: IntegerDefault:
4Description: Number of worker processes for PHP’s built-in development server.
This setting only affects the development server (
php artisan serve). Production servers should use PHP-FPM or similar.Security
BCRYPT_ROUNDS
Type: IntegerDefault:
12Range:
4 - 31Description: Cost factor for bcrypt password hashing. Higher values increase security but require more CPU.
Increasing rounds above 12 may impact login performance. Benchmark before changing in production.
Logging
LOG_CHANNEL
Type: StringDefault:
stackOptions:
stack, single, daily, slack, syslog, errorlogDescription: Primary logging channel.
LOG_STACK
Type: StringDefault:
singleDescription: Channel to use within the stack logging channel.
LOG_DEPRECATIONS_CHANNEL
Type: StringDefault:
nullDescription: Separate channel for PHP and Laravel deprecation warnings.
LOG_LEVEL
Type: StringDefault:
debugOptions:
debug, info, notice, warning, error, critical, alert, emergencyDescription: Minimum log level to record.
Database Configuration
DB_CONNECTION
Type: StringDefault:
sqliteOptions:
sqlite, mysql, mariadb, pgsql, sqlsrvDescription: Database driver to use.
MySQL/MariaDB Configuration
For production deployments, use MySQL or MariaDB:DB_HOST
Type: StringDefault:
127.0.0.1Description: Database server hostname or IP address.
DB_PORT
Type: IntegerDefault:
3306Description: Database server port.
DB_DATABASE
Type: StringDefault:
laravelDescription: Database name.
DB_USERNAME
Type: StringDefault:
rootDescription: Database user.
DB_PASSWORD
Type: StringDescription: Database password.
Complete MySQL Example
Session Configuration
SESSION_DRIVER
Type: StringDefault:
databaseOptions:
file, cookie, database, memcached, redis, arrayDescription: Session storage driver.
For API-only applications using JWT, session driver has minimal impact. Database or Redis recommended for multi-server setups.
SESSION_LIFETIME
Type: Integer (minutes)Default:
120Description: Session lifetime in minutes.
SESSION_ENCRYPT
Type: BooleanDefault:
falseDescription: Encrypt session data.
SESSION_PATH
Type: StringDefault:
/Description: Session cookie path.
SESSION_DOMAIN
Type: StringDefault:
nullDescription: Session cookie domain.
Cache Configuration
CACHE_STORE
Type: StringDefault:
databaseOptions:
file, database, redis, memcached, dynamodb, arrayDescription: Cache driver.
CACHE_PREFIX
Type: StringDescription: Prefix for cache keys (optional).
Queue Configuration
QUEUE_CONNECTION
Type: StringDefault:
databaseOptions:
sync, database, redis, sqs, beanstalkdDescription: Queue driver for background jobs.
ServITech uses
database queue driver. Ensure queue workers are running in production.Filesystem Configuration
FILESYSTEM_DISK
Type: StringDefault:
localOptions:
local, public, s3, ftp, sftpDescription: Default filesystem disk.
Broadcast Configuration
BROADCAST_CONNECTION
Type: StringDefault:
logOptions:
log, pusher, ably, redisDescription: Broadcasting driver for real-time events.
Redis Configuration
REDIS_CLIENT
Type: StringDefault:
phpredisOptions:
phpredis, predisDescription: Redis client library.
REDIS_HOST
Type: StringDefault:
127.0.0.1Description: Redis server hostname.
REDIS_PASSWORD
Type: StringDefault:
nullDescription: Redis authentication password.
REDIS_PORT
Type: IntegerDefault:
6379Description: Redis server port.
Memcached Configuration
MEMCACHED_HOST
Type: StringDefault:
127.0.0.1Description: Memcached server hostname.
Mail Configuration
MAIL_MAILER
Type: StringDefault:
logOptions:
smtp, sendmail, mailgun, ses, postmark, logDescription: Mail driver.
MAIL_SCHEME
Type: StringDefault:
nullOptions:
null, tls, sslDescription: Mail transport encryption scheme.
MAIL_HOST
Type: StringDefault:
127.0.0.1Description: SMTP server hostname.
MAIL_PORT
Type: IntegerDefault:
2525Description: SMTP server port.
MAIL_USERNAME
Type: StringDescription: SMTP authentication username.
MAIL_PASSWORD
Type: StringDescription: SMTP authentication password.
MAIL_FROM_ADDRESS
Type: EmailDefault:
[email protected]Description: Default sender email address.
MAIL_FROM_NAME
Type: StringDefault:
${APP_NAME}Description: Default sender name.
Complete SMTP Example (Gmail)
JWT Authentication
ServITech uses JWT (JSON Web Tokens) for API authentication.JWT_SECRET
Type: String (Base64)Required: Yes
Description: Secret key for signing JWT tokens.
JWT_TTL
Type: Integer (minutes)Default:
60Description: JWT token time-to-live.
JWT_REFRESH_TTL
Type: Integer (minutes)Default:
20160 (2 weeks)Description: Refresh token time-to-live.
JWT_ALGO
Type: StringDefault:
HS256Options:
HS256, HS384, HS512, RS256, RS384, RS512Description: JWT signing algorithm.
JWT_BLACKLIST_ENABLED
Type: BooleanDefault:
trueDescription: Enable token blacklisting for logout.
JWT_BLACKLIST_GRACE_PERIOD
Type: Integer (seconds)Default:
0Description: Grace period for concurrent requests with same token.
API Documentation (Scramble)
SCRAMBLE_API_ROUTE
Type: String (URL path)Default:
/docs/apiDescription: Route path for accessing API documentation.
AWS Configuration
For AWS services (S3, SES, etc.):AWS_ACCESS_KEY_ID
Type: StringDescription: AWS access key ID.
AWS_SECRET_ACCESS_KEY
Type: StringDescription: AWS secret access key.
AWS_DEFAULT_REGION
Type: StringDefault:
us-east-1Description: Default AWS region.
AWS_BUCKET
Type: StringDescription: S3 bucket name for file storage.
AWS_USE_PATH_STYLE_ENDPOINT
Type: BooleanDefault:
falseDescription: Use path-style S3 endpoints (for S3-compatible services).
Vite Configuration
VITE_APP_NAME
Type: StringDefault:
${APP_NAME}Description: Application name exposed to Vite for frontend builds.
Production Environment Template
Complete production.env template:
Security Best Practices
-
Never commit
.envto version control- Ensure
.envis in.gitignore - Use
.env.exampleas a template
- Ensure
-
Use strong, random passwords
- Database passwords: 16+ characters
- JWT secrets: Generated by Laravel
- Use a password manager
-
Restrict file permissions
-
Set production values
APP_ENV=productionAPP_DEBUG=falseLOG_LEVEL=error
-
Use HTTPS in production
- Set
APP_URLwithhttps:// - Configure SSL certificates
- Set
-
Rotate secrets regularly
- Update
JWT_SECRETperiodically - Rotate database credentials
- Use key rotation for
APP_KEY
- Update
-
Limit database user privileges
-
Use environment-specific configurations
- Separate
.envfiles for staging and production - Never copy production
.envto development
- Separate
Environment Variable Management
Using Laravel Forge
Using Envoyer
Using Docker
Using Secret Management Services
For enterprise deployments:- AWS Secrets Manager
- HashiCorp Vault
- Azure Key Vault
- Google Cloud Secret Manager
Validation Script
Create a script to validate environment configuration:Next Steps
Deployment Overview
Learn about deployment strategies
Production Build
Build your application for production