feat: initial commit web-cad-neu with docker-compose, frontend and backend

This commit is contained in:
2026-06-26 10:50:24 +02:00
commit 4ec76fe406
102 changed files with 25722 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
/**
* Web CAD Backend – Entry Point
*/
import { createServer } from './server.js';
import { SqliteAdapter } from './database/SqliteAdapter.js';
import { initYjsPersistence, closeYjsPersistence } from './websocket/yjsServer.js';
const PORT = parseInt(process.env.PORT || '3001', 10);
const HOST = process.env.HOST || '0.0.0.0';
const DB_PATH = process.env.DB_PATH || '/data/web-cad.db';
async function main() {
const db = new SqliteAdapter(DB_PATH);
await db.init();
await initYjsPersistence();
const fastify = await createServer({ port: PORT, host: HOST, db });
try {
await fastify.listen({ port: PORT, host: HOST });
console.log(`Web CAD Backend running on http://${HOST}:${PORT}`);
} catch (err) {
fastify.log.error(err);
process.exit(1);
}
// Graceful shutdown
process.on('SIGTERM', async () => {
await fastify.close();
db.close();
process.exit(0);
});
process.on('SIGINT', async () => {
await fastify.close();
db.close();
process.exit(0);
});
}
main();