Erstes lauffähiges Grundgerüst: Monorepo, Fastify-API, React-Startseite, Docker

This commit is contained in:
2026-07-19 01:14:29 +02:00
parent 657496fe49
commit 7b8723729b
39 changed files with 4388 additions and 15 deletions

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

@@ -0,0 +1,41 @@
import Fastify from "fastify";
import cors from "@fastify/cors";
import { ensureSchema } from "./db/client.js";
import { healthRoutes } from "./routes/health.js";
const PORT = Number(process.env.PORT ?? 3001);
const HOST = process.env.HOST ?? "0.0.0.0";
async function main() {
const app = Fastify({
logger: {
level: process.env.LOG_LEVEL ?? "info",
transport:
process.env.NODE_ENV !== "production"
? { target: "pino-pretty", options: { colorize: true } }
: undefined,
},
});
await app.register(cors, {
origin: process.env.CORS_ORIGIN ?? true,
});
ensureSchema();
await app.register(healthRoutes);
app.get("/", async () => {
return { name: "LaunchPad API", status: "running" };
});
try {
await app.listen({ port: PORT, host: HOST });
app.log.info(`LaunchPad backend läuft auf http://${HOST}:${PORT}`);
} catch (err) {
app.log.error(err);
process.exit(1);
}
}
main();