NULL title/description and an empty skills list reached the components as-is.
Normalising once in aboutMeData.ts keeps the presentational components free of
undefined checks, and wraps the fetch so a failing API degrades to a skeleton
instead of an unhandled error.
The blog post page ignored the API entirely and rendered a hardcoded
placeholder article, so every published post showed the same invented content
regardless of what was stored in the database. Metadata (author, category,
date, tags, counts) came from placeholders too.
post.body is plain text written from the admin panel, so parse it into
paragraphs, h1/h2 headings and lists and render the pieces as text nodes.
dangerouslySetInnerHTML is deliberately not used: there is no sanitiser in
this app, so injecting author-supplied HTML would be an XSS hole.
The body falls back to the excerpt, then to an empty-state message. The cover
image now renders only when featured_image holds a real URL; the seeded rows
point at via.placeholder.com, so they render nothing rather than a broken or
third-party image.
Also guard the about-me section: title and description are NULL in the live
database, so it now falls back to Persian text, omits the skills grid when
there are none, and degrades to a skeleton if the API fails instead of
crashing.
Server-rendered CMS at /admin, reachable only with an authenticated admin.
There was no way to change anything on the site without a database session,
while every mutating endpoint used to be anonymous, so the site was either
unmanageable or, before the API lock-down, wide open.
Everything runs through Server Actions, so the httpOnly
parsaaghayi_admin_session cookie set by the backend is read server-side and
forwarded as a bearer token. No token ever reaches client JavaScript and the
browser never talks to the backend cross-origin, so CORS and CSRF do not
apply. Unauthenticated visits to any panel route redirect to /admin/login.
Resources are declared once in a registry (src/app/lib/admin/resources.ts)
and the list, create and edit screens are generated from it, so adding a
content type is a data change rather than three new pages. Covered: posts,
categories, tags, projects, about-me.
Records are read from GET /api/admin/resources/{resource}, which returns
stored rows including every locale; the public endpoints only expose
translated display payloads and cannot populate an editing form.
Verified: tsc --noEmit clean, eslint clean, next build compiles and registers
all five admin routes as dynamic, and /admin, /admin/posts redirect 307 to
/admin/login while /admin/login renders.
Post bodies are rendered as text nodes, never as HTML.