feat(backend): add fastify api, auth, prisma schema and jobs

This commit is contained in:
Anton
2026-04-23 16:04:44 +03:00
parent 5f6a551b6c
commit 2972090c48
34 changed files with 1313 additions and 0 deletions

32
apps/backend/src/index.ts Normal file
View File

@@ -0,0 +1,32 @@
import { buildApp } from './app.js';
import { env } from './config/env.js';
async function main(): Promise<void> {
const app = await buildApp();
try {
await app.listen({ port: env.BACKEND_PORT, host: '0.0.0.0' });
} catch (err) {
app.log.error({ err }, 'failed to start');
process.exit(1);
}
const shutdown = async (signal: NodeJS.Signals) => {
app.log.info({ signal }, 'shutting down');
try {
await app.close();
process.exit(0);
} catch (err) {
app.log.error({ err }, 'shutdown error');
process.exit(1);
}
};
process.on('SIGTERM', () => {
void shutdown('SIGTERM');
});
process.on('SIGINT', () => {
void shutdown('SIGINT');
});
}
void main();