Development

This guide covers the development workflow, available commands, project structure, and deployment process for Omega Social Media, including the Expo mobile app.

Development Commands

Server & Assets

# Start Vite with hot module replacement
npm run dev

Locally, the project's guidelines assume Laravel Herd (served at <kebab-case-project-dir>.test); any PHP server pointing at public/ also works.

Database & Admin

php artisan migrate

Queue, WebSockets & Scheduler

# Process queues (requires QUEUE_CONNECTION=redis)
php artisan horizon

Maintenance Commands

php artisan story:clear

Testing & Code Quality

./vendor/bin/pest

Backend tests live in tests/Unit and tests/Feature (the PHPUnit suites), with mobile API tests in tests/Feature/Api/Mobile and browser tests (Laravel Dusk) in tests/Browser. The test environment uses a MySQL database named omega_social_media, array cache and sessions, and a sync queue.

Mobile App Commands

Run from the mobile/ directory:

npm start

Mobile tests use Jest with the jest-expo preset and Testing Library for React Native. They are organized under mobile/__tests__/ into api, components, hooks, providers, screens, store, and utils.

Project Structure

Application Core

  • app/Models/ — Eloquent models for users, posts, stories, chats, media, marketplace, jobs, ads, live streams, credits, payments, and withdrawals.
  • app/Enums/ — Domain enums (Ad, Chat, LiveStream, Payment, Wallet, and more).
  • app/Actions/ — Single-purpose actions such as deleting posts, comments, chats, stories, and users.
  • app/Services/ — Business logic: Payment, Credits, Donations, Agora, Discover, Geolocation, Translation, and others.
  • app/Policies/, app/Rules/, app/Validation/ — Authorization and validation.

HTTP & UI

  • app/Http/Controllers/ — Admin, Api, Business, Downloads, User.
  • app/Http/Resources/ — API resources for the mobile API.
  • app/Livewire/ — Business and user Livewire components.
  • resources/js/spa/apps/desktop and mobile — The two Vue SPAs.
  • resources/js/admin, business, document, mpa — Entry points for admin, business, document, and multi-page scripts.

Routing

  • routes/web.php, social.php, business.php, document.php, downloads.php — Web routes.
  • routes/admin/ — Admin panel routes.
  • routes/api.php, routes/api/mobile.php — Web SPA API and mobile API.
  • routes/channels.php — Broadcast channel authorization.
  • routes/webhooks/ — Payment webhooks.

Background & Events

  • app/Jobs/ — Media conversion, story video, view counting, and withdrawal jobs.
  • app/Events/ and app/Listeners/ — Broadcast events (live stream, chat, timeline) and listeners such as StripeEventListener.
  • app/Console/Commands/ — Admin, chat, demo, mail, story, and system commands.

Mobile App

mobile/

  • app/ — Expo Router screens.
  • src/api, store, providers, services, hooks, components, i18n, theme, types, utils.
  • app.json, eas.json — Expo and EAS configuration.
  • DEPLOY_GUIDE.md — App Store and Google Play submission guide.

Configuration

  • config/ — Includes payment.php, credits.php, agora.php, mobile.php, reverb.php, horizon.php, social-login.php, ffmpeg.php, demo.php, and standard Laravel files.
  • .env.example — Documented environment template.

Tooling & CI

  • tests/ — Pest tests (Unit, Feature) and Dusk browser tests.
  • .github/workflows/ — lint.yml (Pint, Prettier, ESLint) and tests.yml (Pest and Dusk against MySQL 8.0 with FFmpeg).
  • phpstan.neon, pint.json — Static analysis and code style.
  • Envoy.blade.php — Zero-downtime deployment script.

Deployment

Backend (Laravel Envoy)

Deployment is a zero-downtime, release-directory flow run with Envoy:

php vendor/bin/envoy run deploy

Required variables in .env: DEPLOY_USER, DEPLOY_HOST, DEPLOY_REPOSITORY, DEPLOY_RELEASE_DIR, and DEPLOY_APP_DIR; DEPLOY_BRANCH defaults to main.

What the Envoy Script Does

  1. clone-repository — Clones the repository into a new timestamped release directory and resets it to the commit of the successful CI run.
  2. update-symlinks — Links the shared storage directory and .env into the release and sets permissions.
  3. run-composer — Runs composer install, php artisan migrate --force, clears caches, publishes log-viewer assets, caches config, routes, views, and events, and runs php artisan reverb:restart.
  4. run-node — Installs npm dependencies and runs npm run build.
  5. switch-release — Points the current symlink at the new release, runs php artisan storage:link, runs php artisan horizon:terminate so Horizon restarts on the new code, and reloads PHP-FPM.
  6. clean-old-releases — Removes old releases.

Post-Deployment Configuration

  1. Process Manager — Keep php artisan horizon and php artisan reverb:start running under a process manager, and run the scheduler every minute (php artisan schedule:run).
  2. Stripe — Configure the webhook signing secret in STRIPE_WEBHOOK_SECRET and enable Stripe Connect with STRIPE_CONNECT_ENABLED=true if you pay out creators.
  3. Environment — Set APP_ENV=production, APP_DEBUG=false, and QUEUE_CONNECTION=redis.
  4. Web Server — Point the document root at public/; the app trusts proxies (trustProxies('*')).
  5. Mobile Deep Links — Set the MOBILE_* variables and MOBILE_REDIRECT_ENABLED=true to prompt mobile visitors to open the native app.
  6. Monitoring — Use Sentry, the Horizon dashboard, Spatie Health, and the /up route.

Mobile App (EAS)

  1. Install the EAS CLI (npm install -g eas-cli) and run eas login.
  2. Build with eas build --profile production --platform all. The production profile sets EXPO_PUBLIC_API_URL in eas.json and auto-increments build numbers; version numbers are managed remotely (appVersionSource: remote).
  3. Submit with eas submit --profile production. The Android submit profile uploads to the production track as a draft.
  4. App identifiers are com.omega.social on both iOS and Android, with the omega-social URL scheme. Runtime version is exposdk:54.0.0 and OTA updates use expo-updates.
  5. Camera, microphone, and photo library permission strings are declared in app.json for live streaming and media sharing. Production APIs must use HTTPS.

See mobile/DEPLOY_GUIDE.md in the repository for the full store submission walkthrough, including Apple in-app purchase notes and common rejection reasons.

Was this page helpful?