Skip to content

Deployment

Joël Deffner edited this page Jul 17, 2026 · 1 revision

Deployment

Production runs on a university Apache server at https://team11.wi1cm.uni-trier.de/public/. There is no separate deployment pipeline: the SPA build is committed to the repository and served alongside the CodeIgniter API from the same origin.

Build

cd frontend && pnpm build
  • Runs tsc -b, then Vite compiles the SPA into public/ (outDir: '../public', emptyOutDir: false so CodeIgniter's index.php and .htaccess survive).
  • The Vite base is /public/ for builds, matching the production URL path. In dev it is /.
  • Built assets are committed. A frontend source change only reaches the served app after pnpm build (and a commit/push).

Request routing (public/.htaccess)

public/ is both CodeIgniter's document root and the SPA's output directory. Apache dispatches:

Request Result
api/*, media/* rewritten to CodeIgniter's index.php (the JSON API)
an existing file (hashed JS/CSS bundles, images, favicons) served directly
any other path (/meets/3, /admin/dashboard, ...) falls through to index.html; React Router resolves it client-side

CodeIgniter stays a pure JSON API; it renders no HTML pages.

Why the /public/ base matters

Because the app lives under the /public/ path (not at the domain root):

  • React Router runs with basename derived from import.meta.env.BASE_URL (see frontend/src/App.tsx).
  • The API wrapper prefixes every request path with the base (/public/api/...). Without the prefix, the root .htaccess answers with a redirect that turns a POST into a GET, producing confusing 404s (documented in frontend/src/lib/api.ts).

Server-side configuration

  • .env (copied from the env template, not committed) holds the environment: database.default.* credentials for MariaDB db_team11, and any base-URL overrides.
  • Sessions are file-based via Shield; writable/ must be writable by the web server (logs, cache, session files).
  • Database setup on a fresh server: php spark migrate --all, then the seeders as needed (see Database).

Deployment checklist

  1. cd frontend && pnpm build (confirm tsc passes).
  2. Commit the changed source and the regenerated public/ assets.
  3. Push / pull on the server.
  4. If migrations were added: php spark migrate --all on the server.
  5. Smoke-test: load /public/, log in, hit a deep link like /public/meets, and call GET /api/ping.

Clone this wiki locally