Initial commit: CV website with ElysiaJS, SQLite, and TailwindCSS

This commit is contained in:
Tuan-Dat Tran
2025-11-21 20:07:05 +01:00
parent 378487efc8
commit 88aeaa9002
14 changed files with 759 additions and 109 deletions

51
src/index.tsx Normal file
View File

@@ -0,0 +1,51 @@
import { Elysia, NotFoundError } from "elysia";
import { html } from "@elysiajs/html";
import * as elements from "typed-html";
import { BaseHtml } from "./components/BaseHtml";
import { Layout } from "./components/Layout";
import { HeroSection, AboutSection, ExperienceSection, EducationSection, SkillsSection } from "./components/Sections";
import { getAllData } from "./db/queries";
const app = new Elysia()
.use(html())
.get("/", () => {
return Response.redirect("/en"); // Default to English
})
.get("/:lang", ({ params, html, set }) => {
const lang = params.lang as "en" | "de";
if (!["en", "de"].includes(lang)) {
throw new NotFoundError();
}
const data = getAllData(lang);
if (!data.profile) {
throw new NotFoundError("Profile data not found for selected language.");
}
return html(
<BaseHtml>
<Layout lang={lang}>
<HeroSection profile={data.profile} />
{/* Separate About Section using the summary */}
{data.profile.summary && <AboutSection summary={data.profile.summary} />}
<div class="grid gap-12">
<ExperienceSection experience={data.experience} />
{/* Only render Education section if data exists */}
{data.education && data.education.length > 0 && (
<EducationSection education={data.education} />
)}
<SkillsSection skills={data.skills} />
</div>
</Layout>
</BaseHtml>
);
})
.listen(3000);
console.log(
`Elysia is running at http://${app.server?.hostname}:${app.server?.port}`
);