~/sessions/construire-un-blog-sur-mesure-avec-astro-et-payload

SESSION / working transcript

Building a custom blog with Astro and Payload

The key decisions behind a self-hosted blog, editable in Payload and fully designed with Astro.

transcript / start18 messages
01Paulpaul

I want a self-hosted blog, one author, no newsletter. I do want analytics, though, and above all something much more configurable than a template-based design. I’d like a terminal style.

02Agentagent

Sounds good. I’ll get started right away.

Building

  1. 01
    Defining structure
  2. 02
    Build home page
  3. 03
    Generate article parser
  4. 04
    Writing first article
  5. 05
    Building CSS style
  6. 06
    Deploy and open preview
03Paulpaul

I really like it. New idea: what if we publish articles as chat sessions, with messages, commands, and tool output? And keep regular blog posts in the same list too? Also, you built me a simple site, but how can I edit my posts easily?

04Agentagent

Yes. Both formats can live in the same list. Each entry will simply state its format: a regular article with an editorial body, or a session made up of messages, commands, and tool output. The site will then use the appropriate layout.

For editing, changing Markdown files directly would quickly become cumbersome. We need an interface that can manage drafts, media, metadata, and previews before publication.

Of the available options, Publii seems like the simplest fit for your needs. You could write from a desktop app, fully customize the theme, then generate the site locally and publish it to your server over SFTP.

05Agentagent · tool call
tool call
$ Building demo with Publii
06Paulpaul

Publii looks convenient, but is it really doing anything for us if we rebuild the entire theme and publishing workflow?

07Agentagent

Not really. Publii is very effective at quickly generating a static site from a theme. But if we customize the editorial model, sessions, components, and previews, we’ll probably spend our time working around the way it operates.

Astro would be a better fit: the site would stay lightweight, fast, and mostly static, while giving us control over every detail of the final result.

08Paulpaul

Okay, let’s go with Astro. But do I lose the admin interface? I want something with drafts, media, and a real preview before publication.

09Agentagent

We can separate editing from rendering.

A headless CMS such as Payload or Directus would store the content, versions, drafts, and media. Astro would fetch that data and remain entirely responsible for the public site.

The preview wouldn’t be an approximation inside the CMS: it would open the actual Astro site with the content still in draft.

10Paulpaul

I prefer Payload; it looks simpler. Build me a local demo.

11Agentagent

I’ll create a single collection called “Publications”, with a field that determines the format: article or session.

Both will share the same metadata — title, summary, image, date, status, and URL — while keeping their own structure. Articles will have a rich editorial body. Sessions will be made up of messages, notes, and tool calls.

12Agentagent · tool call
tool call
$ pnpm create astro
✔ Astro project created

$ pnpm create payload-app
✔ Payload project created
✔ PostgreSQL adapter configured
✔ Drafts and versions enabled
13Agentagent

The foundation is ready. I’m moving on to the content model and preview.

14Agentagent · tool call
tool call
$ pnpm test:content-model
✔ article publication validated
✔ session publication validated
✔ draft preview token validated
✔ reading time calculated
15Paulpaul

I love the demo. Let’s deploy it to my server, but reuse the PostgreSQL instance that’s already running. And keep Umami for analytics, protected like the rest of the admin.

16Agentagent

I’ll keep the existing PostgreSQL instance. Astro will be the only application exposed publicly. Payload and Umami will remain on subdomains protected by the reverse proxy.

Before deploying, I’ll check the connections, required variables, and backup status without touching the server’s other services.

17Agentagent · tool call
tool call
$ docker compose up -d --build
✔ payload      ready
✔ astro        ready
✔ postgresql   connected
✔ umami        healthy
✔ reverse proxy healthy
18Agentagent

The deployment is complete. The public site is responding correctly, the admin is protected, and Payload is connected to the existing PostgreSQL instance.