Data & Persistence
The website is not just static; it manages dynamic content via Prisma ORM.
Schema (prisma/schema.prisma)
1. Blog Post (BlogPost)
Since we want editorial freedom without a headless CMS subscription, we built a simple CMS.
slug: Unique URL identifier.content: Markdown or HTML content.featured_image: URL to bucket.
2. Contacts (Contact)
Every contact form submission is:
- Saved to DB for redundancy.
- Emailed via SMTP.
Database Migration
We use a specific Docker pattern for migrations. In docker-compose.yml, a transient service migrate (built from the same Dockerfile, e.g. target builder) runs before the web app starts.
services:
migrate:
build:
context: .
dockerfile: Dockerfile
target: builder
command: ["npx", "prisma", "db", "push"]
restart: "no"
web:
depends_on:
migrate:
condition: service_completed_successfully
This ensures the schema is always in sync with the code deployment.