Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JuanSCaicedo/Api-Ecommerce/llms.txt
Use this file to discover all available pages before exploring further.
The .env file is the single source of truth for every runtime secret and configuration value in API Ecommerce. The repository ships an .env.example file that lists every required key with safe placeholder values. Before starting the application for the first time you must copy that template and fill in the real values:
cp .env.example .env
php artisan key:generate
Laravel will never load .env.example at runtime — only .env is read. Keep the two files in sync whenever you add a new variable.
Application settings
These five variables control the identity and operating mode of the Laravel application itself.
| Variable | Description | Example |
|---|
APP_NAME | Human-readable application name, used in emails and logs | Api-Ecommerce |
APP_ENV | Runtime environment; affects error handling and caching behaviour | production |
APP_KEY | 32-byte encryption key generated by php artisan key:generate | base64:... |
APP_DEBUG | Set to false in production to suppress stack traces in API responses | false |
APP_URL | Fully-qualified base URL of the API, used for link generation | https://api-ecommerce.juandevops.com |
Database
API Ecommerce uses MySQL as its primary data store. All six variables below are required for a successful database connection.
| Variable | Description | Example |
|---|
DB_CONNECTION | Laravel database driver | mysql |
DB_HOST | Hostname or IP address of the MySQL server | 127.0.0.1 |
DB_PORT | TCP port MySQL listens on | 3306 |
DB_DATABASE | Name of the database schema | api_ecommerce |
DB_USERNAME | MySQL user with full privileges on DB_DATABASE | ecommerce_user |
DB_PASSWORD | Password for DB_USERNAME | s3cr3t |
JWT authentication
API Ecommerce uses tymon/jwt-auth (v2.x) for stateless token authentication. The package signs tokens with an HMAC-SHA256 secret that lives exclusively in the environment.
Generate the secret with the dedicated Artisan command — do not invent or copy this value from another project:
The command writes the generated value directly into your .env file.
| Variable | Description | Default |
|---|
JWT_SECRET | HMAC secret used to sign and verify all JWT tokens. Generated by php artisan jwt:secret | (none — must be generated) |
JWT_TTL | Token lifetime in minutes. After this period the client must re-authenticate | 180 (3 hours) |
JWT_REFRESH_TTL | Window in minutes within which an expired token may be refreshed without re-authentication | 20160 (2 weeks) |
JWT_BLACKLIST_ENABLED | Enable token blacklisting on logout; requires a cache driver that supports key storage | true |
Cache and session
| Variable | Description | Example |
|---|
CACHE_DRIVER | Backend for Laravel’s cache layer. Use redis in production for JWT blacklisting | file |
SESSION_DRIVER | Storage driver for server-side sessions | file |
SESSION_LIFETIME | Session lifetime in minutes | 120 |
REDIS_HOST | Hostname of the Redis server | 127.0.0.1 |
REDIS_PASSWORD | Redis AUTH password; set to null if not configured | null |
REDIS_PORT | TCP port Redis listens on | 6379 |
Mail
API Ecommerce sends transactional emails for user registration verification, password reset, and order confirmation. All variables below map to Laravel’s config/mail.php configuration.
| Variable | Description | Example |
|---|
MAIL_MAILER | Transport driver (smtp, sendmail, mailgun, …) | smtp |
MAIL_HOST | SMTP server hostname | smtp.mailgun.org |
MAIL_PORT | SMTP port (587 for TLS, 465 for SSL, 25 for plain) | 587 |
MAIL_USERNAME | SMTP authentication username | postmaster@mg.example.com |
MAIL_PASSWORD | SMTP authentication password | key-xxxxxxxx |
MAIL_ENCRYPTION | Transport encryption (tls, ssl, or null) | tls |
MAIL_FROM_ADDRESS | Default sender address shown in all outgoing emails | noreply@ecommerce.com |
MAIL_FROM_NAME | Default sender display name | ${APP_NAME} |
OCI Object Storage
All user-uploaded files — product cover images, gallery images, user avatars, homepage sliders, and sale receipt comprobantes — are stored on Oracle Cloud Infrastructure (OCI) Object Storage. OCI exposes an Amazon S3-compatible API, which the application accesses through the oci Flysystem disk defined in config/filesystems.php.
Set FILESYSTEM_DISK=oci to activate the OCI disk as the default storage backend. The OCI_* credentials below are read by the oci disk configuration in config/filesystems.php.
| Variable | Description | Example |
|---|
FILESYSTEM_DISK | Active Flysystem disk; set to oci for production object storage | oci |
OCI_ACCESS_KEY_ID | OCI Customer Secret Key ID (created in the OCI Console under your user profile) | ocid1.credential... |
OCI_SECRET_ACCESS_KEY | Secret key paired with OCI_ACCESS_KEY_ID | xxxxxxxxxxxxxxxx |
OCI_DEFAULT_REGION | OCI region identifier where the bucket resides | sa-saopaulo-1 |
OCI_BUCKET | Name of the Object Storage bucket | ecommerce-assets |
OCI_ENDPOINT | S3-compatible endpoint URL for your OCI namespace | https://<namespace>.compat.objectstorage.<region>.oraclecloud.com |
OCI_URL | Base URL used for generating public object URLs | https://<namespace>.compat.objectstorage.<region>.oraclecloud.com |
MercadoPago
API Ecommerce integrates MercadoPago (mercadopago/dx-php v3.x) as the payment gateway for checkout. Two variables are required.
| Variable | Description | Example |
|---|
MERCADOPAGO_KEY | MercadoPago Access Token (from your MercadoPago developer dashboard) | APP_USR-xxxxx... |
URL_TIENDA | Base URL of the storefront, used to build the back_urls sent to MercadoPago so it can redirect the buyer after payment | https://tienda.example.com/ |
The back_urls are constructed as URL_TIENDA + "mercado-pago-success", URL_TIENDA + "mercado-pago-failure", and URL_TIENDA + "mercado-pago-pending".
Minimal working .env
The following snippet shows the minimum set of variables needed to boot the application in production. Replace every placeholder in < > with a real value.
APP_NAME="API Ecommerce"
APP_ENV=production
APP_KEY=base64:<run php artisan key:generate>
APP_DEBUG=false
APP_URL=https://api-ecommerce.juandevops.com
LOG_CHANNEL=stack
LOG_LEVEL=error
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=api_ecommerce
DB_USERNAME=ecommerce_user
DB_PASSWORD=<db_password>
CACHE_DRIVER=redis
SESSION_DRIVER=file
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
JWT_SECRET=<run php artisan jwt:secret>
JWT_TTL=180
MAIL_MAILER=smtp
MAIL_HOST=<smtp_host>
MAIL_PORT=587
MAIL_USERNAME=<smtp_user>
MAIL_PASSWORD=<smtp_password>
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@example.com
MAIL_FROM_NAME="${APP_NAME}"
FILESYSTEM_DISK=oci
OCI_ACCESS_KEY_ID=<oci_key_id>
OCI_SECRET_ACCESS_KEY=<oci_secret>
OCI_DEFAULT_REGION=sa-saopaulo-1
OCI_BUCKET=ecommerce-assets
OCI_ENDPOINT=https://<namespace>.compat.objectstorage.sa-saopaulo-1.oraclecloud.com
OCI_URL=https://<namespace>.compat.objectstorage.sa-saopaulo-1.oraclecloud.com
MERCADOPAGO_KEY=APP_USR-<access_token>
URL_TIENDA=https://tienda.example.com/
Never commit your .env file to version control. It contains database credentials, API keys, and signing secrets. Ensure .env is listed in .gitignore (it is by default in the Laravel skeleton). Use your CI/CD platform’s secret store — or a secrets manager like HashiCorp Vault — to inject environment variables at deploy time.
After changing any environment variable on a production server, run php artisan config:cache to rebuild the compiled configuration file. Laravel reads the cached config file rather than parsing .env on every request, so changes are not applied until the cache is cleared and rebuilt.