xonecas.io
7517
Cd

clanker-and-the-dev / commit ec3541c

feat: initial site framework

xonecas2026-06-08 ec3541c52dae497f2de6dd5f23cdeeec34697d1a

9 files changed

.dockerignore+6−0
@@ -0,0 +1,6 @@
1+node_modules
2+npm-debug.log
3+.git
4+.gitignore
5+.DS_Store
6+.env
.gitignore+4−0
@@ -0,0 +1,4 @@
1+node_modules/
2+.env
3+npm-debug.log*
4+.DS_Store
AGENTS.md+23−0
@@ -0,0 +1,23 @@
1+# Clanker and the Dev
2+
3+This project is a website that follows the same format of a blog, but in addition of blog posts,
4+each "post" is a comic strip.
5+
6+## Tech
7+
8+- HTMX and Tailwind for frontend
9+- Hono.dev for the server
10+- Deployed to https://render.com/ using a docker image (https://render.com/docs/docker)
11+- Run locally in docker image (Do not install locally)
12+
13+## Look and feel
14+
15+- Monospace font: VT323 (free Google Font) for an 80s terminal style.
16+- Hacker green on black, dark grayscale ui components borders, icons, buttons etc.
17+- Sidebar on the left, with sitename, and history of posts. and any other pages.
18+- Main pane shows content, or a splash screen with an "About section".
19+
20+## Content is markdown
21+
22+- Posts are markdown files, with simple metadata as frontmatter. they live in posts/
23+- Metadata has name, slug, and timestamp. Supports Jekyll post files.
Dockerfile+16−0
@@ -0,0 +1,16 @@
1+FROM node:22-alpine
2+
3+WORKDIR /app
4+
5+COPY package.json ./
6+RUN npm install --omit=dev
7+
8+COPY src ./src
9+COPY posts ./posts
10+
11+ENV NODE_ENV=production
12+ENV PORT=3000
13+
14+EXPOSE 3000
15+
16+CMD ["npm", "start"]
README.md+30−0
@@ -0,0 +1,30 @@
1+# Clanker and the Dev
2+
3+Minimal POC for a comic-strip blog using Hono, HTMX, Tailwind CDN, and markdown posts.
4+
5+## Run in Docker
6+
7+```bash
8+docker build -t clanker-and-the-dev .
9+docker run --rm -p 3000:3000 clanker-and-the-dev
10+```
11+
12+Open <http://localhost:3000>.
13+
14+## Posts
15+
16+Add markdown files to `posts/` with frontmatter:
17+
18+```md
19+---
20+name: My Strip
21+slug: my-strip
22+timestamp: 2026-06-08
23+---
24+
25+# My Strip
26+
27+![Panel 1](/path-or-url-to-image.png)
28+```
29+
30+Jekyll-style filenames like `2026-06-08-my-strip.md` are also supported.
dev.sh+4−0
@@ -0,0 +1,4 @@
1+#!/bin/bash
2+
3+docker build -t clanker-and-the-dev .
4+docker run --rm -p 3000:3000 clanker-and-the-dev
package.json+14−0
@@ -0,0 +1,14 @@
1+{
2+ "name": "clanker-and-the-dev",
3+ "version": "0.1.0",
4+ "private": true,
5+ "type": "module",
6+ "scripts": {
7+ "start": "node src/server.js"
8+ },
9+ "dependencies": {
10+ "@hono/node-server": "^1.13.8",
11+ "hono": "^4.6.14",
12+ "marked": "^15.0.6"
13+ }
14+}
posts/welcome.md+10−0
@@ -0,0 +1,10 @@
1+---
2+name: Welcome to Clanker and the Dev
3+slug: welcome
4+timestamp: 2023-10-27
5+---
6+
7+# Welcome!
8+
9+This is the first post of "Clanker and the Dev".
10+Welcome to our corner of the digital void.
src/server.js+217−0
@@ -0,0 +1,217 @@
1+import { serve } from '@hono/node-server';
2+import { Hono } from 'hono';
3+import { html, raw } from 'hono/html';
4+import { marked } from 'marked';
5+import { readdir, readFile } from 'node:fs/promises';
6+import path from 'node:path';
7+
8+const app = new Hono();
9+const POSTS_DIR = path.join(process.cwd(), 'posts');
10+const PORT = Number(process.env.PORT || 3000);
11+const SITE_TITLE = 'Clanker and the Dev';
12+const SITE_TAGLINE = 'terminal comics from the build log';
13+
14+marked.setOptions({
15+ gfm: true,
16+ breaks: true,
17+});
18+
19+function parseFrontmatter(source) {
20+ const match = source.match(/^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/);
21+ if (!match) return { metadata: {}, body: source };
22+
23+ const metadata = {};
24+ for (const line of match[1].split('\n')) {
25+ const separator = line.indexOf(':');
26+ if (separator === -1) continue;
27+ const key = line.slice(0, separator).trim();
28+ const rawValue = line.slice(separator + 1).trim();
29+ metadata[key] = rawValue.replace(/^['"]|['"]$/g, '');
30+ }
31+
32+ return { metadata, body: match[2] };
33+}
34+
35+function jekyllMetadataFromFilename(filename) {
36+ const match = filename.match(/^(\d{4}-\d{2}-\d{2})-(.+)\.md$/);
37+ if (!match) return {};
38+ return { timestamp: match[1], slug: match[2] };
39+}
40+
41+async function getPosts() {
42+ const files = (await readdir(POSTS_DIR)).filter((file) => file.endsWith('.md'));
43+ const posts = await Promise.all(
44+ files.map(async (file) => {
45+ const source = await readFile(path.join(POSTS_DIR, file), 'utf8');
46+ const { metadata, body } = parseFrontmatter(source);
47+ const filenameMetadata = jekyllMetadataFromFilename(file);
48+ const slug = metadata.slug || filenameMetadata.slug || file.replace(/\.md$/, '');
49+ const name = metadata.name || slug.replaceAll('-', ' ');
50+ const timestamp = metadata.timestamp || filenameMetadata.timestamp || '';
51+
52+ return {
53+ file,
54+ slug,
55+ name,
56+ timestamp,
57+ body,
58+ html: marked.parse(body),
59+ };
60+ }),
61+ );
62+
63+ return posts.sort((a, b) => String(b.timestamp).localeCompare(String(a.timestamp)));
64+}
65+
66+async function getPost(slug) {
67+ const posts = await getPosts();
68+ return posts.find((post) => post.slug === slug);
69+}
70+
71+const postHref = (post) => `/posts/${encodeURIComponent(post.slug)}`;
72+const postPartialHref = (post) => `/partials/posts/${encodeURIComponent(post.slug)}`;
73+
74+const Page = ({ title = SITE_TITLE, posts, children }) => html`<!doctype html>
75+ <html lang="en">
76+ ${Head({ title })}
77+ <body class="scanlines min-h-screen bg-black text-green-400 selection:bg-green-900 selection:text-green-100">
78+ ${AppShell({ posts, children })}
79+ </body>
80+ </html>`;
81+
82+const Head = ({ title }) => html`<head>
83+ <meta charset="utf-8" />
84+ <meta name="viewport" content="width=device-width, initial-scale=1" />
85+ <title>${title}</title>
86+ <script src="https://cdn.tailwindcss.com"></script>
87+ <script src="https://unpkg.com/htmx.org@2.0.4"></script>
88+ <link rel="preconnect" href="https://fonts.googleapis.com" />
89+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
90+ <link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet" />
91+ ${GlobalStyles()}
92+</head>`;
93+
94+const GlobalStyles = () => html`<style>
95+ :root { color-scheme: dark; }
96+ body { font-family: 'VT323', 'Courier New', monospace; }
97+ .scanlines::before {
98+ content: '';
99+ pointer-events: none;
100+ position: fixed;
101+ inset: 0;
102+ background: repeating-linear-gradient(
103+ to bottom,
104+ rgba(255,255,255,0.03),
105+ rgba(255,255,255,0.03) 1px,
106+ transparent 1px,
107+ transparent 4px
108+ );
109+ mix-blend-mode: screen;
110+ }
111+ .post-content h1 { font-size: 2.25rem; line-height: 1; margin-bottom: 1rem; color: #86efac; }
112+ .post-content h2 { font-size: 1.75rem; margin-top: 1.5rem; color: #bbf7d0; }
113+ .post-content p { margin: 1rem 0; }
114+ .post-content a { color: #22c55e; text-decoration: underline; }
115+ .post-content img { border: 1px solid #166534; background: #020617; padding: 0.5rem; max-width: 100%; }
116+ .post-content pre { border: 1px solid #14532d; padding: 1rem; overflow-x: auto; background: #020617; }
117+</style>`;
118+
119+const AppShell = ({ posts, children }) => html`<div class="min-h-screen border-green-950 md:grid md:grid-cols-[19rem_1fr]">
120+ ${Sidebar({ posts })}
121+ <main id="main" class="min-h-screen border-green-950 p-6 md:border-l lg:p-10">
122+ ${children}
123+ </main>
124+</div>`;
125+
126+const Sidebar = ({ posts }) => html`<aside class="border-b border-green-950 bg-zinc-950/90 p-5 md:min-h-screen md:border-b-0">
127+ ${SiteMark()}
128+ <p class="mt-3 text-lg text-green-700">${SITE_TAGLINE}</p>
129+ ${PostHistory({ posts })}
130+</aside>`;
131+
132+const SiteMark = () => html`<a
133+ href="/"
134+ hx-get="/partials/home"
135+ hx-target="#main"
136+ hx-push-url="/"
137+ class="block border border-green-800 bg-black p-4 text-3xl uppercase tracking-widest text-green-300 shadow-[0_0_20px_rgba(34,197,94,0.12)]"
138+>
139+ Clanker<br />&amp; the Dev
140+</a>`;
141+
142+const PostHistory = ({ posts }) => html`<nav class="mt-8">
143+ <h2 class="border-b border-green-900 pb-2 text-xl uppercase text-green-500">Post history</h2>
144+ <ol class="mt-3 space-y-2">
145+ ${posts.map((post) => PostHistoryItem({ post }))}
146+ </ol>
147+</nav>`;
148+
149+const PostHistoryItem = ({ post }) => html`<li>
150+ <a
151+ href="${postHref(post)}"
152+ hx-get="${postPartialHref(post)}"
153+ hx-target="#main"
154+ hx-push-url="${postHref(post)}"
155+ class="block border border-zinc-800 bg-zinc-950 p-3 text-xl text-green-300 hover:border-green-700 hover:bg-green-950/30"
156+ >
157+ <span class="block text-sm text-green-700">${post.timestamp || 'undated'}</span>
158+ ${post.name}
159+ </a>
160+</li>`;
161+
162+const HomePage = () => html`<section class="mx-auto max-w-4xl">
163+ <div class="border border-green-800 bg-zinc-950 p-6 shadow-[0_0_35px_rgba(34,197,94,0.08)]">
164+ <p class="text-lg uppercase tracking-[0.45em] text-green-700">boot sequence complete</p>
165+ <h1 class="mt-4 text-5xl text-green-200 md:text-7xl">${SITE_TITLE}</h1>
166+ <p class="mt-6 max-w-2xl text-2xl text-green-400">
167+ A minimal proof-of-concept for a comic-strip blog: markdown posts, a left-side archive,
168+ HTMX navigation, and a glowing black-and-green terminal vibe.
169+ </p>
170+ </div>
171+</section>`;
172+
173+const PostPage = ({ post }) => html`<article class="post-content mx-auto max-w-4xl">
174+ <header class="mb-6 border border-green-900 bg-zinc-950 p-5">
175+ <p class="text-lg uppercase tracking-[0.35em] text-green-700">${post.timestamp || 'undated'}</p>
176+ <h1 class="mt-2 text-5xl text-green-200">${post.name}</h1>
177+ </header>
178+ ${MarkdownPanel({ html: post.html })}
179+</article>`;
180+
181+const MarkdownPanel = ({ html: markdownHtml }) => html`<div class="border border-zinc-800 bg-black p-5 text-2xl leading-relaxed text-green-300">
182+ ${raw(markdownHtml)}
183+</div>`;
184+
185+const NotFoundPage = () => html`<section class="border border-green-900 bg-zinc-950 p-6 text-2xl text-green-300">
186+ <h1 class="text-5xl text-green-200">404</h1>
187+ <p class="mt-3">Signal lost. This strip is not in the archive.</p>
188+</section>`;
189+
190+app.get('/', async (c) => {
191+ const posts = await getPosts();
192+ return c.html(Page({ posts, children: HomePage() }));
193+});
194+
195+app.get('/posts/:slug', async (c) => {
196+ const posts = await getPosts();
197+ const post = posts.find((item) => item.slug === c.req.param('slug'));
198+ if (!post) return c.html(Page({ posts, title: `404 | ${SITE_TITLE}`, children: NotFoundPage() }), 404);
199+ return c.html(Page({ posts, title: `${post.name} | ${SITE_TITLE}`, children: PostPage({ post }) }));
200+});
201+
202+app.get('/partials/home', (c) => c.html(HomePage()));
203+
204+app.get('/partials/posts/:slug', async (c) => {
205+ const post = await getPost(c.req.param('slug'));
206+ if (!post) return c.html(NotFoundPage(), 404);
207+ return c.html(PostPage({ post }));
208+});
209+
210+app.notFound(async (c) => {
211+ const posts = await getPosts();
212+ return c.html(Page({ posts, title: `404 | ${SITE_TITLE}`, children: NotFoundPage() }), 404);
213+});
214+
215+serve({ fetch: app.fetch, port: PORT }, (info) => {
216+ console.log(`${SITE_TITLE} listening on http://localhost:${info.port}`);
217+});