Move Projekt-KIQ-HP bahn/ -> dhive/ (dhive project); add steering files

This commit is contained in:
2026-06-30 21:15:59 +02:00
parent d9291f53e4
commit b0e452708a
124 changed files with 74 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
# 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:
```bash
cp .env.example .env.local
```
Fill in the backend credentials (`ADMIN_USER`, `ADMIN_PASSWORD`, `SESSION_SECRET`).
### Running locally
```bash
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
```bash
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`](./Caddyfile) handles TLS termination, security headers, and routing
- The workflow in [`.github/workflows/deploy.yml`](./.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`](./.env.example) for all available configuration options.