System Requirements
For Docker Setup (Recommended)
- Docker Engine 20.10 or higher
- Docker Compose 2.0 or higher
- Git for version control
- Minimum Resources:
- 4 GB RAM
- 10 GB disk space
- 2 CPU cores
For Manual Setup
Backend Requirements
- PHP 8.2 or higher
- Composer 2.x
- PostgreSQL 15 or higher
- PHP Extensions:
- OpenSSL
- PDO
- Mbstring
- Tokenizer
- XML
- Ctype
- JSON
- BCMath
- pgsql
Frontend Requirements
- Node.js 18.x or higher
- npm 9.x or higher
Docker Compose Setup (Recommended)
Docker Compose provides a one-command setup that includes all services with proper networking and configuration.Configure environment variables (optional)
The stack works with default values, but you can customize them:Key environment variables:
Build and start services
- Build the development container image
- Start PostgreSQL, nginx, PgAdmin, and MailHog
- Install all Composer dependencies (API)
- Install all NPM dependencies (API + webapp)
- Generate Laravel application key
- Wait for PostgreSQL to be ready
- Run database migrations
- Execute seeders for initial data
- Generate Laravel Passport OAuth keys (600 permissions)
- Create storage symlinks
- Generate Swagger API documentation
- Start Apache web server
- Start Vite dev server with HMR
The initialization script is located at
docker/app/config/dev/init.sh and runs automatically on container startup.Docker Services Overview
Thedocker-compose.yml defines the following services:
dev (Main Application Container)
dev (Main Application Container)
- Image:
sushigo/dev:local - Ports: 5173 (Vite), 80/443 (Apache)
- Contains: PHP 8.2, Apache, Node.js, Composer
- Auto-runs: Migrations, seeders, Supervisor
- Health check:
/api/v1/healthendpoint
nginx (Reverse Proxy)
nginx (Reverse Proxy)
- Image:
nginx:alpine - Ports: 80, 443
- Purpose: Routes requests to
sushigo.localandapi.sushigo.local - SSL: Self-signed certificates in
docker/app/config/dev/cert/
pgsql (PostgreSQL Database)
pgsql (PostgreSQL Database)
- Image:
postgres:15 - Port: 5432
- Volume: Persistent storage in
pg_datavolume - Databases:
mydb(dev),mydb_test(testing)
pgadmin (Database Admin UI)
pgadmin (Database Admin UI)
- Image:
dpage/pgadmin4:7.6 - Port: 5050
- Credentials: [email protected] / admin
- Pre-configured: Server connection to
pgsqlcontainer
mailhog (Email Testing)
mailhog (Email Testing)
- Image:
mailhog/mailhog - Port: 8025 (web UI), 1025 (SMTP)
- Purpose: Capture all outgoing emails for testing
Access URLs
Once the Docker stack is running:| Service | URL | Notes |
|---|---|---|
| Webapp (nginx) | https://sushigo.local | Proxied through nginx with SSL |
| Webapp (direct) | http://localhost:5173 | Direct Vite dev server with HMR |
| API | https://api.sushigo.local/api/v1 | REST API endpoints |
| Swagger UI | http://localhost:8080/api/documentation | Interactive API docs |
| PgAdmin | http://localhost:5050 | Database admin ([email protected] / admin) |
| MailHog | http://localhost:8025 | Email testing interface |
To access
sushigo.local and api.sushigo.local, add these entries to your /etc/hosts file:Manual Setup
For environments where Docker is not available, you can run the Laravel API and React webapp manually.Backend Setup (Laravel API)
Generate Passport keys
Laravel Passport requires RSA keys for OAuth2 token encryption:This creates:
storage/oauth-private.key(600 permissions)storage/oauth-public.key(600 permissions)
Seed initial data
- Default roles and permissions (Spatie)
- Super admin account
- Test users
- Sample inventory data (optional)
Frontend Setup (React Webapp)
Configure API endpoint
The webapp connects to the API via the base URL configured in
src/lib/api-client.ts.If your API runs on a different URL, update the environment variable:Database Configuration
Environment Variables
Key database-related variables incode/api/.env:
Migrations
SushiGo uses Laravel migrations for database schema management:Seeders
SushiGo uses a tracked seeder system to prevent duplicate data:config/seeders.php with support for:
- LockedSeeder: Critical seeders that run once
- OnceSeeder: Initial data seeders
- RepeatableSeeder: Can be re-run safely
OAuth2 / Passport Configuration
SushiGo uses Laravel Passport for OAuth2 authentication.Generate Keys
Passport requires RSA key pairs:storage/oauth-private.key- Private key for signing tokensstorage/oauth-public.key- Public key for verifying tokens
Test OAuth Flow
src/stores/auth.store.ts).
Default User Accounts
After running seeders, these accounts are available:| Role | Password | Permissions | |
|---|---|---|---|
| Super Admin | [email protected] | admin123456 | All permissions |
| Admin | [email protected] | admin123456 | Admin permissions |
| Inventory Manager | [email protected] | inventory123456 | Inventory operations |
Troubleshooting
Composer install fails
Composer install fails
Symptoms: Dependency conflicts or memory errors during
composer installSolutions:Database connection refused
Database connection refused
Symptoms:
SQLSTATE[08006] Connection refused or could not connect to serverSolutions:-
Verify PostgreSQL is running:
-
Check credentials in
.envmatch database -
Verify
DB_HOSTis correct:- Docker:
pgsql(service name) - Manual:
localhostor127.0.0.1
- Docker:
- Check firewall allows port 5432
Passport keys permission denied
Passport keys permission denied
Symptoms:
file_get_contents(storage/oauth-public.key): failed to open streamSolutions:Storage permission errors
Storage permission errors
Symptoms: Laravel cannot write to
storage/ or bootstrap/cache/Solutions:Vite dev server HMR not working
Vite dev server HMR not working
Symptoms: Changes to React components don’t hot-reloadSolutions:
- Check
VITE_HMR_HOSTindocker-compose.ymlmatches your domain - Ensure WebSocket connections aren’t blocked by firewall
- Try accessing via direct port: http://localhost:5173
- Check Vite config in
code/webapp/vite.config.ts
CORS errors in browser console
CORS errors in browser console
Symptoms:
Access-Control-Allow-Origin errors when webapp calls APISolutions:- Verify
config/cors.phpallows your webapp origin - Check
.envhas correctAPP_URLandAPI_URL - Ensure middleware
\Illuminate\Http\Middleware\HandleCors::classis inbootstrap/app.php - Clear config cache:
php artisan config:clear
Test database not found
Test database not found
Symptoms: Tests fail with The test database is automatically created by the init script in Docker:
database "mydb_test" does not existSolutions:docker/pgsql/init-test-db.shPort conflicts
Port conflicts
Symptoms:
bind: address already in use when starting DockerSolutions:Production Considerations
When deploying to production:Environment
- Set
APP_ENV=production - Set
APP_DEBUG=false - Use strong
APP_KEY - Configure proper
APP_URL
Database
- Use managed PostgreSQL
- Regular automated backups
- Connection pooling (PgBouncer)
- SSL/TLS connections
Security
- Change all default passwords
- Use HTTPS with valid certificates
- Configure firewall rules
- Regular security updates
- Review CORS settings
Performance
- Enable OPcache for PHP
- Use Redis for cache/sessions
- Enable Laravel optimization:
php artisan config:cachephp artisan route:cachephp artisan view:cache
- Build React app:
npm run build
Useful Commands Reference
Next Steps
Development Guide
Learn about the tech stack, conventions, and workflows
Architecture
Understand the domain model and system design
API Reference
Explore REST endpoints and test with Swagger
Testing
Write and run backend and E2E tests