DanpLab · Lab NoteArchitettura operativa

DanpLab.com: how I built my website with AI, chatbot, and automatic publishing

How I built danplab.com with Next.js, a self-hosted AI chatbot, Hermes Agent on Discord, automatic article publishing based on trends and analytics with Matomo.

4 min readBased on real operational use
homelabaiautomationnextjshermes

The project architecture

This website is much more than a simple portfolio. It is an integrated system that combines:

danplab.com (Next.js)
    ├── Blog with automatic publishing
    │       ↑
    │   Hermes Agent (Jarvis on Discord)
    │       ├── Analyzes trends (SearXNG)
    │       ├── Checks analytics (Matomo)
    │       └── Generates and publishes articles via SSH
    │
    ├── Self-hosted AI chatbot
    │       └── Ollama (glm-5:cloud) on NVIDIA A10 GPU
    │
    ├── Privacy-first analytics
    │       └── Self-hosted Matomo
    │
    └── Contact form → Discord DM

Technology stack

| Component | Technology | Server | |-----------|-----------|--------| | Frontend | Next.js 14 (App Router) | LAN-IP | | AI Chatbot | Ollama + glm-5:cloud | LAN-IP (GPU) | | AI Agent | Hermes Agent (Nous Research) | LAN-IP | | Analytics | Self-hosted Matomo | Docker on LAN-IP | | Trend search | Self-hosted SearXNG | LAN-IP | | Public tunnel | Cloudflare Tunnel | Cloudflare Edge | | OS | Debian 12 / Ubuntu 22.04 | Proxmox VE |


Hermes Agent: the brain of the system

Hermes (by Nous Research) is an autonomous AI agent that runs 24/7 on the homelab-server. It is configured on Discord where I can interact with it in natural language.

What Hermes does automatically

Every Monday at 08:00:

  1. Queries SearXNG for the most searched IT topics in Italy and worldwide
  2. Checks Matomo to see which articles have the most traffic
  3. Selects 1-2 topics with high SEO potential
  4. Generates a complete technical article (800+ words)
  5. Publishes it via SSH on danplab.com
  6. Triggers the Next.js rebuild
  7. Notifies me on Discord with the link

Discord commands


Jarvis, scrivi una guida su "Proxmox Backup Server"


Jarvis, quali sono i topic IT più cercati questa settimana?


Jarvis, rebuilda il sito

AI Chatbot: privacy-first

The chatbot in the bottom right corner only answers IT technical questions using an AI model that runs completely on my hardware. No data leaves the infrastructure.

How it works

Visitor writes question
    ↓
Next.js API /api/chat
    ↓ (input sanitization, rate limiting)
Ollama API (LAN-IP:11434)
    ↓ (glm-5:cloud via NVIDIA A10 GPU)
Sanitized response
    ↓
Visitor receives response

Implemented security

  • Input sanitization — blocks prompt injection, XSS, internal IPs
  • Output filtering — filters passwords, tokens, system paths
  • Rate limiting — max 10 messages/hour per IP
  • Timeout 30s — avoids infinite pending requests
  • Armored system prompt — only answers IT topics

Automatic publishing

The publishing workflow uses a simple HTTP webhook:





curl -X POST http://LAN-IP:9876/rebuild \
  -H "X-Webhook-Token: <token>" \
  && next build \
  && systemctl restart danplab-site

Rebuild script

#!/bin/bash

cd /var/www/danplab-site
sudo -u admin node_modules/.bin/next build >> /var/log/danplab-rebuild.log 2>&1
systemctl restart danplab-site
echo "$(date): rebuild completed" >> /var/log/danplab-rebuild.log

Matomo Analytics

I use self-hosted Matomo instead of Google Analytics because:

  • GDPR compliant without invasive cookie banners
  • Data on my server — nobody sells it
  • Full features — heatmaps, funnels, segments

Matomo is accessible at matomo.danplab.com via Cloudflare Tunnel.

Tracking in Next.js

// app/layout.tsx
<Script id="matomo" strategy="afterInteractive" dangerouslySetInnerHTML={{ __html: `
  var _paq = window._paq = window._paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u='//matomo.danplab.com/';
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
`}} />

Internationalization (i18n)

The site is available in Italian (default) and English with automatic detection from geolocation:

  • Italian visitors → danplab.com (IT)
  • International visitors → danplab.com/en (EN)

Technology: next-intl with Cloudflare middleware for geo-detection via CF-IPCountry header.


What I learned

Building this project taught me that self-hosted AI is not just a hobby — it's a concrete competitive advantage:

  1. Total control over data and system behavior
  2. Marginal cost — only electricity and already owned hardware
  3. Personalization — the chatbot knows my profile and my articles
  4. Real automation — Hermes publishes content while I sleep

The source code and configuration are available on request for anyone who wants to replicate the setup.


Next developments

  • [ ] Newsletter with lead generation from the chatbot
  • [ ] Consultation booking via integrated Calendly
  • [ ] RAG — chatbot that answers by citing my articles
  • [ ] Complete multi-language also for blog articles
  • [ ] Admin dashboard for article publishing without Discord