Local Dev Setup
This guide targets macOS platform contributors using Docker Desktop and Homebrew. To build a portal app or plugin, use the Dev Toolkit walkthrough instead. Platform setup requires repository access and does not configure a hosted customer project.
This guide walks through the setup of the GXP local development environment from a fresh clone to a fully running application. The stack uses Docker Compose to orchestrate a PHP 8.3 Laravel Octane/RoadRunner app server, Horizon queue workers, Reverb WebSocket server, a Node.js Vite dev server, Nginx with wildcard SSL for local .gxp.test domains, PostgreSQL 17, and Valkey (Redis-compatible) — with optional services for WebRTC (Mediasoup + Coturn), a documentation site and local AI-agent development. Database, Redis and Vite placement depend on the selected modes.
Quick Start
# Clone the repo
git clone git@github.com:GramercyTech/experience-portal.git
cd experience-portal
# Run the interactive setup
./setup.sh
The script guides prerequisite checks, module selection, SSL, nginx, DNS, Docker, dependencies and database initialization. Read each prompt when rerunning it: the database step offers migration, fresh installation or skipping, and fresh installation drops tables after confirmation. Some migration/seeding errors are reported as warnings, so reaching the final setup summary does not establish that the application or database is ready.
Prerequisites
| Tool | Required | Notes |
|---|---|---|
| Docker Desktop | Yes | Includes Docker Compose. Allocate 12 GB+ RAM (8 GB minimum), 2+ CPUs. |
| mkcert | Yes | brew install mkcert — local SSL certificate generation |
| Git | Yes | For submodules and hooks |
| Node.js | Only for host-mode Vite | See .nvmrc for version |
| dnsmasq | Recommended | brew install dnsmasq — wildcard DNS for *.gxp.test |
Homebrew must be available for the brew commands below. The interactive setup checks prerequisites and offers installation/configuration prompts. For host database/cache mode, its host-dependency steps cover PostgreSQL 17 and Valkey/Redis, service management and connection settings. Prefer Docker modes for the first setup if those host services are not already configured. Do not assume a running host service has the database/user expected by the application.
The setup certificate step installs the mkcert local CA and generates the wildcard certificate. Complete the trust prompt and verify the browser trusts it; installing the mkcert binary alone is insufficient.
Repository access: SSH key or HTTPS credentials configured for the GXP GitHub org.
What setup.sh Does
The interactive script walks you through each step:
- Prerequisites check — verifies Docker, Docker Compose, mkcert, and Git
- Module configuration — choose which optional services to enable (creates
modules.env) - Environment file — generates
.envfrom.env.example, setsCOMPOSE_PROFILES - Docker Compose — copies
docker-compose.yaml.exampletodocker-compose.yaml - SSL certificates — generates
*.gxp.testwildcard certs via mkcert - Nginx config — generates
nginx.local.conffrom templates, deploys site configs tosites-enabled/ - DNS — offers dnsmasq (recommended) or
/etc/hostssetup - Git submodule — initializes the
documentation/submodule - Git hooks — configures
core.hooksPathtogithooks/ - Google Cloud authentication — offers authentication used by optional cloud-backed integrations; follow the repository instructions for the environment you are authorized to use
- Build & start — offers Docker build/start, dependency installation and database migration/seeding choices
Module System
GXP uses a modular approach to local development. Optional services are controlled by modules.env:
VITE_MODE=docker # docker | host
DATABASE_MODE=docker # docker | host
REDIS_MODE=docker # docker | host | cluster
MODULE_WEBRTC=false # mediasoup + coturn
MODULE_DBTOOLS=false # expose Docker PostgreSQL for external tools
MODULE_DOCS=off # off | docker | host
MODULE_AGENTS=false # local planning/coding/orchestrator/file-gateway services
Run ./setup.sh --configure-only or bin/gxp configure to reconfigure modules. The script regenerates nginx configuration and updates Compose profiles and connection settings. Review its prompts and generated configuration before restarting services. Host modes require the corresponding local tools/services; PHP and Composer still run in containers.
What Each Module Controls
| Selection | Behavior |
|---|---|
| Core | App processes and nginx provide the platform/dashboard/API routes. |
VITE_MODE=docker | Enables the Vite container; host mode uses the host development server. |
DATABASE_MODE=docker | Enables PostgreSQL 17 with the Compose pgdata volume. Host mode uses local PostgreSQL. |
REDIS_MODE=docker | Enables the single Valkey service; cluster enables the Redis-cluster profile; host mode uses the host service. |
MODULE_WEBRTC=true | Enables Mediasoup/Coturn and associated media/turn nginx configuration. |
MODULE_DBTOOLS=true | Exposes the Docker database through a proxy, default localhost port 54320 (DB_EXTERNAL_PORT can change it). Setup offers this for Docker database mode. |
MODULE_DOCS=docker or host | Configures docs.gxp.test; start it separately with bin/gxp docs:start. Ordinary platform startup does not imply docs startup. |
MODULE_AGENTS=true | Enables local agent services for contributors working on planning/coding/orchestration integrations. External service configuration remains separate. |
The current setup menu does not offer a MODULE_TESTING/Selenium switch. Follow the repository's current test configuration for browser testing instead of adding an obsolete module flag.
The bin/gxp Helper CLI
All common operations are available through the helper CLI instead of raw docker compose exec commands:
Container Lifecycle
bin/gxp up # Start containers (+ host services if configured)
bin/gxp down # Stop containers (+ host services if configured)
bin/gxp restart [service] # Restart all or specific service
bin/gxp logs [service] # Tail logs (default: app)
bin/gxp status # Show running services + active worktree
When DATABASE_MODE, REDIS_MODE, or VITE_MODE is set to host in modules.env, up will automatically start those host services before launching containers, and down will stop them after containers are stopped. restart (with no arguments) cycles both containers and host services.
Development Commands
bin/gxp artisan migrate # Run artisan commands
bin/gxp artisan tinker # Open Tinker REPL
bin/gxp composer require foo # Run composer commands
bin/gxp npm install # Run npm commands
bin/gxp install # composer install + npm install
bin/gxp clean-install # Delete vendor + node_modules and reinstall from scratch
bin/gxp update # composer update + npm update
bin/gxp shell [service] # Interactive shell (default: app)
Use install to restore dependencies from the committed project configuration. update changes dependency resolution and may change lockfiles; it is not a routine repair equivalent to install. clean-install removes installed dependencies before reinstalling. Run PHP and Composer through the container helpers.
Database Management
bin/gxp db:backup my-save # Backup to backups/my-save-<timestamp>.sql
bin/gxp db:restore example-backup.sql # Restore from backup
bin/gxp db:list # List available backups
bin/gxp db:fresh # migrate:fresh --seed (with confirmation)
bin/gxp db:reset-admin # Reset admin email/password
bin/gxp db:unlock-admins # Unlock all locked admin accounts
The backup and restore helpers explicitly execute pg_dump/psql in the Compose database service. They are Docker-database helpers, not host-database backup automation. In host mode, use your configured PostgreSQL backup/restore procedure and verify its target separately. db:fresh runs Laravel through the app container against the application's configured database. db:restore asks for confirmation, drops and recreates the target database, then imports the SQL file. db:fresh also asks for confirmation and drops tables before cache/session cleanup and seeding. Back up valuable local data and check which checkout/stack you are targeting before accepting either prompt. These are recovery operations, not normal startup steps.
Cache & Rate Limits
bin/gxp flush:rate-limits # Clear all rate limiters (stored in Redis cache)
bin/gxp flush:all # Clear cache, sessions, rate limits, and unlock all admins
Host Services
Ordinary up/down act on host services selected by your modes. The explicit services:start/services:stop commands below temporarily force all three host modes and attempt to start/stop PostgreSQL, Redis and Vite, regardless of the selected modes. Check other local projects before using them:
bin/gxp services:start # Attempt all host services (Postgres, Valkey, Vite)
bin/gxp services:stop # Stop all host services
bin/gxp services:restart # Restart all host services
bin/gxp services:status # Show status of host services
Vite Dev Server (host mode)
bin/gxp vite:start # Start Vite dev server in background
bin/gxp vite:stop # Stop background Vite dev server
bin/gxp vite:restart # Restart Vite dev server
bin/gxp vite:logs # Tail Vite dev server logs
Documentation
bin/gxp docs:start # Start documentation site (Docker or host)
bin/gxp docs:stop # Stop documentation site
bin/gxp docs:restart # Restart documentation site
bin/gxp docs:logs # Tail documentation site logs
bin/gxp docs:update # Pull latest documentation submodule
Setup & Diagnostics
bin/gxp setup # Run the interactive setup script
bin/gxp configure # Re-run module configuration only
bin/gxp doctor # Diagnose issues, fix services, resolve port conflicts
bin/gxp uninstall # Remove all local GXP configuration and containers
bin/gxp help # List all commands
bin/gxp version # Show GXP version
doctor is interactive and can offer repairs, service startup and stopping a conflicting port owner. Read each prompt; it is not a read-only health report. Prefer status, targeted logs and port inspection when gathering evidence first.
uninstall is destructive: after confirmation it runs Compose cleanup with volumes, removes generated configuration and offers further image/certificate/backup cleanup. Keep needed backups outside the cleanup target. Use down for ordinary shutdown.
Worktree Switching
bin/gxp switch feature-xyz # Switch to .worktrees/feature-xyz
bin/gxp switch /path/to/tree # Switch to absolute path
bin/gxp switch . # Switch back to main project root
Vite: Docker vs Host Mode
Docker Mode (default)
Vite runs in a container. No local Node.js required. HMR works via nginx proxy (assets.gxp.test:443 -> vite:5173).
Host Mode
Vite runs on your host machine for faster HMR and rebuild times. Requires local Node.js.
# In modules.env, set:
VITE_MODE=host
# Re-run configuration:
./setup.sh --configure-only
# Start the configured stack and helper-managed host Vite:
bin/gxp up
bin/gxp vite:logs
Nginx proxies to host.docker.internal:5173. If you prefer foreground Vite, first stop the helper-managed instance with bin/gxp vite:stop, then run npm run dev from the checkout whose frontend you intend to serve. Use one instance on the configured port.
DNS Configuration
Option 1: dnsmasq (Recommended)
Wildcard support means any *.gxp.test subdomain resolves automatically — no editing files when adding new services.
brew install dnsmasq
# Add wildcard rule
echo "address=/.gxp.test/127.0.0.1" >> $(brew --prefix)/etc/dnsmasq.conf
# Restart and create resolver
sudo brew services restart dnsmasq
sudo mkdir -p /etc/resolver
echo "nameserver 127.0.0.1" | sudo tee /etc/resolver/gxp.test
Option 2: /etc/hosts
Manual entries for each domain:
127.0.0.1 gxp.test
127.0.0.1 dashboard.gxp.test
127.0.0.1 api.gxp.test
127.0.0.1 assets.gxp.test
127.0.0.1 webhook.gxp.test
127.0.0.1 demo.gxp.test
# If WebRTC enabled:
127.0.0.1 medias.gxp.test
127.0.0.1 turn.gxp.test
# If Docs enabled:
127.0.0.1 docs.gxp.test
Add the actual {SEED_PORTAL_SUBDOMAIN}.{TOP_DOMAIN} if it differs from demo.gxp.test, plus any other portal domains you create. Unlike wildcard DNS, hosts-file entries do not cover new subdomains automatically.
Git Worktrees
Worktrees let you work on multiple branches simultaneously without stashing. GXP supports this with a variable mount path in Docker.
Creating a Worktree
# Create a new local feature branch from the existing origin/main ref
git worktree add -b my-feature .worktrees/my-feature origin/main
# Switch Docker to use it
bin/gxp switch my-feature
If origin/my-feature already exists and you intend to continue it, use git worktree add .worktrees/my-feature origin/my-feature instead. Confirm the intended base ref before creating the checkout.
How It Works
- Docker containers always run from the main project root
GXP_PROJECT_PATHin.envcontrols which directory is mounted as/app- The configured database persists across switches; switching source checkouts does not create an isolated database.
bin/gxp switchstops containers, changes the mount path, recreates services, installs dependencies, clears caches and runs pending migrations. Those migrations affect the shared configured database; back up valuable local data and inspect the target branch first.
Switching Back
bin/gxp switch . # or
bin/gxp switch main
Running setup.sh from a Worktree
If you run ./setup.sh from inside a .worktrees/<name> directory, it detects the worktree and:
- Skips Docker build (uses the main project's images)
- Skips DNS/cert setup (already done)
- Switches Docker to point at the worktree
Database
In Docker database mode, PostgreSQL data is stored in the Compose pgdata volume and persists across container restarts and worktree switches. Its resolved Docker name depends on the Compose project; do not assume a fixed gxp-pgdata name. Host database mode stores data in the configured host PostgreSQL service.
Seeding
Seeding behavior can be configured via .env:
SEED_PORTAL_SUBDOMAIN=demo # Default portal subdomain
SEED_ADMIN_EMAIL=admin@example.com # Admin account email
SEED_ADMIN_PASSWORD=choose-a-local-password # Initial admin password
TOP_DOMAIN=gxp.test # Local domain suffix
PLUGIN_IMPORT_SEED_DISABLED=true # Skip cloud plugin import only
What Gets Seeded
The default seeder orchestrates teams, permissions/roles, plugins, projects and sample attendees. Its results depend on the existing database, available bundle templates, imported plugins and queue processing. It is not a verified readiness check:
| What | Details |
|---|---|
| Teams | Fills factory teams toward a count of ten, then ensures a separate "Gramercy Tech" team exists. Do not rely on a fixed final count. |
| Admin Account | Uses SEED_ADMIN_EMAIL / SEED_ADMIN_PASSWORD from .env. Super admin with admin + developer roles on the primary team. |
| Other Admins | Attempts to fill the total admin count toward ten and attaches existing admins to teams; this is not ten additional accounts. |
| Permissions & Roles | Permission definitions and the default dashboard roles from config/permissions.php per team |
| Primary Project | "Primary Project" on Gramercy Tech team with default dashboard and welcome tile |
| Portal | Local seeder creates "Primary Portal" for the primary project on Gramercy Tech, using {SEED_PORTAL_SUBDOMAIN}.{TOP_DOMAIN}. This local fixture does not change hosted project-plan portal provisioning. |
| HTML Page Plugin | Creates an initial html-page version when none exists and queues its bundled .gxpapp processing. A missing template or unfinished/failed processing can leave the page unusable. |
| Plugins | Cloud-imported plugins (if PLUGIN_IMPORT_SEED_DISABLED=false and GCS auth is configured), plus default theme, dashboard masks, and welcome tile |
| Attendees | Sample attendee types and attendees on the primary project |
After seeding, check queue/bundle status and then visit the configured portal domain (default https://demo.gxp.test) and https://dashboard.gxp.test. Verify actual page rendering and login. The primary admin is created with the configured password only when that email does not already exist; changing SEED_ADMIN_PASSWORD and rerunning the seeder does not reset an existing password. Use the supported local reset command when needed.
PLUGIN_IMPORT_SEED_DISABLED skips cloud plugin import, not every built-in plugin seeder. The current default seeder path does not read SEED_DEMO_DATA or SEED_SKIP_PLUGINS. Plugin-import exceptions can be reported while later seeders continue; review warnings and the resulting records.
Backup & Restore
# Before a risky operation
bin/gxp db:backup pre-migration
# If something goes wrong
bin/gxp db:restore pre-migration-20260408-143022.sql
# List all backups
bin/gxp db:list
Backups are stored in backups/ (gitignored). Restore accepts an existing full/relative file path or a bare filename found inside backups/. Confirm the file and target before accepting the destructive restore prompt.
Fresh Start
bin/gxp db:fresh # Drops all tables, re-migrates, re-seeds
Verification
After completing setup, verify the environment is fully operational.
Check All Containers Are Running
bin/gxp status
Check the services enabled by your module configuration; disabled optional services need not be running. A running container alone does not prove application readiness. If enabled services show issues, check logs:
bin/gxp logs app
Check Application Responds
curl -sS -o /dev/null -w "%{http_code}" https://dashboard.gxp.test
# Inspect the returned status and login/redirect target
This cookie-free request may return a login page or a redirect according to the configured routes. Inspect response headers with curl -I https://dashboard.gxp.test and confirm the destination in the browser.
These checks verify certificate trust as well as an HTTP response. If TLS verification fails, repair the local mkcert trust/certificate setup. Using -k can help isolate a routing issue, but bypasses TLS verification and is not evidence of a trusted browser connection. Inspect the actual login page rather than relying only on a status number.
Check Vite Dev Server
curl -sS -o /dev/null -w "%{http_code}" https://assets.gxp.test/@vite/client
# Expected: 200
Check Horizon (Queue Workers)
bin/gxp artisan horizon:status
# Expected: Horizon is running.
Check failed background work without retrying it automatically:
bin/gxp artisan queue:failed
bin/gxp logs app
For the seeded HTML page, inspect its plugin version/bundle processing status in the Developer Hub and verify the configured portal actually renders. Retain a failed-job identifier and processing error for diagnosis; rerunning seeding does not necessarily replace an existing plugin version.
Access in Browser
| URL | Purpose |
|---|---|
https://dashboard.gxp.test | Admin Dashboard |
https://api.gxp.test | API endpoint |
https://assets.gxp.test | Vite asset server |
http://localhost:6006 | Storybook (when vite container is running) |
Success Criteria
- All selected services are running and their application checks pass; disabled optional services need not run
https://dashboard.gxp.testloads the login page without SSL warningshttps://assets.gxp.testproxies to the Vite dev server successfully- Horizon is running (
bin/gxp artisan horizon:statusreports running) - Database has been seeded (login with the intended local credentials works)
- The configured portal renders the expected HTML page after bundle processing, with failed background work investigated
Troubleshooting
502 Bad Gateway on first start
A first build can take time to become ready, but a 502 is not proof of normal warmup. Check bin/gxp status and bin/gxp logs app for missing dependencies, process failures or database connectivity. Retry after the service reports readiness; avoid repeatedly resetting the database to resolve a proxy error.
nginx won't start
Usually means an upstream can't be resolved. Make sure your modules match your enabled services:
bin/gxp configure # Regenerate nginx config
bin/gxp restart nginx
Port conflicts
# Check what's using ports 80/443
lsof -nP -iTCP:80 -sTCP:LISTEN
lsof -nP -iTCP:443 -sTCP:LISTEN
Identify the owning process and project before stopping anything. Stop only the conflicting service through its own manager, or configure nonconflicting exposed ports and matching local URLs. A Docker/OrbStack proxy may be the expected port owner.
Vite manifest not found
bin/gxp npm install
# Or in host mode:
npm install && npm run build
Container won't start — need shell access
docker compose run --rm --entrypoint /bin/bash app
Node memory issues
NODE_OPTIONS="--max-old-space-size=4096" npm run build