A centralized Single Sign-On (SSO) application built with Laravel for the Paradise Supply Chain ecosystem.
This project provides a secure authentication gateway that enables users to access multiple Paradise Supply Chain services using a single account. It centralizes authentication, session management, and authorization while delivering a consistent login experience across integrated applications.
- Single Sign-On (SSO)
- Secure User Authentication
- Session Management
- Role-Based Authorization
- Protected Routes
- REST API Integration
- CSRF Protection
- Form Validation
- Responsive User Interface
- Error Handling
- Laravel
- PHP
- Blade
- Tailwind CSS
- Vite
- JavaScript
- MySQL
- Composer
- npm
Local (without Docker):
- PHP 8.4 or later
- Composer
- Node.js 18 or later
- npm
- MySQL / MariaDB
Docker / Dokploy:
- Docker Engine 24+ with Compose V2
- For production: a Dokploy-managed Linux server with
/opt/ssoavailable on the host
git clone https://github.com/iranpsc/SSO-Paradise-Supply-Chain.gitcd SSO-Paradise-Supply-ChainInstall PHP dependencies:
composer installInstall frontend dependencies:
npm installCopy the environment file:
cp .env.example .envGenerate the application key:
php artisan key:generateUpdate your database configuration inside the .env file.
php artisan migratephp artisan passport:keysRun Laravel:
php artisan serveRun Vite:
npm run devThe application will be available at:
http://127.0.0.1:8000
The Compose stack runs Apache (no nginx), MySQL 8.4, Redis, a queue worker, the scheduler, and Mailpit. Vite assets are compiled in the image build.
Persistent data is bind-mounted to /opt/sso on the host so it survives Dokploy redeploys that wipe named volumes and container filesystems:
| Host path | Purpose |
|---|---|
/opt/sso/storage |
Laravel storage: uploads, media, Passport keys, logs |
/opt/sso/mysql |
MySQL data directory |
/opt/sso/redis |
Redis AOF persistence |
Override the root with SSO_DATA_DIR if you cannot use /opt/sso (for example on a local machine).
Create the host directories (Linux / WSL / Docker Linux engine):
sudo mkdir -p /opt/sso/storage /opt/sso/mysql /opt/sso/redis
sudo chown -R 33:33 /opt/sso/storage33 is www-data inside the app image. MySQL will take ownership of /opt/sso/mysql on first start.
Copy .env.example to .env and set APP_KEY (php artisan key:generate on any machine with the project, then paste the value). Compose overrides DB_HOST, Redis, cache, session, and queue so the containers talk to each other.
Start the stack:
docker compose up -d --buildNo service publishes a port on the host. App 80, MySQL 3306, Redis 6379, and Mailpit 1025/8025 are exposed only to other containers on the Docker network. Laravel's health endpoint is /up inside the app container. Attach a domain in Dokploy to reach the app from outside.
On each docker compose up, the migrate service runs php artisan migrate --force and exits before app, queue, and scheduler start. The app entrypoint runs migrations again whenever that container starts.
Useful commands:
docker compose ps
docker compose logs -f app
docker compose exec app php artisan migrate --force
docker compose downdocker compose down does not delete /opt/sso. Do not put database dumps or uploads only inside the image or named volumes.
Dokploy rebuilds containers on every deploy. Bind mounts under /opt/sso keep MySQL, Redis, OAuth keys, and uploaded files.
SSH into the Dokploy host before the first deploy:
sudo mkdir -p /opt/sso/storage /opt/sso/mysql /opt/sso/redis
sudo chown -R 33:33 /opt/sso/storage
sudo chmod 755 /opt/ssoLeave /opt/sso/mysql and /opt/sso/redis for the database images to initialize. Do not delete /opt/sso when redeploying.
In Dokploy:
- Create a Compose application (not a single Dockerfile-only service).
- Connect this Git repository and set the compose file to
docker-compose.yml. - Set the build context to the repository root.
Set these in the Dokploy environment UI (they are injected at runtime; do not bake secrets into the image). Generate APP_KEY once and keep it forever.
APP_NAME="SSO Paradise Supply Chain"
APP_ENV=production
APP_DEBUG=false
APP_URL=https://sso.example.com
APP_KEY=base64:...your-generated-key...
DOCKER_DB_DATABASE=sso
DOCKER_DB_USERNAME=sso
DOCKER_DB_PASSWORD=change-me
DB_ROOT_PASSWORD=change-me-root
MAIL_MAILER=smtp
MAIL_HOST=your-smtp-host
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@example.com
MAIL_FROM_NAME="${APP_NAME}"Optional: SSO_DATA_DIR=/opt/sso (this is already the Compose default).
On production, point MAIL_* at a real SMTP server. Mailpit in Compose is for local capture only.
- Attach your domain to the
appservice. - Forward Traefik / Dokploy to container port
80(Apache). Do not put nginx in front of the app; Dokploy already terminates TLS. - MySQL (
3306), Redis (6379), and Mailpit are not published on the host. Other containers reach them by service name on the Docker network.
Deploy from Dokploy. The one-shot migrate service runs migrations after MySQL is healthy, then exits. The app entrypoint runs them again on every app container start, creates Passport keys if they are missing, and links public/storage. An exited migrate container is expected.
Check:
https://sso.example.com/upreturns Application up- Login page loads
- After a second deploy, existing users, media, and OAuth keys are still present under
/opt/sso
If /up fails, inspect app, mysql, and redis logs in Dokploy. A missing or changing APP_KEY will invalidate sessions and encrypted data.
Example configuration:
APP_NAME="SSO Paradise Supply Chain"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=app/
bootstrap/
config/
database/
public/
resources/
├── css/
├── js/
└── views/
routes/
storage/
tests/
vendor/
User
│
▼
Login Page
│
▼
Authentication Service
│
▼
Session / Access Token
│
▼
Protected Applications
Start the development server:
php artisan serveRun database migrations:
php artisan migrateClear all caches:
php artisan optimize:clearRun tests:
php artisan testStart the Vite development server:
npm run devBuild production assets:
npm run buildDuring development, run both services simultaneously:
Backend:
php artisan serveFrontend:
npm run devLaravel handles the backend application while Vite compiles frontend assets and provides Hot Module Replacement (HMR).
This project follows Laravel's built-in security best practices, including:
- CSRF Protection
- Input Validation
- Authentication Middleware
- Authorization
- Secure Session Handling
- Encrypted Configuration
- XSS Protection
Contributions are welcome.
-
Fork the repository.
-
Create a feature branch.
git checkout -b feature/your-feature- Commit your changes.
git commit -m "Add your feature"- Push the branch.
git push origin feature/your-feature- Open a Pull Request.
This project is proprietary software developed for the Paradise Supply Chain ecosystem. Unauthorized distribution, modification, or commercial use is prohibited unless explicitly permitted by the project owner.