With TRUSTED_HEADER_USERNAME and TRUSTED_PROXIES set, POST /api/auth/trusted-login signs in the user an authenticating reverse proxy (such as Authentik forward auth) names in that header, believing it only on connections from the proxy addresses. Users are matched by username, so an existing account is adopted; otherwise one is created, the first as admin as with registration. New accounts get a random password, and a user the proxy vouches for can set their own password without the current one, to log in when reached without the proxy.
Flashpoint Web Backend
Node.js/Express API server for the Flashpoint Archive web application.
Features
- RESTful API for game metadata
- Direct SQLite database access (read-only)
- Integrated game content serving (proxy + ZIP)
- Image and logo serving
- Playlist management
- Platform and tag endpoints
Quick Start
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Start development server
npm run dev
Server runs on http://localhost:3100
API Endpoints
See ../../api-specification.md for complete API documentation.
Core Endpoints
GET /health- Health checkGET /api/games- List gamesGET /api/games/:id- Get game detailsGET /api/platforms- List platformsGET /api/tags- List tagsGET /api/playlists- List playlists
Architecture
src/
├── routes/ # Express route handlers
├── services/ # Business logic layer
├── game/ # Integrated game service (proxy, ZIP, CGI)
├── middleware/ # Express middleware
├── utils/ # Helper functions
├── config.ts # Configuration management
└── server.ts # Application entry point
Database
Uses sql.js (pure JavaScript SQLite) for direct read-only access to:
D:\Flashpoint\Data\flashpoint.sqlite
No native compilation required! sql.js is a WebAssembly-based SQLite implementation that works without Visual Studio or build tools.
Schema includes tables for games, platforms, tags, and more.
Development
npm run dev # Start with hot reload (tsx)
npm run build # Compile TypeScript
npm run start # Run compiled version
npm run typecheck # Type checking only
npm run lint # ESLint
Environment Variables
Required:
FLASHPOINT_PATH- Path to Flashpoint installationFLASHPOINT_DB_PATH- Path to SQLite database
Optional:
PORT- Server port (default: 3100)NODE_ENV- Environment (development/production)DOMAIN- Frontend origin (default: http://localhost:5173)
See .env.example for all options.