import { createApp } from "./app.js";
import { initDb } from "./db/client.js";
import { env } from "./config/env.js";

async function main() {
  await initDb();
  const app = createApp();
  app.listen(env.port, () => {
    console.log(`[skori-server] listening on http://localhost:${env.port}`);
  });
}

main().catch((err) => {
  console.error("Fatal startup error:", err);
  process.exit(1);
});
