MVP Build

This commit is contained in:
Eric Gullickson
2025-08-09 12:47:15 -05:00
parent 2e8816df7f
commit 8f5117a4e2
92 changed files with 5910 additions and 0 deletions

45
backend/src/index.ts Normal file
View File

@@ -0,0 +1,45 @@
/**
* @ai-summary Application entry point
* @ai-context Starts the Express server with all feature capsules
*/
import { app } from './app';
import { env } from './core/config/environment';
import { logger } from './core/logging/logger';
const PORT = env.PORT || 3001;
const server = app.listen(PORT, () => {
logger.info(`MotoVaultPro backend running`, {
port: PORT,
environment: env.NODE_ENV,
nodeVersion: process.version,
});
});
// Graceful shutdown
process.on('SIGTERM', () => {
logger.info('SIGTERM received, shutting down gracefully');
server.close(() => {
logger.info('Server closed');
process.exit(0);
});
});
process.on('SIGINT', () => {
logger.info('SIGINT received, shutting down gracefully');
server.close(() => {
logger.info('Server closed');
process.exit(0);
});
});
// Handle uncaught exceptions
process.on('uncaughtException', (error) => {
logger.error('Uncaught Exception', { error: error.message, stack: error.stack });
process.exit(1);
});
process.on('unhandledRejection', (reason, promise) => {
logger.error('Unhandled Rejection', { reason, promise });
process.exit(1);
});