Flamel Forge - Technical Overview
Technical overview and engineering philosophy of personal website FlamelForge
FlamelForge - Technical Overview
What It Is
A personal website at jaeminim.com consisting of:
- A statically generated blog with categories and tags
- An embedded React admin SPA for writing and managing posts
- A foundation for hosting future interactive side projects under the same domain
Tech Stack
| Layer | Tool | Why |
|---|---|---|
| Framework | Astro 6 | Static-first with selective hydration — ships zero JS by default |
| Language | TypeScript (strict) | Type safety across the entire codebase |
| Database / CMS | Supabase (PostgreSQL) | Managed Postgres with auth, RLS, and realtime — no backend to run |
| Auth | Supabase Auth | Sessions handled server-side; no custom auth logic needed |
| Interactive UI | React | Islands architecture — only hydrates where interactivity is needed |
| Routing (admin) | React Router (HashRouter) | Single-page admin SPA without needing extra Astro routes |
| Hosting | Railway | Node.js server hosting with GitHub auto-deploy |
| DNS / CDN | Cloudflare | Proxy, DDoS protection, www → apex redirect |
Architecture Philosophy
Static-first
All public-facing pages (blog index, category pages, individual posts) are statically generated at build time. Astro fetches data from Supabase during npm run build and outputs plain HTML files. Users receive pre-rendered HTML with no runtime database queries — fast, cacheable, SEO-friendly.
Build time: Astro → Supabase → HTML files
Request time: User → Railway → static HTML (no DB call)
Selective Hydration (Islands Architecture)
Astro ships zero JavaScript by default. JavaScript only runs where genuinely needed:
client:only="react"— the admin SPA (never shown to public users)- Lightweight vanilla JS scripts — auth checks, theme toggle, search/pagination, admin buttons
No React on any public page. No unnecessary bundle weight for blog readers.
Hybrid Output (output: 'server')
The project uses Astro's server mode with the Node adapter, but almost every page has export const prerender = true. This gives:
- Static HTML for all content pages (performance)
- Live server-side API routes for write operations (security)
/blog/** → prerendered static HTML
/api/posts → server-side (POST/PUT/DELETE)
/api/rebuild → server-side (triggers Railway redeploy)
Security Model
Three layers protect write operations:
- UI layer — admin SPA checks Supabase session; shows login if unauthenticated
- API layer — every write endpoint validates a Supabase Bearer token server-side
- Database layer — Row Level Security (RLS) on all tables; anon key can only read published content
SUPABASE_SERVICE_ROLE_KEY never touches the browser. Only PUBLIC_SUPABASE_URL and PUBLIC_SUPABASE_ANON_KEY are exposed to the client.
URL Structure
/ Homepage
/blog Category cards overview
/blog/category/[slug] Posts in a category (list + search + pagination)
/blog/posts/[slug] Individual blog post
/admin Admin SPA (React, HashRouter)
#/ Dashboard (Rebuild Site button)
#/posts/new Create post
#/posts/:id/edit Edit post
#/categories Manage categories
#/categories/new Create category
#/categories/:id/edit Edit category
/api/posts POST — create post
/api/posts/:id PUT / DELETE — update or delete post
/api/rebuild POST — trigger Railway redeploy
The admin uses HashRouter so Railway only needs to know about one route (/admin). All sub-navigation lives in the URL hash.
File Structure
src/
pages/
index.astro # Homepage
blog/
index.astro # Category cards
[slug].astro # 301 redirect → /blog/posts/[slug]
posts/[slug].astro # Individual post page
category/[cat].astro # Category post list
admin/index.astro # Mounts React admin SPA
api/
posts/index.ts # POST /api/posts
posts/[id].ts # PUT, DELETE /api/posts/:id
rebuild.ts # POST /api/rebuild
components/
Navbar.astro # Auth-aware nav (Login/Logout, theme toggle)
AdminBar.astro # Fixed bottom bar (Dashboard button, admin-only)
blog/PostCard.astro # Post preview card (homepage recent posts)
RecentPosts.astro # Recent posts section for homepage
layouts/
BaseLayout.astro # HTML shell, meta tags, OG, anti-FOUC theme script
lib/
supabase.ts # Public Supabase client (anon key)
supabase-server.ts # Admin Supabase client (service role) + validateToken()
posts.ts # Data fetching helpers (getAllPosts, getPostBySlug, etc.)
types/supabase.ts # Generated TypeScript types for DB schema
styles/
global.css # Design system (CSS custom properties, dark mode)
projects/
admin/ # React admin SPA
App.tsx # Router setup
pages/ # Dashboard, NewPost, EditPost, Categories, etc.
components/ # Editor (markdown + preview)
admin.css # Admin-specific styles
public/
favicon.svg # Placeholder — replace with final icon
og-default.svg # Default Open Graph image
Database Schema
posts
| Column | Type | Notes |
|---|---|---|
| id | uuid PK | Auto-generated |
| title | text | Required |
| slug | text UNIQUE | URL-safe, auto-generated from title |
| category_id | uuid FK | References categories.id |
| tags | text[] | Secondary filters |
| content | text | Markdown |
| excerpt | text | Shown in post listings |
| is_published | boolean | Draft vs published |
| published_at | timestamptz | Display date (not created_at) |
| created_at | timestamptz | Auto |
categories
| Column | Type | Notes |
|---|---|---|
| id | uuid PK | Auto-generated |
| name | text | Display name |
| slug | text UNIQUE | URL-safe identifier |
| is_hidden | boolean | Hidden from /blog listing but URL still accessible |
| created_at | timestamptz | Auto |
RLS policies:
posts— public can read published posts only; authenticated users can writecategories— public can read all; authenticated users can write
Content Update Pipeline
Since pages are static, content changes require a rebuild:
Admin saves post/category
→ Supabase DB trigger (pg_net)
→ POST https://jaeminim.com/api/rebuild
→ Railway GraphQL API (serviceInstanceDeploy)
→ New build runs (npm run build fetches fresh data)
→ New deployment goes live (~2–3 min)
→ Old deployment stays live during build (zero downtime)
Manual trigger also available via Rebuild Site button in admin dashboard.
Dark Mode
Implemented with CSS custom properties and a data-theme attribute on <html>:
:root { --bg: #ffffff; --text: #111827; }
[data-theme="dark"] { --bg: #0f1117; --text: #f9fafb; }
An is:inline script in <head> reads localStorage before the page renders — prevents flash of wrong theme (FOUC).
Key Engineering Decisions
Why HashRouter for admin?
Astro only knows about /admin. Browser routing inside the SPA uses the hash (#/posts/new), so Railway never sees sub-paths and no 404s on direct URL access.
Why categories as a separate table? Originally categories were a plain text field on posts. A separate table allows: display name vs slug distinction, hidden categories (accessible by URL but invisible in listings), and future extensibility (descriptions, ordering, etc.).
Why published_at instead of created_at for display?
Blog posts are often written in advance or backdated. published_at is explicitly set by the author; created_at is a technical timestamp not meaningful to readers.
Why not SSR for blog pages? Static generation means every visitor gets pre-rendered HTML from Railway's edge — no Supabase round-trip per request. The 2–3 minute rebuild delay on publish is an acceptable tradeoff for a personal blog.
Why Cloudflare in front of Railway? Cloudflare handles www → apex redirect, DDoS protection, and SSL termination without any application code. Railway gets clean traffic; the app stays simple.