Files

2.1 KiB

Projekt-KIQ HP

React + Vite single-page application for Projekt-KIQ, with an Express backend for auth and access request management.

Local Development

Copy the .env.example file to create your local environment configuration:

cp .env.example .env.local

Fill in the backend credentials (ADMIN_USER, ADMIN_PASSWORD, SESSION_SECRET).

Running locally

npm install

# Start the Express backend (port 3003)
npm run start:server

# In another terminal, start the Vite dev server
npm run dev

The frontend dev server proxies API requests to http://localhost:3003 (configured via VITE_API_URL in .env.local).

Architecture

  • Frontend: React + Vite SPA (static build)
  • Backend: Express.js (session-based auth, JSON file storage for access requests, Nodemailer for email alerts)
  • Auth: Cookie-based sessions (kiq_session), single admin user configured via env vars
  • Access Requests: Stored in server/data/access-requests.json, email alerts sent via SMTP

Production Build

npm run build

Deployment

This repository deploys to projekt-kiq.d-hive.de via GitHub Actions.

  • The built frontend is deployed to /opt/projekt-kiq/site
  • The Express backend runs as a systemd service (projekt-kiq.service) on port 3003
  • Caddy reverse-proxies /api/* to the backend and serves the SPA for all other routes
  • The Caddyfile handles TLS termination, security headers, and routing
  • The workflow in .github/workflows/deploy.yml builds, deploys frontend + backend, and restarts services

One-time server setup

  • Install the SSH public key for the github-deploy user in /home/github-deploy/.ssh/authorized_keys
  • Ensure /opt/projekt-kiq/ is writable by github-deploy
  • Create /opt/projekt-kiq/.env with production credentials (see .env.example)
  • Allow github-deploy to run the required sudo commands (see deploy workflow)

Required GitHub secrets

  • DEPLOY_SSH_KEY: private key for the github-deploy user

Environment Variables

See .env.example for all available configuration options.