feat: Implement Keycloak authentication and a basic CMS
Integrates Keycloak for secure administrator authentication using Arctic. Introduces a full CMS dashboard for managing CV content, supporting multi-language editing for profile, experience, and education sections. Refactors application routes for modularity and adds initial unit tests for database queries. Also includes minor UI/UX refinements, animation setup, and local Keycloak docker-compose configuration. Fixes: - Corrected KeyCloak import. - Restored missing getEducation function. - Ensured proper HTTP redirects. - Fixed PKCE code verifier length.
This commit is contained in:
@@ -1,51 +1,14 @@
|
||||
import { Elysia, NotFoundError } from "elysia";
|
||||
import { Elysia } 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";
|
||||
import { adminRoutes } from "./routes/admin";
|
||||
import { publicRoutes } from "./routes/public";
|
||||
|
||||
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>
|
||||
);
|
||||
})
|
||||
.use(adminRoutes)
|
||||
.use(publicRoutes)
|
||||
.listen(3000);
|
||||
|
||||
console.log(
|
||||
`Elysia is running at http://${app.server?.hostname}:${app.server?.port}`
|
||||
);
|
||||
);
|
||||
Reference in New Issue
Block a user