How this site is built

This site is built with remix.run. There is no database for the posts, instead the posts are written directly in MDX.

The transformation from MDX to the component is done with the following function:


_31
type FrontMatter = {
_31
title: string;
_31
description: string;
_31
published: Date;
_31
isFeatured: boolean;
_31
};
_31
_31
export const getMdxFile = async (file: string) => {
_31
const filePath = path.join(process.cwd(), `posts/${file}.mdx`);
_31
const postContent = (await readfile(filepath)).tostring()
_31
return bundleMDX<FrontMatter>({
_31
source: postContent,
_31
mdxOptions(options) {
_31
return {
_31
rehypePlugins: [...(options.rehypePlugins ?? [])],
_31
remarkPlugins: [
_31
...(options.remarkPlugins ?? []),
_31
[
_31
remarkCodeHike,
_31
{
_31
theme: "one-dark-pro",
_31
lineNumbers: true,
_31
showCopyButton: true,
_31
autoImport: true,
_31
},
_31
],
_31
],
_31
};
_31
},
_31
});
_31
};

The function simply reads the content of the post, delagating the real transformation to mdx-bundler.

The deploy is done with Coolify, running on an hetzener vps.

nobyai logo
Typo?