Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/astrxnomo/tourify/llms.txt

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

The Tourify backend is a Laravel 13 REST API that serves JSON over HTTP and handles authentication via Laravel Sanctum bearer tokens. This page walks you through cloning the repository, configuring your .env file, running database migrations, and starting the local development server so the mobile app can connect to it.
The backend requires PHP 8.3 or higher. You can verify your version by running php --version. You will also need Composer, MySQL, and (optionally) Node.js if you want to use the concurrent dev script.

Setup steps

1

Clone the repository

Clone the Tourify monorepo and navigate to the backend directory.
git clone https://github.com/astrxnomo/tourify.git
cd tourify/backend
2

Install PHP dependencies

Use Composer to install all required packages, including Laravel Framework 13, Laravel Sanctum, and the development toolchain.
composer install
3

Configure environment variables

Copy the example environment file and edit it to match your local setup.
cp .env.example .env
Open .env in your editor and update the values highlighted below. The most important ones are the database credentials and APP_URL.
# Application
APP_NAME=Laravel
APP_ENV=local
APP_KEY=                        # Generated in the next step
APP_DEBUG=true
APP_URL=http://localhost:8000   # Must match the port used by `php artisan serve`

# Database — point these at your local MySQL instance
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=tourify
DB_USERNAME=root
DB_PASSWORD=

# File storage
FILESYSTEM_DISK=local

# Mail — uses the "log" driver by default (no real emails sent locally)
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
Make sure the tourify database exists in MySQL before continuing:
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS tourify;"
4

Generate the application key

Laravel requires a unique encryption key. Generate one with Artisan — it will be written directly into your .env file.
php artisan key:generate
5

Run migrations and seeders

Create all database tables and populate them with sample cities, categories, places, and events.
php artisan migrate --seed
6

Create the storage symlink

Expose the storage/app/public directory through the web server so uploaded images are publicly accessible.
php artisan storage:link
7

Start the development server

Launch the built-in PHP development server on port 8000.
php artisan serve
The API will now be available at http://localhost:8000/api.
Instead of running php artisan serve on its own, you can use the composer run dev script to start all services concurrently — the HTTP server, queue worker, Pail log viewer, and Vite asset pipeline — in a single terminal with colour-coded output:
composer run dev

Verify the API is running

Once the server is up, confirm it is responding correctly by fetching the list of cities:
curl -s http://localhost:8000/api/cities | head -c 500
You should receive a JSON response containing an array of city objects. A successful response looks like:
[
  {
    "id": 1,
    "name": "Barcelona",
    "description": "...",
    "country": "..."
  }
]
If you receive a 500 error, double-check your database credentials in .env and ensure the tourify database exists and migrations have been run.

Environment variables reference

The table below documents every variable that requires attention during local setup. All others default to sensible values for development.
APP_URL
string
required
The full base URL of the backend server, including the port. Must match the address used when starting php artisan serve. The frontend reads this URL to build API requests.Example: http://localhost:8000
DB_CONNECTION
string
required
The database driver. Tourify is built for MySQL — keep this value as mysql.
DB_HOST
string
required
Hostname of the MySQL server. For a local installation this is typically 127.0.0.1.
DB_PORT
string
required
Port MySQL is listening on. The default MySQL port is 3306.
DB_DATABASE
string
required
Name of the MySQL database. Create this database before running migrations. Defaults to tourify.
DB_USERNAME
string
required
MySQL user that has full privileges on DB_DATABASE. Defaults to root.
DB_PASSWORD
string
Password for DB_USERNAME. Leave blank if your local MySQL root account has no password.
FILESYSTEM_DISK
string
Where uploaded files are stored. Defaults to local, which stores files in storage/app. Set to public to serve files via the storage symlink, or to s3 for AWS S3 storage.

Build docs developers (and LLMs) love