Compare commits

..
22 Commits
Author SHA1 Message Date
davide 0d56769388 Home: only latest article reachable via 'read the latest article' link 2026-08-28 08:27:57 +02:00
davide 91b61caa37 Simplify home page and nav to a single latest-article link
Home now shows only the latest article, pointing to the full list on
/blog instead of duplicating recent articles in a grid. Nav trims to
Home, Tutti gli articoli, and the corralito page; the footer drops the
now-redundant Categorie column.
2026-08-27 13:35:29 +02:00
davide b7bb664c95 Add landing page content and a courses page, restyle both
Turn the home page into a single-column feature: a lead image, the
opening statement as the page's sole h1, a second image, and the body
copy, with the existing latest-articles section still below. Add a new
static page for the crypto courses pitch ("come difendersi dal
corralito"), styled like an article with a cover image and a contact
CTA (email + Telegram) instead of the referenced but nonexistent
contact form. Link the new page from the header nav and footer.
2026-08-26 10:46:46 +02:00
davide 809b60d85e Remove i18n, keep only Italian and rely on browser translation
The interface was translated in en/it/es/fr via @nuxtjs/i18n. Drop the
module, the locale files, and the language switcher: the UI is now
static Italian text, with translation for foreign visitors left to the
Google Translate browser extension instead of the app.
2026-08-26 09:39:05 +02:00
davide 448dd881e4 Ignore ops/ (holds VPS credentials, never commit) 2026-08-25 20:07:09 +02:00
davide 8021ea7254 Route every Strapi plugin path to the CMS, not just /admin
Strapi mounts each plugin's admin API at its own top-level path
(/content-manager, /upload, /i18n, ...), not nested under /admin as
previously assumed. That broke the dashboard widgets: recent/count
documents calls landed on the frontend instead of Strapi. List every
prefix actually used by the installed plugins (core-bundled ones plus
users-permissions and cloud from cms/package.json) explicitly in the
Caddyfile.
2026-08-25 20:06:40 +02:00
davide e927396505 Serve the CMS admin panel under /admin on the public domain
Replace the separate CMS subdomain with path-based routing in Caddy:
/admin and /uploads go to Strapi, everything else to the frontend.
Strapi 5 nests its whole admin panel (UI and API) under /admin, so this
one prefix is enough and never collides with the frontend's own /api
routes. Drops CMS_DOMAIN and the unused STRAPI_URL env var on the cms
service; PUBLIC_STRAPI_URL now points at the same origin as the site.

Authentication is unchanged: Strapi's own admin login still gates the
panel, this only changes how it's reached.
2026-08-25 19:49:37 +02:00
davide cb29c68d75 Fix ACME DNS resolution failures in the caddy container
The host's systemd-resolved stub (127.0.0.53) is unreachable from inside
the container network namespace, so Caddy could not resolve Let's Encrypt
endpoints. Point it at public resolvers instead.
2026-08-25 19:23:56 +02:00
davide 071bc1eaa5 Make the site responsive for phones, tablets, and desktop
Mobile-first layout with breakpoints at 48rem (tablet) and 64rem (desktop):
stacked nav on phones, progressive column counts for the article grid and
footer, scrollable markdown tables, larger tap targets on nav links.
2026-08-25 19:04:40 +02:00
davide abeabb3a44 Add the official social marks to the footer links
The marks come from the simple-icons package (CC0) and are inlined at build
time — the earlier hand-drawn glyphs were wrong, the X mark in particular is
not a plain cross. Importing the three SVGs individually rather than the
package index keeps the other icons out of the bundle: 10 kB, not 5 MB.

Rendered monochrome in the surrounding text colour, with the text label kept
next to each one.
2026-08-25 16:11:14 +02:00
davide 0229960a15 Add the social profiles to the footer 2026-08-25 15:35:29 +02:00
davide 31dbf56235 Show the author and publication time on articles
Strapi already records which admin user created an entry, so the byline needs
no extra field to fill in: the Article content type sets populateCreatorFields
and the API layer exposes only that user's firstname and lastname. The name
also feeds the BlogPosting structured data.

Also fixes the gap below the article header, which until now came from the
cover image's margin and therefore vanished on articles without a cover,
leaving the body text against the byline.
2026-08-25 15:30:57 +02:00
davide c08f53ca69 Add a language switcher with English, Italian, Spanish and French
The interface is translated through @nuxtjs/i18n: strings live in
i18n/locales/*.json, routes are prefixed except for the default English, and
useLocaleHead emits the lang attribute, the hreflang alternates and og:locale.

The switcher is a native select rather than a custom dropdown: keyboard
support, the platform picker on mobile and correct labelling come for free.

Article content stays single-language — this translates the site chrome only.
2026-08-25 14:23:09 +02:00
davide f5639111f9 Add the contact address to the footer 2026-08-25 13:44:14 +02:00
davide 9256def085 Use the full seal for the favicon at every size 2026-08-25 13:31:27 +02:00
davide 4e8d1a892e Use the CorralitoComing seal as the site logo and favicon
The seal already carries the name, so it replaces the text wordmark in the
header and opens the footer. Small icon sizes use the central emblem only: the
circular lettering is unreadable below 48px.
2026-08-25 13:25:13 +02:00
davide 55b70f0805 Restyle the frontend as an editorial magazine layout
Centred wordmark over a rule of category links, a lead article above a grid of
cards, centred article headers over a narrow reading column, and a footer split
into columns. Neutral warm-grey palette with a serif display face for headings
and small uppercase labels for metadata.
2026-08-25 12:22:05 +02:00
davide 005c90f33a Rename the site to CorralitoComing and switch the UI to English
The name and tagline live in one place, shared/utils/site.ts, and feed the
header, the footer, the home page and the title template.
2026-08-25 12:08:01 +02:00
davide d97fd3f92f Explain how to generate the .env secrets 2026-08-25 11:45:41 +02:00
davide c9ee871c44 Document the stack, the dev workflow and the production deployment
README gets step-by-step instructions for both: secrets generation and the
local stack on one side, DNS records, firewall, environment variables, TLS and
backups on the other.

CLAUDE.md records the decisions that are not visible in the code: why the
browser never reaches Strapi, why the content model stays this small, and where
the public permissions are granted.
2026-08-25 11:42:33 +02:00
davide 960b007ba7 Add Docker Compose stack with PostgreSQL and Caddy
Production traffic enters through Caddy, which terminates TLS for the public
domain and the CMS subdomain and sets HSTS and the other security headers.
PostgreSQL, Strapi and Nuxt publish no ports of their own.

docker-compose.dev.yml publishes the ports on localhost and drops Caddy for
local testing. It is a separate file rather than an override.yml so it can only
be applied when passed explicitly, never by accident in production.
2026-08-25 11:42:24 +02:00
davide a808f1010f Add Nuxt frontend with blog index, article and category pages
The browser never talks to Strapi: pages call Nitro endpoints under
server/api/, which are the only place Strapi queries are built. That keeps the
Strapi URL internal to the Docker network and avoids CORS entirely.

Article bodies are rendered from Markdown to HTML in the endpoint, so the
content is server-rendered and crawlable, marked stays out of the client
bundle, and the meta description is derived from the opening of the body.

Pages carry canonical URLs, Open Graph tags and BlogPosting structured data,
and handle empty, missing and failed states.
2026-08-25 11:42:17 +02:00
43 changed files with 11463 additions and 33 deletions

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
# Copy to .env and replace every placeholder. Never commit .env.
# --- Domains (Caddy) ---
PUBLIC_DOMAIN=blog.localhost
ACME_EMAIL=admin@example.com
# --- Database ---
POSTGRES_DB=blog
POSTGRES_USER=blog
POSTGRES_PASSWORD=change-me
# --- Strapi ---
# Generate each secret with: openssl rand -base64 32
APP_KEYS=change-me-1,change-me-2
API_TOKEN_SALT=change-me
ADMIN_JWT_SECRET=change-me
TRANSFER_TOKEN_SALT=change-me
JWT_SECRET=change-me
ENCRYPTION_KEY=change-me
# --- Frontend ---
# Server-side only: internal Docker address of Strapi.
STRAPI_URL=http://cms:1337
# Public base URL of the website, used for canonical URLs and Open Graph.
PUBLIC_SITE_URL=https://blog.localhost
# Public base URL of Strapi, used to build absolute media URLs in the browser.
# Same origin as PUBLIC_SITE_URL: Caddy proxies /admin and /uploads to Strapi.
PUBLIC_STRAPI_URL=https://blog.localhost
+3
View File
@@ -10,6 +10,9 @@ node_modules/
*.pem *.pem
*.key *.key
# ops (holds VPS credentials, never commit)
ops/
# nuxt # nuxt
frontend/.nuxt/ frontend/.nuxt/
frontend/.output/ frontend/.output/
+42 -19
View File
@@ -10,30 +10,44 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Stato ## Stato
Repository a **stato bootstrap**: contiene solo questo file. Tutto ciò che segue descrive il Struttura, content type, pagine blog, Docker e Caddy sono in piedi. Restano da fare:
target, non l'esistente. Verifica sempre cosa esiste prima di assumere. sitemap e `robots.txt` dinamici, ricerca, e i test (nessun framework ancora configurato).
Ordine di costruzione:
1. `frontend/` — Nuxt 4 (`npx nuxi@latest init frontend --package-manager npm --no-install-git`)
2. `cms/` — Strapi 5 (`npx create-strapi@latest cms --typescript --dbclient=postgres --no-example --no-git-init`)
3. `docker-compose.yml` + `.env.example` — Postgres, cms, frontend
4. Content types Strapi + permessi ruolo Public (solo `find`/`findOne`)
5. Client Strapi in Nuxt + pagine blog
6. `caddy/Caddyfile` + hardening
## Architettura ## Architettura
```text ```text
Browser → Caddy ─┬─ dominio pubblico → Nuxt 4 (SSR) → REST Strapi Browser → Caddy ─┬─ /admin e i path dei plugin Strapi → Strapi 5 → PostgreSQL
└─ sottodominio CMS → Strapi 5 → PostgreSQL └─ tutto il resto → Nuxt 4 (SSR) → REST Strapi
``` ```
Caddy instrada per **path**, non per sottodominio: `PUBLIC_DOMAIN` serve sia il sito che il
pannello Strapi. Ogni plugin Strapi monta la propria API admin sul proprio path di primo
livello, non tutto sotto `/admin` (es. `/content-manager`, `/upload`, `/i18n`...): l'elenco
completo dei prefissi da instradare a Strapi vive nel `Caddyfile`. Se aggiungi un plugin
Strapi, aggiungi il suo prefisso lì. Niente di questo tocca `/api`, riservato agli endpoint
Nitro del frontend. Un solo dominio, un solo certificato TLS.
- Strapi è la **sola** fonte di verità editoriale. Niente altro backend (no Express/Nest/Fastify): - Strapi è la **sola** fonte di verità editoriale. Niente altro backend (no Express/Nest/Fastify):
se serve logica server, sta in Nitro (`frontend/server/`) o in un controller Strapi. se serve logica server, sta in Nitro (`frontend/server/`) o in un controller Strapi.
- I visitatori pubblici non si autenticano mai. Solo editor/admin usano l'auth Strapi. - I visitatori pubblici non si autenticano mai. Solo editor/admin usano l'auth Strapi.
- Nuxt parla con Strapi **server-side** (`STRAPI_URL` interno Docker). Il token privilegiato non - **Il browser dei visitatori pubblici non parla mai con Strapi.** Le pagine chiamano gli
raggiunge mai il browser: se serve, sta in `runtimeConfig` (non `public`). endpoint Nitro in `frontend/server/api/`, che sono l'unico posto dove si costruiscono
query Strapi. Così `NUXT_STRAPI_URL` resta l'indirizzo interno Docker, niente CORS e
niente token nel client. Se aggiungi una vista, aggiungi l'endpoint lì e tipizza il
ritorno in `shared/types/blog.ts`. Fanno eccezione, per costruzione: l'admin panel
(`/admin`, uso editor/admin autenticato) e le immagini cover, che il browser carica
direttamente da `PUBLIC_STRAPI_URL` (`/uploads/...`, sola lettura, nessun'autenticazione
richiesta né concessa).
- Il Markdown dell'articolo è convertito in HTML **nell'endpoint**, non nel componente: il
contenuto è già nell'HTML SSR e `marked` resta fuori dal bundle client.
- L'**interfaccia** è solo in italiano, stringhe statiche nei componenti (niente
`@nuxtjs/i18n`, niente file di traduzione): `<html lang="it">` è fisso in
`nuxt.config.ts`. La traduzione per i visitatori stranieri è delegata all'estensione
Google Translate del browser, non è gestita dall'app. I **contenuti** restano
monolingua — la localizzazione di Strapi è disattivata.
- `cms/src/index.ts` (`bootstrap`) dà al ruolo Public solo `find`/`findOne` su Article e Category,
e disattiva la registrazione pubblica: non esistono utenti front-end, solo amministratori.
Qualsiasi permesso in più va motivato.
- Postgres non è esposto pubblicamente. Media su volume persistente, mai binari nel DB. - Postgres non è esposto pubblicamente. Media su volume persistente, mai binari nel DB.
## Comandi ## Comandi
@@ -52,11 +66,17 @@ npm run develop # Strapi con content-type builder attivo
npm run build # admin panel npm run build # admin panel
npm run start # produzione npm run start # produzione
# stack # stack completo (con Caddy e domini reali)
docker compose up -d --build docker compose up -d --build
docker compose logs -f cms docker compose logs -f cms
# stack locale senza domini né TLS: porte su localhost, niente Caddy
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build database cms frontend
``` ```
`docker-compose.dev.yml` va passato **sempre esplicitamente**: non è un `override.yml` proprio
per non finire per sbaglio in produzione esponendo le porte.
Nessun test framework è ancora configurato. Se ne aggiungi uno, documenta qui il comando per Nessun test framework è ancora configurato. Se ne aggiungi uno, documenta qui il comando per
lanciare **un singolo test**. lanciare **un singolo test**.
@@ -64,10 +84,13 @@ lanciare **un singolo test**.
| Type | Campi | | Type | Campi |
|---|---| |---|---|
| Article | title, slug (UID da title), excerpt, content (rich text), cover, author (rel), category (rel), tags (rel n:n), publishedDate, seoTitle, seoDescription, seoImage | | Article | title, slug (UID da title), content (Markdown), cover, category (rel) |
| Category | name, slug | | Category | name, slug |
| Tag | name, slug |
| Author | name, biography, image | Deliberatamente minimale: **niente Author** (l'unico autore è l'admin), niente tag, nessun campo
SEO separato. La meta description è ricavata dall'inizio del body (`summarise` in
`frontend/server/utils/strapi.ts`), la data è il `publishedAt` di Draft & Publish, l'immagine
social è la cover. Non reintrodurre questi campi senza che servano davvero.
Draft & Publish attivo su Article. Le URL pubbliche usano lo **slug**, mai l'id numerico. Draft & Publish attivo su Article. Le URL pubbliche usano lo **slug**, mai l'id numerico.
+114 -13
View File
@@ -1,34 +1,135 @@
# Blog # Blog
Blog platform: a public website built with Nuxt, and a private Strapi CMS where Blog platform: a public website built with Nuxt, and a private Strapi CMS where the
editors write the articles. Everything runs behind Caddy via Docker Compose. articles are written. Everything runs behind Caddy via Docker Compose.
```text ```text
Browser → Caddy ─┬─ public domain → Nuxt (website) Browser → Caddy ─┬─ /admin and Strapi's plugin paths → Strapi (CMS) → PostgreSQL
└─ cms subdomain → Strapi (CMS) → PostgreSQL └─ everything else → Nuxt (website)
``` ```
> Status: bootstrap. The application code is not in place yet. There are no front-end accounts: sign-up is disabled and only administrators write
content. An article is a title, a Markdown body, a cover image and a category.
## Getting started ## Development
Requires Docker and Node.js 20+. No domain and no TLS needed — the services are published on localhost instead of going
through Caddy. Requires Docker.
**1. Create the environment file**
```bash
cp .env.example .env
```
**2. Generate the secrets.** Every `change-me` must become a different random value —
Strapi refuses to start otherwise. This fills them all:
```bash
for var in POSTGRES_PASSWORD API_TOKEN_SALT ADMIN_JWT_SECRET TRANSFER_TOKEN_SALT JWT_SECRET ENCRYPTION_KEY; do
sed -i "s|^$var=.*|$var=$(openssl rand -base64 32)|" .env
done
sed -i "s|^APP_KEYS=.*|APP_KEYS=$(openssl rand -base64 32),$(openssl rand -base64 32)|" .env
chmod 600 .env
```
`grep change-me .env` must print nothing. The domain and URL variables can stay as they
are for local use.
**3. Start the stack**
```bash
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build database cms frontend
```
The first build takes a few minutes. `docker-compose.dev.yml` publishes the ports on
`127.0.0.1` and leaves Caddy out; it must always be passed explicitly, so it can never be
picked up by accident in production.
**4. Create the administrator account** at http://localhost:1337/admin (dev bypasses Caddy,
so the CMS is reached directly on its port). This is the first
run, so the form creates the account — pick your own credentials.
**5. Write something.** In the admin panel: create a **Category**, then an **Article**
(the body field is Markdown), then press **Publish** — the website only shows published
content.
**6. Open the website** at http://localhost:3000 — home, `/blog`, `/blog/<slug>` and
`/category/<slug>`.
Useful commands:
```bash
docker compose logs -f cms # follow the CMS logs
docker compose -f docker-compose.yml -f docker-compose.dev.yml restart frontend
docker compose down # stop, keep the data
docker compose down -v # stop and WIPE the database and media
```
To iterate on the code without rebuilding an image every time, run a package directly —
`cd frontend && npm run dev`, or `cd cms && npm run develop`. The frontend defaults to
`http://localhost:1337` for Strapi, so it works against the containerised CMS as is;
override it with `NUXT_STRAPI_URL` if needed. Strapi reads its own `cms/.env`.
## Production
**1. Point the DNS at the server.** One `A` record (and `AAAA` if you have IPv6) on the
public IP of the machine:
| Record | Purpose |
|---|---|
| `example.com` | the website and, at `/admin`, the Strapi admin panel |
Wait for the record to resolve before starting the stack — Caddy requests the
certificate on the first boot and a failed challenge means a retry delay.
**2. Open the firewall** for ports `80` and `443` only. Port `80` is required: Caddy uses
it for the ACME challenge and to redirect to HTTPS. PostgreSQL, Strapi and Nuxt are only
reachable inside the Docker network — do not publish their ports.
**3. Configure the environment.** Copy `.env.example` to `.env` on the server and set:
| Variable | Value |
|---|---|
| `PUBLIC_DOMAIN` | `example.com` |
| `ACME_EMAIL` | a mailbox you read — Let's Encrypt sends expiry warnings there |
| `PUBLIC_SITE_URL` | `https://example.com` |
| `PUBLIC_STRAPI_URL` | `https://example.com` — same origin, Caddy proxies `/admin` and Strapi's other plugin paths there (see `caddy/Caddyfile`) |
| `STRAPI_URL` | leave it as `http://cms:1337` — internal address, never public |
Then generate **fresh** secrets on that machine with the same loop as in development —
different values from the ones you use locally. Keep `.env` out of version control; it is
already ignored.
> Changing `APP_KEYS`, `ADMIN_JWT_SECRET` or `JWT_SECRET` later logs everyone out.
> Changing `ENCRYPTION_KEY` after content exists makes already-encrypted values
> unreadable. Set them once, then back up the file somewhere safe.
**4. Start everything**
```bash ```bash
cp .env.example .env # fill in the secrets, never commit this file
docker compose up -d --build docker compose up -d --build
``` ```
Then open the CMS URL to create the first admin account and start publishing. This time Caddy is included: it serves both the website and, under `/admin` and Strapi's
The public site picks up published articles automatically. other plugin paths, the CMS on `PUBLIC_DOMAIN`, obtains and renews the TLS certificate on
its own, and adds HSTS and the other security headers.
## Working on it **5. Create the administrator account** at `https://example.com/admin`, immediately,
before anyone else finds the URL — the first visitor to that form is the one who gets the
account. Then publish as in development.
**6. Back up what is not in git**: the `postgres-data` volume (all content) and the
`cms-uploads` volume (all images). Nothing else on the server holds state.
```bash ```bash
cd frontend && npm run dev # website docker compose exec -T database pg_dump -U "$POSTGRES_USER" "$POSTGRES_DB" > backup.sql
cd cms && npm run develop # CMS docker run --rm -v blog_cms-uploads:/data -v "$PWD:/out" alpine tar czf /out/uploads.tar.gz -C /data .
``` ```
**Updating a running site**: pull the new code, then `docker compose up -d --build`.
Strapi applies its own schema changes at startup; take a backup first.
Architecture, conventions and constraints are documented in [CLAUDE.md](CLAUDE.md). Architecture, conventions and constraints are documented in [CLAUDE.md](CLAUDE.md).
## License ## License
+42
View File
@@ -0,0 +1,42 @@
{
email {$ACME_EMAIL}
}
(security_headers) {
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
X-Content-Type-Options "nosniff"
X-Frame-Options "SAMEORIGIN"
Referrer-Policy "strict-origin-when-cross-origin"
-Server
}
}
{$PUBLIC_DOMAIN} {
import security_headers
encode zstd gzip
# Strapi mounts each of its (and its plugins') admin APIs at its own
# top-level path, not all under /admin - the admin panel's dashboard
# widgets, media library, i18n, etc each call their own plugin prefix.
# This list is every @strapi/* package in cms/package.json plus the
# core-bundled plugins (content-manager, content-type-builder, upload,
# i18n, email, content-releases, review-workflows). Adding a new Strapi
# plugin later means adding its prefix here too.
# None of this touches /api, reserved for the frontend's own Nitro
# endpoints.
@cms path /admin* /content-manager* /content-type-builder* /upload*\
/i18n* /email* /content-releases* /review-workflows*\
/users-permissions* /cloud*
handle @cms {
# Uploaded media can be large; Strapi's own limit still applies.
request_body {
max_size 100MB
}
reverse_proxy cms:1337
}
handle {
reverse_proxy frontend:3000
}
}
@@ -8,7 +8,8 @@
"description": "Blog article" "description": "Blog article"
}, },
"options": { "options": {
"draftAndPublish": true "draftAndPublish": true,
"populateCreatorFields": true
}, },
"attributes": { "attributes": {
"title": { "title": {
+18
View File
@@ -0,0 +1,18 @@
# Local testing without domains or TLS: publishes the app ports on localhost and
# leaves Caddy out. Never used in production — it must be passed explicitly:
# docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build cms frontend
services:
database:
ports:
- "127.0.0.1:5432:5432"
cms:
ports:
- "127.0.0.1:1337:1337"
frontend:
ports:
- "127.0.0.1:3000:3000"
environment:
NUXT_PUBLIC_SITE_URL: http://localhost:3000
NUXT_PUBLIC_STRAPI_URL: http://localhost:1337
+81
View File
@@ -0,0 +1,81 @@
services:
database:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
cms:
build: ./cms
restart: unless-stopped
depends_on:
database:
condition: service_healthy
environment:
NODE_ENV: production
HOST: 0.0.0.0
PORT: 1337
DATABASE_CLIENT: postgres
DATABASE_HOST: database
DATABASE_PORT: 5432
DATABASE_NAME: ${POSTGRES_DB}
DATABASE_USERNAME: ${POSTGRES_USER}
DATABASE_PASSWORD: ${POSTGRES_PASSWORD}
APP_KEYS: ${APP_KEYS}
API_TOKEN_SALT: ${API_TOKEN_SALT}
ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
TRANSFER_TOKEN_SALT: ${TRANSFER_TOKEN_SALT}
JWT_SECRET: ${JWT_SECRET}
ENCRYPTION_KEY: ${ENCRYPTION_KEY}
volumes:
- cms-uploads:/app/public/uploads
frontend:
build: ./frontend
restart: unless-stopped
depends_on:
- cms
environment:
NODE_ENV: production
HOST: 0.0.0.0
PORT: 3000
NUXT_STRAPI_URL: ${STRAPI_URL}
NUXT_PUBLIC_SITE_URL: ${PUBLIC_SITE_URL}
NUXT_PUBLIC_STRAPI_URL: ${PUBLIC_STRAPI_URL}
caddy:
image: caddy:2-alpine
restart: unless-stopped
depends_on:
- frontend
- cms
ports:
- "80:80"
- "443:443"
# Host uses systemd-resolved (127.0.0.53), unreachable from inside the
# container network namespace; ACME lookups need a real resolver.
dns:
- 1.1.1.1
- 8.8.8.8
environment:
PUBLIC_DOMAIN: ${PUBLIC_DOMAIN}
ACME_EMAIL: ${ACME_EMAIL}
volumes:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile:ro
- caddy-data:/data
- caddy-config:/config
volumes:
postgres-data:
cms-uploads:
caddy-data:
caddy-config:
+6
View File
@@ -0,0 +1,6 @@
node_modules
.nuxt
.output
.data
.env
.git
+24
View File
@@ -0,0 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist
# Node dependencies
node_modules
# Logs
logs
*.log
# Misc
.DS_Store
.fleet
.idea
# Local env files
.env
.env.*
!.env.example
+14
View File
@@ -0,0 +1,14 @@
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/.output /app/.output
USER node
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]
+75
View File
@@ -0,0 +1,75 @@
# Nuxt Minimal Starter
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
## Setup
Make sure to install dependencies:
```bash
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
# bun
bun install
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# npm
npm run dev
# pnpm
pnpm dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```bash
# npm
npm run build
# pnpm
pnpm build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```bash
# npm
npm run preview
# pnpm
pnpm preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
+8
View File
@@ -0,0 +1,8 @@
<template>
<div>
<NuxtRouteAnnouncer />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</div>
</template>
+238
View File
@@ -0,0 +1,238 @@
:root {
/* Neutral editorial palette: warm off-white paper, near-black ink. */
--color-ink: #14130f;
--color-body: #3d3a34;
--color-muted: #857f74;
--color-bg: #fbfaf7;
--color-surface: #f1efe9;
--color-border: #e0ddd4;
--color-rule: #14130f;
--font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
--font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--width: 76rem;
--width-prose: 40rem;
--radius: 2px;
/* Breakpoints used throughout: 48rem = tablet, 64rem = desktop. */
--space: 1.1rem;
--gap-section: 2.5rem;
}
@media (min-width: 48rem) {
:root {
--space: 1.5rem;
--gap-section: 4rem;
}
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
margin: 0;
color: var(--color-body);
background: var(--color-bg);
font-family: var(--font-sans);
font-size: 1rem;
line-height: 1.7;
-webkit-font-smoothing: antialiased;
}
img {
display: block;
max-width: 100%;
height: auto;
}
a {
color: inherit;
}
h1,
h2,
h3 {
margin: 0;
color: var(--color-ink);
font-family: var(--font-display);
font-weight: 400;
line-height: 1.2;
text-wrap: balance;
}
:focus-visible {
outline: 2px solid var(--color-ink);
outline-offset: 3px;
}
.container {
width: 100%;
max-width: var(--width);
margin-inline: auto;
padding-inline: var(--space);
}
.skip-link {
position: absolute;
left: -9999px;
}
.skip-link:focus {
left: var(--space);
top: var(--space);
z-index: 10;
padding: 0.5rem 0.75rem;
background: var(--color-bg);
border: 1px solid var(--color-ink);
}
.muted {
color: var(--color-muted);
}
/* Small uppercase label used for categories, dates and section headings. */
.kicker {
margin: 0;
font-family: var(--font-sans);
font-size: 0.7rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--color-muted);
}
.section-heading {
display: flex;
align-items: center;
gap: 1.25rem;
margin-block: var(--gap-section) 1.75rem;
}
.section-heading::after {
content: "";
flex: 1;
height: 1px;
background: var(--color-border);
}
/* Centred title block at the top of a listing page. */
.page-header {
margin-bottom: var(--gap-section);
padding-bottom: 1.75rem;
text-align: center;
border-bottom: 1px solid var(--color-border);
}
.page-header h1 {
font-size: clamp(2rem, 5vw, 3rem);
}
.page-header .kicker {
margin-bottom: 0.75rem;
}
.card-grid {
display: grid;
gap: 2.25rem 1.5rem;
/* One column on phones, two on tablets, three or more on wide screens. */
grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
padding: 0;
margin: 0;
list-style: none;
}
@media (min-width: 48rem) {
.card-grid {
gap: 3rem 2.5rem;
}
}
/* Article body */
.prose {
max-width: var(--width-prose);
font-size: 1.0125rem;
/* Editors paste long URLs; without this they push the page sideways. */
overflow-wrap: break-word;
}
@media (min-width: 48rem) {
.prose {
font-size: 1.075rem;
}
}
/* Markdown tables have no wrapper to scroll, so the table scrolls itself. */
.prose table {
display: block;
max-width: 100%;
overflow-x: auto;
border-collapse: collapse;
}
.prose h2,
.prose h3 {
margin-block: 2.5rem 0.75rem;
}
.prose h2 {
font-size: 1.6rem;
}
.prose h3 {
font-size: 1.25rem;
}
.prose p,
.prose ul,
.prose ol {
margin-block: 0 1.4rem;
}
.prose a {
text-decoration: underline;
text-underline-offset: 0.2em;
}
.prose blockquote {
margin: 2.5rem 0;
padding-left: 1.5rem;
border-left: 2px solid var(--color-ink);
font-family: var(--font-display);
font-size: 1.3rem;
line-height: 1.45;
color: var(--color-ink);
}
.prose img {
margin-block: 2rem;
}
.prose pre {
overflow-x: auto;
padding: 1rem 1.25rem;
background: var(--color-surface);
border-radius: var(--radius);
font-size: 0.9rem;
}
.prose code {
font-size: 0.9em;
}
.pagination {
display: flex;
flex-wrap: wrap;
gap: 1rem 2rem;
align-items: center;
justify-content: center;
margin-top: var(--gap-section);
padding-top: 2rem;
border-top: 1px solid var(--color-border);
font-size: 0.85rem;
letter-spacing: 0.06em;
text-transform: uppercase;
}
+91
View File
@@ -0,0 +1,91 @@
<script setup lang="ts">
import type { ArticleSummary } from '#shared/types/blog'
const props = defineProps<{ article: ArticleSummary }>()
const mediaUrl = useMediaUrl()
const cover = computed(() => mediaUrl(props.article.cover))
</script>
<template>
<article class="card">
<!-- No placeholder box when there is no cover: an empty grey rectangle
reads as a broken image rather than as a deliberate choice. -->
<NuxtLink
v-if="cover"
class="cover-link"
:to="`/blog/${article.slug}`"
tabindex="-1"
aria-hidden="true"
>
<img
class="cover"
:src="cover"
:alt="article.cover?.alternativeText ?? ''"
:width="article.cover?.width ?? undefined"
:height="article.cover?.height ?? undefined"
loading="lazy"
>
</NuxtLink>
<p v-if="article.category" class="kicker">{{ article.category.name }}</p>
<h2>
<NuxtLink :to="`/blog/${article.slug}`">{{ article.title }}</NuxtLink>
</h2>
<p class="kicker date">
<time :datetime="isoDate(article.publishedAt)">
{{ formatDate(article.publishedAt) }}
</time>
</p>
</article>
</template>
<style scoped>
.cover-link {
display: block;
overflow: hidden;
}
.cover {
width: 100%;
aspect-ratio: 4 / 5;
object-fit: cover;
background: var(--color-surface);
transition: transform 0.4s ease;
}
.cover-link:hover .cover {
transform: scale(1.03);
}
/* Without a cover the kicker leads the card, so it needs no offset. */
.cover-link + .kicker,
.cover-link + h2 {
margin-top: 1.1rem;
}
h2 {
margin-top: 0.5rem;
font-size: 1.35rem;
}
h2 a {
text-decoration: none;
background-image: linear-gradient(var(--color-ink), var(--color-ink));
background-size: 0 1px;
background-position: 0 100%;
background-repeat: no-repeat;
transition: background-size 0.3s ease;
}
h2 a:hover {
background-size: 100% 1px;
}
.date {
margin-top: 0.6rem;
font-weight: 400;
}
</style>
+38
View File
@@ -0,0 +1,38 @@
<script setup lang="ts">
// The official brand marks, inlined at build time from the simple-icons
// package (CC0) rather than redrawn here. Importing the three files directly
// keeps the other ~3000 icons out of the bundle.
import facebookMark from 'simple-icons/icons/facebook.svg?raw'
import instagramMark from 'simple-icons/icons/instagram.svg?raw'
import xMark from 'simple-icons/icons/x.svg?raw'
const MARKS = {
X: xMark,
Instagram: instagramMark,
Facebook: facebookMark,
} as const
const props = defineProps<{ name: keyof typeof MARKS }>()
const mark = computed(() => MARKS[props.name])
</script>
<template>
<!-- eslint-disable-next-line vue/no-v-html -- build-time asset, not user input -->
<span class="icon" aria-hidden="true" v-html="mark" />
</template>
<style scoped>
.icon {
flex: none;
display: inline-flex;
width: 0.95rem;
height: 0.95rem;
}
.icon :deep(svg) {
width: 100%;
height: 100%;
fill: currentColor;
}
</style>
+14
View File
@@ -0,0 +1,14 @@
import type { StrapiImage } from '#shared/types/blog'
/**
* Strapi returns media paths relative to its own origin; the browser needs
* absolute ones. Remote providers (S3) already return absolute URLs.
*/
export function useMediaUrl() {
const { public: config } = useRuntimeConfig()
return (image: StrapiImage | null | undefined): string | null => {
if (!image?.url) return null
return image.url.startsWith('http') ? image.url : `${config.strapiUrl}${image.url}`
}
}
+25
View File
@@ -0,0 +1,25 @@
<script setup lang="ts">
import type { NuxtError } from '#app'
const props = defineProps<{ error: NuxtError }>()
const isNotFound = computed(() => props.error.statusCode === 404)
useSeoMeta({ robots: 'noindex' })
</script>
<template>
<NuxtLayout>
<h1>{{ isNotFound ? 'Pagina non trovata' : 'Qualcosa è andato storto' }}</h1>
<p class="muted">
{{ isNotFound
? 'La pagina che cerchi non esiste o è stata spostata.'
: 'Riprova tra qualche istante.' }}
</p>
<p>
<NuxtLink to="/">Torna alla home</NuxtLink>
</p>
</NuxtLayout>
</template>
+268
View File
@@ -0,0 +1,268 @@
<script setup lang="ts">
</script>
<template>
<div class="page">
<a class="skip-link" href="#main">Vai al contenuto</a>
<header class="site-header">
<div class="container">
<p class="wordmark">
<NuxtLink to="/">
<img src="/logo.png" :alt="SITE_NAME" width="400" height="400">
</NuxtLink>
</p>
<p class="tagline kicker">Articoli, guide e analisi.</p>
</div>
<nav class="site-nav" aria-label="Navigazione principale">
<div class="container nav-inner">
<ul>
<li><NuxtLink to="/">Home</NuxtLink></li>
<li><NuxtLink to="/blog">Tutti gli articoli</NuxtLink></li>
<li><NuxtLink to="/come-difendersi-dal-corralito">Come difendersi dal corralito</NuxtLink></li>
</ul>
</div>
</nav>
</header>
<main id="main" class="container site-main">
<slot />
</main>
<footer class="site-footer">
<div class="container footer-inner">
<div class="footer-block">
<img class="footer-logo" src="/logo.png" :alt="SITE_NAME" width="400" height="400">
<p class="muted">Articoli, guide e analisi.</p>
<address class="contact">
Contatti:
<a :href="`mailto:${SITE_EMAIL}`">{{ SITE_EMAIL }}</a>
</address>
</div>
<nav class="footer-block" aria-label="Naviga">
<p class="kicker">Naviga</p>
<ul>
<li><NuxtLink to="/">Home</NuxtLink></li>
<li><NuxtLink to="/blog">Tutti gli articoli</NuxtLink></li>
<li><NuxtLink to="/come-difendersi-dal-corralito">Come difendersi dal corralito</NuxtLink></li>
</ul>
</nav>
<nav class="footer-block" aria-label="Seguici">
<p class="kicker">Seguici</p>
<ul>
<li v-for="social in SOCIAL_LINKS" :key="social.name">
<a class="social" :href="social.url" target="_blank" rel="noopener me">
<SocialIcon :name="social.name" />
<span>{{ social.name }}</span>
</a>
</li>
</ul>
</nav>
</div>
<p class="container copyright kicker">
&copy; {{ new Date().getFullYear() }} {{ SITE_NAME }}. Tutti i diritti riservati.
</p>
</footer>
</div>
</template>
<style scoped>
.page {
display: flex;
flex-direction: column;
min-height: 100vh;
}
/* Header: centred wordmark over a thin rule of links. */
.site-header {
padding-top: 1.5rem;
text-align: center;
border-bottom: 1px solid var(--color-border);
}
@media (min-width: 48rem) {
.site-header {
padding-top: 2.5rem;
}
}
.wordmark {
margin: 0;
}
.wordmark a {
display: inline-block;
text-decoration: none;
}
/* The seal carries the name itself, so it stands in for a text wordmark. */
.wordmark img {
width: clamp(6rem, 14vw, 8.5rem);
height: auto;
}
.tagline {
margin-top: 0.6rem;
}
.site-nav {
margin-top: 1.25rem;
border-top: 1px solid var(--color-border);
}
.nav-inner {
display: flex;
justify-content: center;
padding-block: 0.6rem;
}
.site-nav ul {
display: flex;
flex-wrap: wrap;
gap: 0 1.25rem;
justify-content: center;
padding: 0;
margin: 0;
list-style: none;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
}
@media (min-width: 48rem) {
.site-nav {
margin-top: 2rem;
}
.nav-inner {
padding-block: 0.9rem;
}
.site-nav ul {
gap: 0.25rem 2rem;
}
}
.site-nav a {
display: inline-block;
text-decoration: none;
color: var(--color-body);
/* Roomy enough to tap accurately on a phone. */
padding-block: 0.6rem;
border-bottom: 1px solid transparent;
}
.site-nav a:hover,
.site-nav a.router-link-active {
color: var(--color-ink);
border-bottom-color: var(--color-ink);
}
.site-main {
flex: 1;
padding-block: 2.25rem 3.5rem;
}
@media (min-width: 48rem) {
.site-main {
padding-block: 3.5rem 5rem;
}
}
/* Footer: columns, then a centred copyright line. */
.site-footer {
padding-block: 3.5rem 2rem;
background: var(--color-surface);
border-top: 1px solid var(--color-border);
}
/* One column on phones, two on tablets, four on desktop — auto-fit would
otherwise leave the fourth block stranded on its own row on a tablet. */
.footer-inner {
display: grid;
gap: 2rem;
grid-template-columns: 1fr;
padding-bottom: 2.5rem;
}
@media (min-width: 48rem) {
.footer-inner {
grid-template-columns: repeat(2, 1fr);
gap: 2.5rem;
}
}
@media (min-width: 64rem) {
.footer-inner {
grid-template-columns: repeat(4, 1fr);
}
}
.footer-block p:last-of-type {
margin-bottom: 0;
}
.footer-logo {
width: 4.5rem;
height: auto;
margin-bottom: 1rem;
}
.contact {
margin-top: 0.75rem;
font-size: 0.95rem;
font-style: normal;
}
.contact a {
text-decoration: underline;
text-underline-offset: 0.2em;
}
.footer-block ul {
padding: 0;
margin: 0.9rem 0 0;
list-style: none;
font-size: 0.95rem;
}
.footer-block li + li {
margin-top: 0.35rem;
}
.footer-block a {
text-decoration: none;
}
.footer-block a:hover {
text-decoration: underline;
text-underline-offset: 0.2em;
}
.social {
display: inline-flex;
align-items: center;
gap: 0.55rem;
}
/* Keep the underline on the label, not stretched across the icon. */
.social:hover {
text-decoration: none;
}
.social:hover span {
text-decoration: underline;
text-underline-offset: 0.2em;
}
.copyright {
padding-top: 1.75rem;
text-align: center;
border-top: 1px solid var(--color-border);
}
</style>
+159
View File
@@ -0,0 +1,159 @@
<script setup lang="ts">
import type { Article } from '#shared/types/blog'
const route = useRoute()
const slug = route.params.slug as string
const { data: article } = await useFetch<Article>(`/api/articles/${slug}`)
if (!article.value) {
throw createError({ statusCode: 404, statusMessage: 'Article not found', fatal: true })
}
const { public: config } = useRuntimeConfig()
const mediaUrl = useMediaUrl()
const canonical = `${config.siteUrl}${route.path}`
const cover = computed(() => mediaUrl(article.value?.cover) ?? undefined)
useSeoMeta({
title: article.value.title,
description: article.value.summary,
ogTitle: article.value.title,
ogDescription: article.value.summary,
ogType: 'article',
ogUrl: canonical,
ogImage: cover,
twitterCard: 'summary_large_image',
})
useHead({
link: [{ rel: 'canonical', href: canonical }],
script: [
{
type: 'application/ld+json',
innerHTML: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'BlogPosting',
headline: article.value.title,
description: article.value.summary,
datePublished: isoDate(article.value.publishedAt),
author: article.value.author
? { '@type': 'Person', name: article.value.author }
: undefined,
image: cover.value ? [cover.value] : undefined,
mainEntityOfPage: { '@type': 'WebPage', '@id': canonical },
}),
},
],
})
</script>
<template>
<article v-if="article">
<header class="article-header">
<nav class="kicker" aria-label="Percorso di navigazione">
<NuxtLink to="/blog">Articoli</NuxtLink>
<template v-if="article.category">
<span aria-hidden="true"> / </span>
<NuxtLink :to="`/category/${article.category.slug}`">
{{ article.category.name }}
</NuxtLink>
</template>
</nav>
<h1>{{ article.title }}</h1>
<p class="kicker date">
<time :datetime="isoDate(article.publishedAt)">
{{ formatDateTime(article.publishedAt) }}
</time>
<template v-if="article.author">
<span aria-hidden="true"> · </span>
<span>Di {{ article.author }}</span>
</template>
</p>
</header>
<img
v-if="cover"
class="cover"
:src="cover"
:alt="article.cover?.alternativeText ?? ''"
:width="article.cover?.width ?? undefined"
:height="article.cover?.height ?? undefined"
>
<!-- eslint-disable-next-line vue/no-v-html -- rendered server-side from editor Markdown -->
<div class="prose" v-html="article.html" />
<p class="back">
<NuxtLink to="/blog">Torna a tutti gli articoli</NuxtLink>
</p>
</article>
</template>
<style scoped>
.article-header {
max-width: 46rem;
/* The gap below the header lives here, not on the cover: an article without
a cover image would otherwise have its body butting against the byline. */
margin: 0 auto 2rem;
text-align: center;
}
@media (min-width: 48rem) {
.article-header {
margin-bottom: 3rem;
}
}
.article-header nav a {
text-decoration: none;
}
.article-header nav a:hover {
text-decoration: underline;
text-underline-offset: 0.2em;
}
h1 {
margin: 1rem 0 0;
font-size: clamp(2rem, 5vw, 3.2rem);
}
.date {
margin-top: 1rem;
font-weight: 400;
}
.prose {
margin-inline: auto;
}
.back {
max-width: var(--width-prose);
margin: 4rem auto 0;
padding-top: 2rem;
border-top: 1px solid var(--color-border);
text-align: center;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.back a {
text-decoration: none;
border-bottom: 1px solid var(--color-ink);
padding-bottom: 0.3rem;
}
.cover {
width: 100%;
aspect-ratio: 3 / 2;
object-fit: cover;
margin-block: 0 3rem;
background: var(--color-surface);
}
</style>
+66
View File
@@ -0,0 +1,66 @@
<script setup lang="ts">
import type { ArticleSummary, Paginated } from '#shared/types/blog'
const route = useRoute()
const page = computed(() => {
const value = Number(route.query.page)
return Number.isInteger(value) && value > 0 ? value : 1
})
const { data, error, status } = await useFetch<Paginated<ArticleSummary>>('/api/articles', {
query: { page },
})
const { public: config } = useRuntimeConfig()
const canonical = computed(
() => `${config.siteUrl}${route.path}${page.value > 1 ? `?page=${page.value}` : ''}`
)
useSeoMeta({
title: () => (page.value > 1 ? `Articoli — pagina ${page.value}` : 'Articoli'),
description: 'Tutti gli articoli pubblicati sul blog.',
ogType: 'website',
})
useHead({ link: [{ rel: 'canonical', href: canonical }] })
</script>
<template>
<div>
<header class="page-header">
<p class="kicker">L'archivio</p>
<h1>Articoli</h1>
</header>
<p v-if="error">Non è stato possibile caricare gli articoli. Riprova più tardi.</p>
<p v-else-if="status === 'pending'">Caricamento…</p>
<p v-else-if="!data?.items.length">Non è stato ancora pubblicato nulla.</p>
<template v-else>
<ul class="card-grid">
<li v-for="article in data.items" :key="article.slug">
<ArticleCard :article="article" />
</li>
</ul>
<nav v-if="data.pageCount > 1" class="pagination" aria-label="Paginazione">
<NuxtLink v-if="data.page > 1" :to="{ query: { page: data.page - 1 } }" rel="prev">
Pagina precedente
</NuxtLink>
<span class="muted">
Pagina {{ data.page }} di {{ data.pageCount }}
</span>
<NuxtLink
v-if="data.page < data.pageCount"
:to="{ query: { page: data.page + 1 } }"
rel="next"
>
Pagina successiva
</NuxtLink>
</nav>
</template>
</div>
</template>
+71
View File
@@ -0,0 +1,71 @@
<script setup lang="ts">
import type { ArticleSummary, Paginated, Category } from '#shared/types/blog'
const route = useRoute()
const slug = route.params.slug as string
const page = computed(() => {
const value = Number(route.query.page)
return Number.isInteger(value) && value > 0 ? value : 1
})
const { data: category } = await useFetch<Category>(`/api/categories/${slug}`)
if (!category.value) {
throw createError({ statusCode: 404, statusMessage: 'Category not found', fatal: true })
}
const { data, error } = await useFetch<Paginated<ArticleSummary>>('/api/articles', {
query: { page, category: slug },
})
const { public: config } = useRuntimeConfig()
const canonical = computed(
() => `${config.siteUrl}${route.path}${page.value > 1 ? `?page=${page.value}` : ''}`
)
useSeoMeta({
title: category.value.name,
description: () => `Tutti gli articoli nella categoria ${category.value?.name ?? ''}.`,
ogType: 'website',
})
useHead({ link: [{ rel: 'canonical', href: canonical }] })
</script>
<template>
<div>
<header class="page-header">
<p class="kicker">Categoria</p>
<h1>{{ category?.name }}</h1>
</header>
<p v-if="error">Non è stato possibile caricare gli articoli. Riprova più tardi.</p>
<p v-else-if="!data?.items.length">Non ci sono articoli in questa categoria.</p>
<template v-else>
<ul class="card-grid">
<li v-for="article in data.items" :key="article.slug">
<ArticleCard :article="article" />
</li>
</ul>
<nav v-if="data.pageCount > 1" class="pagination" aria-label="Paginazione">
<NuxtLink v-if="data.page > 1" :to="{ query: { page: data.page - 1 } }" rel="prev">
Pagina precedente
</NuxtLink>
<span class="muted">
Pagina {{ data.page }} di {{ data.pageCount }}
</span>
<NuxtLink
v-if="data.page < data.pageCount"
:to="{ query: { page: data.page + 1 } }"
rel="next"
>
Pagina successiva
</NuxtLink>
</nav>
</template>
</div>
</template>
@@ -0,0 +1,132 @@
<script setup lang="ts">
const { public: config } = useRuntimeConfig()
const route = useRoute()
const canonical = computed(() => `${config.siteUrl}${route.path}`)
const title = 'Corsi di formazione sulle criptovalute'
const description = 'Corsi pratici, individuali o di gruppo, per capire come funzionano le criptovalute e difendersi dal corralito.'
useSeoMeta({
title,
description,
ogTitle: title,
ogDescription: description,
ogType: 'website',
ogUrl: canonical,
ogImage: `${config.siteUrl}/protesta-bancaria.jpg`,
})
useHead({ link: [{ rel: 'canonical', href: canonical }] })
</script>
<template>
<article>
<header class="article-header">
<h1>Come difendersi dal corralito</h1>
</header>
<img
class="cover"
src="/protesta-bancaria.jpg"
alt="Manifesti e scritte contro le banche durante una crisi bancaria"
width="770"
height="420"
>
<div class="prose">
<p>
Stai pensando di avvicinarti al mondo delle criptovalute (un mercato parallelo al
mercato tradizionale finanziario), ma non sai da dove cominciare?
</p>
<p>
È possibile organizzare corsi individuali o di gruppo dedicati alla conoscenza e al
funzionamento delle criptovalute, con un approccio prevalentemente pratico e senza
fornire consigli o raccomandazioni finanziarie.
</p>
<p>Durante il corso possiamo affrontare, tra gli altri, questi argomenti:</p>
<ul>
<li>quali sono i principali tipi di criptovalute e quali differenze esistono tra loro;</li>
<li>come funziona una blockchain e cosa significa realmente effettuare una transazione;</li>
<li>dove e come vengono conservate le criptovalute: wallet, exchange e sistemi di custodia;</li>
<li>come acquistare e vendere criptovalute e quali sono le principali modalità disponibili;</li>
<li>come utilizzare un wallet e gestire correttamente le proprie chiavi;</li>
<li>quali sono i principali rischi legati alla sicurezza e alla custodia;</li>
<li>come orientarsi nel vastissimo universo delle criptovalute e dei token.</li>
</ul>
<p>
Non si tratta di consulenza finanziaria e non verranno fornite indicazioni su quali
criptovalute acquistare o vendere. L'obiettivo è fornire conoscenze e strumenti per
comprendere questo nuovo mondo e muoversi al suo interno con maggiore consapevolezza.
</p>
</div>
<div class="contact-cta">
<p class="kicker">Per informazioni sui corsi, modalità e disponibilità</p>
<p class="contact-links">
<a :href="`mailto:${SITE_EMAIL}`">Scrivimi via email</a>
<span aria-hidden="true">·</span>
<a href="https://t.me/Ito1505" target="_blank" rel="noopener">Scrivimi su Telegram</a>
</p>
</div>
</article>
</template>
<style scoped>
.article-header {
max-width: 46rem;
margin: 0 auto 2rem;
text-align: center;
}
@media (min-width: 48rem) {
.article-header {
margin-bottom: 3rem;
}
}
.cover {
width: 100%;
aspect-ratio: 16 / 9;
object-fit: cover;
margin-block: 0 3rem;
background: var(--color-surface);
}
.prose {
margin-inline: auto;
}
.contact-cta {
max-width: var(--width-prose);
margin: 3rem auto 0;
padding-top: 2rem;
border-top: 1px solid var(--color-border);
text-align: center;
}
.contact-links {
margin-top: 0.75rem;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.6rem;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.contact-links a {
padding-bottom: 0.35rem;
text-decoration: none;
border-bottom: 1px solid var(--color-ink);
}
.contact-links a:hover {
color: var(--color-ink);
}
</style>
+212
View File
@@ -0,0 +1,212 @@
<script setup lang="ts">
import type { ArticleSummary, Paginated } from '#shared/types/blog'
const { data, error } = await useFetch<Paginated<ArticleSummary>>('/api/articles', {
key: 'home-articles',
query: { page: 1 },
})
const featured = computed(() => data.value?.items[0] ?? null)
const mediaUrl = useMediaUrl()
const featuredCover = computed(() => mediaUrl(featured.value?.cover))
const { public: config } = useRuntimeConfig()
const route = useRoute()
const canonical = computed(() => `${config.siteUrl}${route.path}`)
// The home page is the site itself, so it carries the bare name as its title.
useHead({ titleTemplate: '%s', link: [{ rel: 'canonical', href: canonical }] })
useSeoMeta({
title: SITE_NAME,
description: 'Articoli, guide e analisi.',
ogTitle: SITE_NAME,
ogDescription: 'Articoli, guide e analisi.',
ogType: 'website',
ogUrl: canonical,
ogImage: `${config.siteUrl}/logo.png`,
})
</script>
<template>
<div>
<section class="landing">
<img
class="landing-image"
src="/protesta-bancaria.jpg"
alt="Manifesti e scritte contro le banche durante una crisi bancaria"
width="770"
height="420"
>
<h1>La fine dell'Unione Europea per come l'abbiamo conosciuta.</h1>
<img
class="landing-image"
src="/eurozona-crisi.jpg"
alt="Bandiera dell'Unione Europea incrinata"
width="1000"
height="736"
>
<div class="landing-text">
<p>
La fine della nostra moneta come moneta forte: la fine di quella moneta che ci ha
dato la vera libertà di viaggiare, consumare e fare.
</p>
<p>
Una fine che avverrà a seguito di un "incidente" nucleare, al quale farà seguito un
corralito bancario, ossia l'impossibilità, da parte dei cittadini europei, di
disporre liberamente dei propri depositi.
</p>
<p>
Le monete fiduciarie sono per loro natura cannibalizzanti. Oggi tocca all'euro.
Anche perché le altre hanno praticamente perso tutte tutto.
</p>
</div>
</section>
<p v-if="error">Non è stato possibile caricare gli articoli. Riprova più tardi.</p>
<p v-else-if="!featured">Non è stato ancora pubblicato nulla.</p>
<template v-else>
<article class="featured" :class="{ 'has-cover': featuredCover }">
<NuxtLink
v-if="featuredCover"
class="featured-cover"
:to="`/blog/${featured.slug}`"
tabindex="-1"
aria-hidden="true"
>
<img
:src="featuredCover"
:alt="featured.cover?.alternativeText ?? ''"
:width="featured.cover?.width ?? undefined"
:height="featured.cover?.height ?? undefined"
>
</NuxtLink>
<div class="featured-text">
<p class="kicker">
{{ featured.category ? featured.category.name : 'Ultimo' }}
</p>
<h2>
<NuxtLink :to="`/blog/${featured.slug}`">{{ featured.title }}</NuxtLink>
</h2>
<p class="kicker date">
<time :datetime="isoDate(featured.publishedAt)">
{{ formatDate(featured.publishedAt) }}
</time>
</p>
<p class="read-more">
<NuxtLink :to="`/blog/${featured.slug}`">
Leggi l'ultimo articolo
</NuxtLink>
</p>
</div>
</article>
</template>
</div>
</template>
<style scoped>
.landing {
max-width: var(--width-prose);
margin-inline: auto;
margin-bottom: var(--gap-section);
padding-bottom: var(--gap-section);
border-bottom: 1px solid var(--color-border);
text-align: center;
}
.landing-image {
width: 100%;
aspect-ratio: 16 / 9;
object-fit: cover;
background: var(--color-surface);
}
.landing h1 {
margin-block: 1.75rem;
font-size: clamp(2rem, 4.5vw, 3.1rem);
}
.landing-text {
margin-top: 1.75rem;
text-align: left;
}
.landing-text p {
margin-top: 1.1rem;
}
.featured {
display: grid;
gap: 1.5rem;
align-items: center;
grid-template-columns: 1fr;
}
/* Stacked on phones and portrait tablets — a side-by-side split below this
width leaves both the image and the headline too cramped to read. The split
also needs a cover to sit in it, or one column would just be empty. */
@media (min-width: 64rem) {
.featured.has-cover {
grid-template-columns: 1.35fr 1fr;
gap: 3.5rem;
}
}
/* Without a cover the headline is the whole lead, so it gets the full width
but stays inside a readable measure. */
.featured:not(.has-cover) .featured-text {
max-width: 46rem;
}
.featured-cover {
display: block;
overflow: hidden;
}
.featured-cover img {
width: 100%;
aspect-ratio: 3 / 2;
object-fit: cover;
background: var(--color-surface);
}
.featured h2 {
margin-top: 0.6rem;
font-size: clamp(2rem, 4.5vw, 3.1rem);
}
.featured h2 a {
text-decoration: none;
}
.featured h2 a:hover {
text-decoration: underline;
text-underline-offset: 0.12em;
}
.date {
margin-top: 1rem;
font-weight: 400;
}
.read-more {
margin-top: 1.75rem;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.read-more a {
padding-bottom: 0.35rem;
text-decoration: none;
border-bottom: 1px solid var(--color-ink);
}
</style>
+37
View File
@@ -0,0 +1,37 @@
import { SITE_NAME } from './shared/utils/site'
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2025-07-15',
devtools: { enabled: true },
css: ['~/assets/css/main.css'],
app: {
head: {
htmlAttrs: { lang: 'it' },
titleTemplate: `%s · ${SITE_NAME}`,
meta: [{ name: 'viewport', content: 'width=device-width, initial-scale=1' }],
link: [
{ rel: 'icon', href: '/favicon.ico', sizes: '16x16 32x32 48x48 64x64' },
{ rel: 'apple-touch-icon', href: '/apple-touch-icon.png' },
],
},
},
runtimeConfig: {
// Server-only: internal Strapi address, never exposed to the browser.
strapiUrl: 'http://localhost:1337',
strapiToken: '',
public: {
// Canonical origin of the public website.
siteUrl: 'http://localhost:3000',
// Browser-reachable Strapi origin, used to build absolute media URLs.
strapiUrl: 'http://localhost:1337',
},
},
typescript: {
strict: true,
},
})
+9362
View File
File diff suppressed because it is too large. Load diff
+24
View File
@@ -0,0 +1,24 @@
{
"name": "frontend",
"type": "module",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"typecheck": "nuxt typecheck"
},
"dependencies": {
"marked": "^18.0.11",
"nuxt": "^4.5.2",
"simple-icons": "^16.28.0",
"vue": "^3.5.41",
"vue-router": "^5.2.0"
},
"devDependencies": {
"typescript": "^5.9.3",
"vue-tsc": "^3.3.11"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

+2
View File
@@ -0,0 +1,2 @@
User-Agent: *
Disallow:
@@ -0,0 +1,43 @@
import type { Article } from '#shared/types/blog'
interface AdminUser {
firstname: string | null
lastname: string | null
}
type RawArticle = Omit<Article, 'html' | 'summary' | 'author'> & {
content: string | null
createdBy?: AdminUser | null
}
/** Joins the admin user's name parts; returns null when neither is set. */
function byline(user: AdminUser | null | undefined): string | null {
const name = [user?.firstname, user?.lastname].filter(Boolean).join(' ').trim()
return name || null
}
export default defineEventHandler(async (event): Promise<Article> => {
const slug = getRouterParam(event, 'slug')
if (!slug) {
throw createError({ statusCode: 400, statusMessage: 'Missing article slug' })
}
const response = await strapiFetch<StrapiList<RawArticle>>(
`/api/articles?${ARTICLE_DETAIL_QUERY}&filters[slug][$eq]=${encodeURIComponent(slug)}&pagination[pageSize]=1`
)
const article = response.data[0]
if (!article) {
throw createError({ statusCode: 404, statusMessage: 'Article not found' })
}
const { content, createdBy, ...rest } = article
return {
...rest,
html: renderMarkdown(content),
summary: summarise(content),
author: byline(createdBy),
}
})
+22
View File
@@ -0,0 +1,22 @@
import type { ArticleSummary, Paginated } from '#shared/types/blog'
export default defineEventHandler(async (event): Promise<Paginated<ArticleSummary>> => {
const query = getQuery(event)
const page = pageParam(query.page)
const category = typeof query.category === 'string' ? query.category : null
const filter = category
? `&filters[category][slug][$eq]=${encodeURIComponent(category)}`
: ''
const response = await strapiFetch<StrapiList<ArticleSummary>>(
`/api/articles?${ARTICLE_SUMMARY_QUERY}&${pagination(page)}${filter}`
)
return {
items: response.data,
page: response.meta.pagination.page,
pageCount: response.meta.pagination.pageCount,
total: response.meta.pagination.total,
}
})
@@ -0,0 +1,21 @@
import type { Category } from '#shared/types/blog'
export default defineEventHandler(async (event): Promise<Category> => {
const slug = getRouterParam(event, 'slug')
if (!slug) {
throw createError({ statusCode: 400, statusMessage: 'Missing category slug' })
}
const response = await strapiFetch<StrapiList<Category>>(
`/api/categories?fields[0]=name&fields[1]=slug&filters[slug][$eq]=${encodeURIComponent(slug)}&pagination[pageSize]=1`
)
const category = response.data[0]
if (!category) {
throw createError({ statusCode: 404, statusMessage: 'Category not found' })
}
return category
})
@@ -0,0 +1,9 @@
import type { Category } from '#shared/types/blog'
export default defineEventHandler(async (): Promise<Category[]> => {
const response = await strapiFetch<StrapiList<Category>>(
'/api/categories?fields[0]=name&fields[1]=slug&sort[0]=name:asc&pagination[pageSize]=100'
)
return response.data
})
+33
View File
@@ -0,0 +1,33 @@
/** Strapi query fragments. Only the fields the pages actually render are requested. */
const list = (prefix: string, names: readonly string[]) =>
names.map((name, i) => `${prefix}[${i}]=${name}`).join('&')
const IMAGE_FIELDS = ['url', 'alternativeText', 'width', 'height'] as const
export const ARTICLE_SUMMARY_QUERY = [
list('fields', ['title', 'slug', 'publishedAt']),
list('populate[cover][fields]', IMAGE_FIELDS),
list('populate[category][fields]', ['name', 'slug']),
'sort[0]=publishedAt:desc',
].join('&')
export const ARTICLE_DETAIL_QUERY = [
list('fields', ['title', 'slug', 'content', 'publishedAt']),
list('populate[cover][fields]', IMAGE_FIELDS),
list('populate[category][fields]', ['name', 'slug']),
// The byline is the admin user who created the entry; Strapi exposes the
// name fields only because the content type sets populateCreatorFields.
list('populate[createdBy][fields]', ['firstname', 'lastname']),
].join('&')
export const PAGE_SIZE = 12
export const pagination = (page: number, pageSize = PAGE_SIZE) =>
`pagination[page]=${page}&pagination[pageSize]=${pageSize}`
/** Reads a positive integer query param, falling back to 1. */
export const pageParam = (value: unknown): number => {
const page = Number(value)
return Number.isInteger(page) && page > 0 ? page : 1
}
+54
View File
@@ -0,0 +1,54 @@
import { marked } from 'marked'
/**
* Calls the Strapi REST API from the server only, so the internal URL and any
* future API token never reach the browser.
*/
export async function strapiFetch<T>(path: string): Promise<T> {
const { strapiUrl, strapiToken } = useRuntimeConfig()
try {
return (await $fetch(path, {
baseURL: strapiUrl,
headers: strapiToken ? { Authorization: `Bearer ${strapiToken}` } : undefined,
})) as T
} catch (error) {
console.error(`Strapi request failed: ${path}`, error)
throw createError({ statusCode: 502, statusMessage: 'Content service unavailable' })
}
}
/**
* Renders the Markdown body server-side, so the HTML is crawlable and `marked`
* stays out of the client bundle.
*
* ponytail: no HTML sanitisation — article bodies come from authenticated
* editors only. Add DOMPurify here if authoring is ever opened up further.
*/
export function renderMarkdown(source: string | null | undefined): string {
return source ? (marked.parse(source, { async: false }) as string) : ''
}
/**
* There is no excerpt field: the meta description is the opening of the body,
* stripped of Markdown syntax and clipped on a word boundary.
*/
export function summarise(source: string | null | undefined, maxLength = 155): string {
const text = (source ?? '')
.replace(/```[\s\S]*?```/g, ' ')
.replace(/!\[[^\]]*\]\([^)]*\)/g, ' ')
.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
.replace(/[#>*_`~-]/g, ' ')
.replace(/\s+/g, ' ')
.trim()
if (text.length <= maxLength) return text
const clipped = text.slice(0, maxLength)
return `${clipped.slice(0, clipped.lastIndexOf(' ')).trimEnd()}…`
}
export interface StrapiList<T> {
data: T[]
meta: { pagination: { page: number; pageCount: number; total: number } }
}
+38
View File
@@ -0,0 +1,38 @@
/** Shape of the Strapi payloads, narrowed to what the site actually renders. */
export interface StrapiImage {
url: string
alternativeText: string | null
width: number | null
height: number | null
}
export interface Category {
name: string
slug: string
}
/** An article as returned by the listing endpoints. */
export interface ArticleSummary {
title: string
slug: string
publishedAt: string
cover: StrapiImage | null
category: Category | null
}
/** A single article, with the body already rendered to HTML server-side. */
export interface Article extends ArticleSummary {
html: string
/** Plain-text opening of the body, used as the meta description. */
summary: string
/** Byline: the full name of the admin user who wrote the article. */
author: string | null
}
export interface Paginated<T> {
items: T[]
page: number
pageCount: number
total: number
}
+17
View File
@@ -0,0 +1,17 @@
/** Human-readable date for display; returns an empty string when unset. */
export function formatDate(value: string | null | undefined): string {
if (!value) return ''
return new Intl.DateTimeFormat('it-IT', { dateStyle: 'long' }).format(new Date(value))
}
/** Date and time of publication, shown in the article byline. */
export function formatDateTime(value: string | null | undefined): string {
if (!value) return ''
return new Intl.DateTimeFormat('it-IT', { dateStyle: 'long', timeStyle: 'short' })
.format(new Date(value))
}
/** Machine-readable date for the `datetime` attribute and structured data. */
export function isoDate(value: string | null | undefined): string {
return value ? new Date(value).toISOString() : ''
}
+12
View File
@@ -0,0 +1,12 @@
/** Name of the blog. Not translated: it is the brand. */
export const SITE_NAME = 'CorralitoComing'
/** Public contact address, shown in the footer. */
export const SITE_EMAIL = 'corralitocoming@gmail.com'
/** Social profiles listed in the footer. Names are brands, so untranslated. */
export const SOCIAL_LINKS = [
{ name: 'X', url: 'https://x.com/CORRALITOCOMING' },
{ name: 'Instagram', url: 'https://www.instagram.com/corralitocoming' },
{ name: 'Facebook', url: 'https://www.facebook.com/share/1JwXwQWyQA/' },
] as const
+18
View File
@@ -0,0 +1,18 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"files": [],
"references": [
{
"path": "./.nuxt/tsconfig.app.json"
},
{
"path": "./.nuxt/tsconfig.server.json"
},
{
"path": "./.nuxt/tsconfig.shared.json"
},
{
"path": "./.nuxt/tsconfig.node.json"
}
]
}