A Laravel application for shortening links with user workspaces, custom domains, statistics, an API, and an AdminLTE-based admin panel.
Author: Alexander Yanitsky Email: janickiy@icloud.com
- PHP 8.4
- Laravel 13
- Apache 2
- MySQL 8.4
- Node.js 22 / Vite
- Docker Compose
To run the project locally with Docker, you need:
- Docker
- Docker Compose v2
- available ports
8090and3308
Default ports:
- application:
http://localhost:8090 - MySQL on the host:
127.0.0.1:3308 - MySQL inside the Docker network:
mysql:3306
Main environment files:
docker-compose.yml-appandmysqlservicesdocker/php/Dockerfile- PHP 8.4 + Apache + PHP extensions + Node.jsdocker/php/entrypoint.sh- initial container setupdocker/apache/vhost.conf- Apache VirtualHost withpublicas the document rootdocker/php/php.ini- PHP settingsdocker/mysql/my.cnf- MySQL charset/collation settings.env.docker- Docker environment template
- Copy the Docker environment file if
.envdoes not exist yet:
cp .env.docker .envIf .env is missing, the container entrypoint will also try to create it from .env.docker automatically.
- Build and start the containers:
docker compose up -d --build- Install dependencies and prepare the application.
On the first run, docker/php/entrypoint.sh automatically:
- installs Composer dependencies if
vendordoes not exist - generates
APP_KEYif it is empty - creates the storage symlink
- installs npm dependencies if
node_modulesdoes not exist - builds frontend assets if
public/build/manifest.jsondoes not exist
If you need to run the commands manually:
docker compose exec app composer install
docker compose exec app php artisan key:generate
docker compose exec app php artisan storage:link
docker compose exec app npm install
docker compose exec app npm run build- Run migrations:
docker compose exec app php artisan migrate- Open the application:
http://localhost:8090
Docker database settings in .env:
APP_URL=http://localhost:8090
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=allweb_urlshort
DB_USERNAME=allweb
DB_PASSWORD=secretMySQL values from docker-compose.yml:
MYSQL_DATABASE=allweb_urlshort
MYSQL_USER=allweb
MYSQL_PASSWORD=secret
MYSQL_ROOT_PASSWORD=rootsecretTo connect to MySQL from the host, use:
host: 127.0.0.1
port: 3308
database: allweb_urlshort
user: allweb
password: secret
Start the containers:
docker compose up -dStop the containers:
docker compose downStop the containers and remove the MySQL data volume:
docker compose down -vView container status:
docker compose psView application logs:
docker compose logs -f appView MySQL logs:
docker compose logs -f mysqlOpen a shell in the app container:
docker compose exec app bashRun an Artisan command:
docker compose exec app php artisan <command>Clear the Laravel cache:
docker compose exec app php artisan optimize:clearBuild frontend assets:
docker compose exec app npm run buildRun the Vite dev server inside the container:
docker compose exec app npm run dev -- --host 0.0.0.0Run migrations:
docker compose exec app php artisan migrateRecreate the database with migrations:
docker compose exec app php artisan migrate:freshIf seeders have been added to the project:
docker compose exec app php artisan db:seedOr run everything together:
docker compose exec app php artisan migrate:fresh --seedRun tests:
docker compose exec app php artisan testComposer script:
docker compose exec app composer testTo run the project without Docker, you need:
- PHP 8.4 with the
bcmath,exif,gd,intl,opcache,pdo_mysql, andzipextensions - Composer 2
- Node.js 22+
- MySQL 8.4+
- Apache or another web server with
publicas the document root
Basic commands:
cp .env.example .env
composer install
php artisan key:generate
npm install
npm run build
php artisan migrate
php artisan serveIf the application does not open:
docker compose ps
docker compose logs appIf MySQL is not ready yet:
docker compose logs mysqlIf .env, routes, config, or views have changed:
docker compose exec app php artisan optimize:clearIf the frontend asset build is broken:
docker compose exec app npm install
docker compose exec app npm run buildIf you need to fully recreate the environment with a clean database:
docker compose down -v
docker compose up -d --build
docker compose exec app php artisan migrate- Do not commit real secrets in
.env. - Use
.env.dockerfor the local Docker environment. - For production, make sure to disable
APP_DEBUG, configure the realAPP_URL, SMTP, Stripe credentials, and secure database passwords. storageandbootstrap/cachemust be writable by the web user.