Deploying Directorio UDC involves two steps: building the React frontend into an optimised static bundle, then serving that bundle — together with the Express API — from a single Node.js process. This keeps the infrastructure simple: one server, one port, no separate static-file CDN required for a basic deployment.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Minogar28/DIRECTORIO_UDC/llms.txt
Use this file to discover all available pages before exploring further.
Build the Frontend
From theFRONTEND directory, run the build script:
tsc -b && vite build:
tsc -b— runs a full TypeScript type-check across the project. The build aborts with a non-zero exit code if there are any type errors, so type safety is enforced before a single byte reaches the server.vite build— bundles, tree-shakes, and minifies the application, outputting the result toFRONTEND/dist/.
FRONTEND/dist/ on a local port so you can confirm the production build works correctly before pushing to a server.
Serving the Static Bundle
The Express backend can serve theFRONTEND/dist/ directory using express.static, combining the API and the frontend into a single Node.js process. The example below shows how to structure your BACKEND/index.js entry point. The catch-all route at the bottom uses the Express 5 wildcard syntax (/{*path}) and ensures that client-side navigation always receives index.html rather than a 404:
Starting the Backend
The backend has nostart npm script. Start the server directly with Node.js:
Platform Deployment Options
Railway
Deploy Node.js apps with a simple
railway up command. Railway detects the Node.js runtime automatically, injects environment variables from its dashboard, and provisions a public URL with TLS included.Render
Free tier Node.js hosting with automatic deploys from GitHub. Connect your repository, set the build command to
cd FRONTEND && npm run build, and the start command to node BACKEND/index.js.Fly.io
Deploy containers globally with a generous free tier. Write a minimal
Dockerfile, run fly launch, and Fly distributes your app across multiple regions with automatic failover.VPS / Linux
Self-host on any Linux server with PM2 for process management. Full control over the environment, ideal for university infrastructure or on-premises requirements.
Process Management
In production, use PM2 to keep the Node.js process alive across crashes and server reboots:pm2 start— launches the process and registers it with PM2.pm2 save— persists the current process list to disk.pm2 startup— generates and prints an OS-specific command to register PM2 as a system service, so processes restart automatically after a reboot.
pm2 logs directorio-udc and pm2 monit.
Set the
cors() origin in production to your actual frontend domain rather than relying on the permissive open default. For example: app.use(cors({ origin: 'https://directorio.udc.edu' })). This prevents unintended cross-origin access to your API from third-party sites.