Skip to main content

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.
VariableDescriptionExample
APP_NAMEHuman-readable application name, used in emails and logsApi-Ecommerce
APP_ENVRuntime environment; affects error handling and caching behaviourproduction
APP_KEY32-byte encryption key generated by php artisan key:generatebase64:...
APP_DEBUGSet to false in production to suppress stack traces in API responsesfalse
APP_URLFully-qualified base URL of the API, used for link generationhttps://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.
VariableDescriptionExample
DB_CONNECTIONLaravel database drivermysql
DB_HOSTHostname or IP address of the MySQL server127.0.0.1
DB_PORTTCP port MySQL listens on3306
DB_DATABASEName of the database schemaapi_ecommerce
DB_USERNAMEMySQL user with full privileges on DB_DATABASEecommerce_user
DB_PASSWORDPassword for DB_USERNAMEs3cr3t

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:
php artisan jwt:secret
The command writes the generated value directly into your .env file.
VariableDescriptionDefault
JWT_SECRETHMAC secret used to sign and verify all JWT tokens. Generated by php artisan jwt:secret(none — must be generated)
JWT_TTLToken lifetime in minutes. After this period the client must re-authenticate180 (3 hours)
JWT_REFRESH_TTLWindow in minutes within which an expired token may be refreshed without re-authentication20160 (2 weeks)
JWT_BLACKLIST_ENABLEDEnable token blacklisting on logout; requires a cache driver that supports key storagetrue

Cache and session

VariableDescriptionExample
CACHE_DRIVERBackend for Laravel’s cache layer. Use redis in production for JWT blacklistingfile
SESSION_DRIVERStorage driver for server-side sessionsfile
SESSION_LIFETIMESession lifetime in minutes120
REDIS_HOSTHostname of the Redis server127.0.0.1
REDIS_PASSWORDRedis AUTH password; set to null if not configurednull
REDIS_PORTTCP port Redis listens on6379

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.
VariableDescriptionExample
MAIL_MAILERTransport driver (smtp, sendmail, mailgun, …)smtp
MAIL_HOSTSMTP server hostnamesmtp.mailgun.org
MAIL_PORTSMTP port (587 for TLS, 465 for SSL, 25 for plain)587
MAIL_USERNAMESMTP authentication usernamepostmaster@mg.example.com
MAIL_PASSWORDSMTP authentication passwordkey-xxxxxxxx
MAIL_ENCRYPTIONTransport encryption (tls, ssl, or null)tls
MAIL_FROM_ADDRESSDefault sender address shown in all outgoing emailsnoreply@ecommerce.com
MAIL_FROM_NAMEDefault 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.
VariableDescriptionExample
FILESYSTEM_DISKActive Flysystem disk; set to oci for production object storageoci
OCI_ACCESS_KEY_IDOCI Customer Secret Key ID (created in the OCI Console under your user profile)ocid1.credential...
OCI_SECRET_ACCESS_KEYSecret key paired with OCI_ACCESS_KEY_IDxxxxxxxxxxxxxxxx
OCI_DEFAULT_REGIONOCI region identifier where the bucket residessa-saopaulo-1
OCI_BUCKETName of the Object Storage bucketecommerce-assets
OCI_ENDPOINTS3-compatible endpoint URL for your OCI namespacehttps://<namespace>.compat.objectstorage.<region>.oraclecloud.com
OCI_URLBase URL used for generating public object URLshttps://<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.
VariableDescriptionExample
MERCADOPAGO_KEYMercadoPago Access Token (from your MercadoPago developer dashboard)APP_USR-xxxxx...
URL_TIENDABase URL of the storefront, used to build the back_urls sent to MercadoPago so it can redirect the buyer after paymenthttps://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.

Build docs developers (and LLMs) love