Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Emmanuel-Mtz-777/TechStore-Explorer/llms.txt

Use this file to discover all available pages before exploring further.

TechStore Explorer is designed to run on Railway with a three-service architecture that separates the web process, database, and queue worker. This separation keeps HTTP responses fast by offloading async work — such as sending wishlist email notifications — to a dedicated background process, ensuring the web service is never blocked by mail delivery.

Why Railway

Because a direct GitLab–Railway integration was not available for this project, a GitHub mirror repository was created to keep the source code in sync with the original GitLab repository. Railway’s GitHub integration picks up every push to the mirror automatically, triggering a new deployment without any manual intervention.

Architecture Overview

The Railway project is composed of three services, each with a single, well-defined responsibility:
ServiceRoleStart Command
WebRuns the Laravel application and handles all incoming HTTP requestsphp artisan serve
MySQLRailway-managed relational database; connection details are injected as environment variables(managed by Railway)
WorkerContinuously processes queued jobs — including wishlist email dispatchphp artisan queue:work

Environment Variables

All variables below must be set in the Railway dashboard for each applicable service. The Web and Worker services share the same set; the MySQL service exposes its own connection variables automatically.
VariableValue / Notes
APP_KEYGenerate with php artisan key:generate --show
APP_ENVproduction
APP_DEBUGfalse
APP_URLRailway-assigned public URL (set after first deploy)
DB_CONNECTIONmysql
DB_HOSTProvided by Railway MySQL service
DB_PORTProvided by Railway MySQL service (default 3306)
DB_DATABASEProvided by Railway MySQL service
DB_USERNAMEProvided by Railway MySQL service
DB_PASSWORDProvided by Railway MySQL service
MAIL_MAILERsmtp
MAIL_HOSTsandbox.smtp.mailtrap.io
MAIL_PORT2525
MAIL_USERNAMEYour Mailtrap SMTP username
MAIL_PASSWORDYour Mailtrap SMTP password
MAIL_ENCRYPTIONtls
MAIL_FROM_ADDRESSno-reply@example.com
MAIL_FROM_NAME${APP_NAME}
QUEUE_CONNECTIONdatabase

Deployment Steps

1

Fork or mirror the repository to GitHub

Because Railway integrates with GitHub rather than GitLab, create a GitHub mirror of the TechStore Explorer repository. The mirror must track the main branch so that Railway can detect new commits and redeploy automatically.
2

Create a new Railway project with three services

In the Railway dashboard, create a new project and add the following services:
  • PHP Web — the main Laravel application
  • MySQL — a Railway-managed MySQL database
  • Worker — a second PHP service that will run the queue worker
Railway provisions the MySQL service immediately and exposes connection variables you can reference in the other two services.
3

Connect the GitHub repository

For both the Web and Worker services, select Deploy from GitHub repo and choose the mirrored TechStore Explorer repository. Set the target branch to main so both services track the same source.
4

Configure environment variables in the Railway dashboard

Open the Variables tab for the Web service and add every variable from the table above. Railway makes MySQL connection variables available as references (e.g. ${{MySQL.MYSQL_HOST}}), so you can link them directly rather than copy-pasting.Repeat the same variable configuration for the Worker service — it needs identical access to the database and mail credentials.
APP_KEY=base64:your_generated_key_here
APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-app.up.railway.app

DB_CONNECTION=mysql
DB_HOST=${{MySQL.MYSQL_HOST}}
DB_PORT=${{MySQL.MYSQL_PORT}}
DB_DATABASE=${{MySQL.MYSQL_DATABASE}}
DB_USERNAME=${{MySQL.MYSQL_USER}}
DB_PASSWORD=${{MySQL.MYSQL_PASSWORD}}

MAIL_MAILER=smtp
MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your_mailtrap_username
MAIL_PASSWORD=your_mailtrap_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no-reply@example.com
MAIL_FROM_NAME="${APP_NAME}"

QUEUE_CONNECTION=database
5

Override the Worker service start command

In the Worker service settings, navigate to Deploy → Start Command and set it to:
php artisan queue:work
This overrides the default web-server start command so the Worker container runs the queue processor instead of serving HTTP traffic.
6

Run database migrations and seeders

Once the MySQL service is ready, open a Railway shell on the Web service (or use a one-off command) and run:
php artisan migrate --seed
This creates all required tables — including the jobs table used by the queue — and populates the database with initial product and user data.
7

Confirm the deployment and note your public URL

After a successful deploy, Railway assigns a public URL to the Web service (e.g. https://your-app.up.railway.app). Copy this URL, set it as APP_URL in the Web service variables, and redeploy if needed. The application will be accessible at that address immediately.
The Worker service must remain running at all times. If it is stopped or crashes, wishlist email notifications will accumulate in the jobs database table but will never be delivered until the worker is restarted.
Railway automatically redeploys both the Web and Worker services whenever a new commit is pushed to the main branch of the connected GitHub repository. No manual intervention is required after the initial setup.

Build docs developers (and LLMs) love