Skip to content

Marek.media — portfolio & CMS

Full-stack monorepo: a Next.js website, a React admin and a NestJS API on PostgreSQL. A custom bilingual headless CMS running on free tier

Motivation

For a developer, a portfolio is a business card, but a static template only shows the frontend. The goal was a website that itself demonstrates the design and build of a complete application: database, API, AI admin, deployment and operations. The project is therefore primarily a showcase.

At the same time, it has to work as a real product, not just a demo:

  • content editable without a deploy, in Czech and English,

  • draft previews before publishing,

  • a fast static website that refreshes itself when content changes,

  • running costs of a few dollars a month, with no dependency on a single provider.

An off-the-shelf CMS would cover most of this, but it would dictate the data model, API and permissions, and it would mainly show work with someone else's tool. That is why the entire stack is custom.


Originality

A premium service deserves original design, not the output of a prompt. Generative AI can now produce a website from a few prompts, and it shows: the same gradients, the same illustrations, the same layouts, graphics without an idea. AI slop.

Here, AI is a tool, not the author. The design and architecture are original work. Instead of a boring hero section, you can play a jump-and-run mini-game.

image.png

SEO and performance

ISR with on-demand revalidation, WebP image variants from a CDN, Redis cache, canonical and hreflang, Open Graph, JSON-LD, a generated sitemap, 308 redirects.

In plain terms: the website loads fast even on mobile, content changes appear immediately, and search engines display it correctly in both languages.

image.png

image.png

Architecture

A Turborepo with pnpm workspaces and three apps, each with production and staging:

App

Stack

Hosting

Website (marek.media)

Next.js (App Router, ISR, draft mode), React, Tailwind

Vercel

Admin (adm.marek.media)

React SPA, Vite, TanStack Router and Query, shadcn/ui, TipTap

Cloudflare Pages

API (api.marek.media)

NestJS, Prisma, PostgreSQL, BullMQ, Swagger

Railway (Docker)

Infrastructure: PostgreSQL on Neon, Redis (Valkey) on Aiven, files in Cloudflare R2, email via Resend. Shared packages hold design tokens and utilities. A typed API client for both the website and the admin is generated from the Swagger schema (Kubb), so any change to the API contract shows up in the frontend types immediately.

The API has 24 Prisma models and 7 native PostgreSQL enums. Beyond content CRUD, it handles RBAC, an audit log, soft delete with a trash bin, redirects from old slugs, signed draft previews and background processing of images into WebP variants. The admin includes the AURORA AI assistant with 94 server-side tools built on the same services as the REST API.

Key decisions and trade-offs

Decision

Reason

Trade-off

Custom headless CMS vs Strapi / Payload

The project is primarily a showcase: the whole stack from database to frontend is original work, and the data model, API and permissions fit the website's needs exactly.

Features an off-the-shelf CMS has built in (trash, previews, roles) have to be written and maintained.

Free tiers (Neon, Vercel, Cloudflare, Aiven, Resend) and Railway for USD 5 a month

Near-zero running costs.

Tier limits, database cold starts and more services to manage.

Cloudflare R2 vs AWS S3

S3-compatible API and zero egress fees, which matters for an image-heavy website.

A smaller ecosystem of surrounding services than AWS.

Resend vs Mailgun

A more modern API and simpler integration.

The free tier is limited to 3,000 emails a month.

Railway vs Render (free)

The API runs continuously. A free Render service spins down after 15 minutes without traffic, takes about a minute to wake up, and the BullMQ workers would stop with it.

Railway isn't free; it costs USD 5 a month.

Aiven Valkey vs Upstash

BullMQ workers generate Redis traffic even on an empty queue. Upstash bills per command, and the free limit of 500,000 commands a month would run out within days. Aiven's Valkey doesn't count commands and is fully Redis-compatible.

The free tier doesn't let you choose a region.

Turborepo vs Nx

Three apps need minimal configuration.

None with three apps. Nx's advantages (generators, module boundaries, automated upgrades) only pay off in a large monorepo.

Types generated from OpenAPI vs shared Zod schemas

Form validation differs from API validation, and the shared schemas covered only a fraction of cases. The API is the source of truth; types are generated from it via Swagger (Kubb).

Frontend form validation (Zod) is separate and has to match the API's validation.

Prisma vs TypeORM

Type-safe queries and the schema in one place.

Some database constraints can't be expressed in the Prisma schema and live in SQL migrations.

Tests, CI and deployment

  • CI on every pull request: lint, typecheck, unit tests, API e2e tests with Jest and Supertest against real PostgreSQL and Redis (Testcontainers), visual regression tests of Storybook in Chromatic, automated code review (CodeRabbit).

  • Development with AI agents. Code is written with the help of AI agents (Claude Code) that follow rules and plans stored in the repository itself. Automatic tests monitor everything important.

image.png