Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/geeky-hamster/Quizmaster/llms.txt

Use this file to discover all available pages before exploring further.

Quizmaster is a standard Node.js + React application that can be deployed to any environment that supports Node.js. This guide covers building both applications for production, configuring the required environment variables, serving the frontend build, and using the included nixpacks configuration for one-click Railway deployments.

Set production environment variables

Before building or running either application, configure the environment variables for your production host.
Never use a weak or default value for JWT_SECRET in production. Generate a long, random string (at least 32 characters) and keep it secret. Rotating this value invalidates all existing sessions.
Set the following variables in your hosting environment or in a .env file that is not committed to version control:
.env
DB_HOST=your-production-mysql-host
DB_PORT=3306
DB_NAME=quizmaster
DB_USER=your-db-user
DB_PASSWORD=your-db-password
JWT_SECRET=a-long-random-secret-string
PORT=5000

Build and run

1

Build the backend

Compile the TypeScript source to JavaScript:
cd backend
npm run build
This runs tsc and outputs compiled files to the dist/ directory.
2

Run the compiled backend

Start the backend using the compiled output:
node dist/server.js
The API will listen on the port defined by the PORT environment variable (default: 5000).
3

Build the frontend

In a separate step, build the React frontend for production:
cd frontend
npm run build
This runs react-scripts build and outputs optimized static files to the build/ directory.
4

Point the frontend at your production API

Before building (or as a host environment variable), set REACT_APP_API_URL to your production backend URL:
REACT_APP_API_URL=https://your-api-domain.com/api npm run build
If this variable is not set, the frontend defaults to http://localhost:5000/api.
5

Serve the frontend build folder

Serve the contents of frontend/build/ using any static file server or CDN.
npx serve -s frontend/build

Deploy to Railway with nixpacks

The backend includes a nixpacks.toml configuration file, which means Railway can detect and build the backend automatically without any additional configuration. To deploy to Railway:
  1. Push your repository to GitHub.
  2. Create a new Railway project and connect your repository.
  3. Set the environment variables listed above in the Railway dashboard under Variables.
  4. Railway will use nixpacks.toml to build and start the backend automatically.
For the frontend, deploy the frontend/build/ output to Railway’s static hosting, Vercel, Netlify, or any CDN. Set REACT_APP_API_URL to your Railway backend URL before building.

Build docs developers (and LLMs) love