feat: Complete NestJS backend scaffold — 22 modules, 39 entities, WebSocket gateway
All checks were successful
Test Asgard Runner / test (push) Successful in 3s

Full backend rewrite from Rust/Axum to NestJS/TypeScript.
- 22 feature modules (auth, servers, wipes, maps, plugins, players, console,
  chat, team, notifications, settings, schedules, analytics, alerts, status,
  store, webstore, admin, setup, migration, users, licenses)
- 39 TypeORM entities matching PostgreSQL schema (12 migrations)
- Common infrastructure: JWT/RBAC guards, decorators, exception filter
- NATS service with pub/sub/request-reply
- Socket.IO WebSocket gateway with NATS bridge
- Docker: NestJS Dockerfile + updated docker-compose.yml
- Zero compile errors (npx tsc --noEmit clean)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-02-15 21:29:25 -05:00
parent 0f8d0dd14f
commit d20493d533
141 changed files with 13552 additions and 4 deletions

View File

@@ -0,0 +1,44 @@
import { Injectable, OnModuleInit, Logger } from '@nestjs/common';
import { NatsService } from './nats.service';
@Injectable()
export class NatsBridgeService implements OnModuleInit {
private readonly logger = new Logger(NatsBridgeService.name);
private listeners: Map<string, Set<(event: string, data: unknown) => void>> = new Map();
constructor(private nats: NatsService) {}
onModuleInit() {
this.nats.subscribe('corrosion.*.companion.heartbeat', (data, subject) => {
const licenseId = subject.split('.')[1];
this.emit(licenseId, 'heartbeat', data);
});
this.nats.subscribe('corrosion.*.console.output', (data, subject) => {
const licenseId = subject.split('.')[1];
this.emit(licenseId, 'console_output', data);
});
this.logger.log('NATS bridge subscriptions initialized');
}
addListener(licenseId: string, callback: (event: string, data: unknown) => void): void {
if (!this.listeners.has(licenseId)) {
this.listeners.set(licenseId, new Set());
}
this.listeners.get(licenseId)!.add(callback);
}
removeListener(licenseId: string, callback: (event: string, data: unknown) => void): void {
this.listeners.get(licenseId)?.delete(callback);
}
private emit(licenseId: string, event: string, data: unknown): void {
const callbacks = this.listeners.get(licenseId);
if (callbacks) {
for (const cb of callbacks) {
cb(event, data);
}
}
}
}