KICOM
Bilingual agency site with a CMS that runs on the client's laptops.
- Web products
- SaaS platforms
- Role
- Sole engineer: site, CMS, media pipeline and delivery
- Client
- KICOM (Ki Com & Events), event and communication agency, Tunis
- Timeline
- Dec 2025 - Oct 2026
- Status
- Live in productionkicom.com.tn

- web MP4 from a 48.9 MB 4K test clip, poster and preview included
- 3.1 MB
- web MP4 from a 48.9 MB 4K test clip, poster and preview included
- visible texts audited for CMS coverage
- 440
- visible texts audited for CMS coverage
- gallery items and client logos moved into the CMS
- 66 + 53
- gallery items and client logos moved into the CMS
- commits, 18 merged pull requests
- 75
- commits, 18 merged pull requests
The problem
KICOM is a three-person event and communication agency in Tunis with four departments: events, video production, strategic communication and digital marketing. Its portfolio is heavy, with 4K video, 21-33 MP photos and about 50 client logos. The agency wanted a bilingual site, French first, and then the ability to edit every text, photo and video itself.
The hard constraint was hosting. The client would not pay for a server and had no machine that stays on. Railway rejected the available card, and Render's only option was a $25 a month plan. Uploaded videos still had to be transcoded and photos resized, and Vercel functions cannot run ffmpeg.
Architecture
Edit on a laptop
Staff double-click a launcher. It pulls the latest image from GHCR, starts Payload in Docker and opens the admin, which reads and writes content in a shared Neon Postgres.
- Service
- Data
- AI model
- External
Hard problems I solved
A CMS for a client with no server
A CMS with a live API needs an always-on host, and the media pipeline needs ffmpeg, which Vercel functions cannot run. The client would not pay for a VPS, Railway rejected the available card, and Render's plan was too expensive.
Approach. The admin ships as a Docker image that each staff member runs on their own laptop, all pointing at one shared Neon database and one R2 bucket. Production never calls the CMS. Publish writes a static snapshot of all content to R2 in both locales and keeps timestamped history for rollback. CONTENT_KEY can point at a staging file. The site falls back to content bundled in the build if the snapshot cannot load.
Video transcoding inside CMS hooks
The agency's footage is 4K video, and staff upload whatever they have. Serving uploads as is would make the site unusable on mobile, and uploading the same filename twice failed Payload's unique-name check.
Approach. A beforeOperation hook replaces the upload buffer with an ffmpeg re-encode: H.264 at CRF 26 with +faststart, at most 1920 px, even dimensions. It runs only for authenticated users and adds a random filename suffix. A beforeChange hook derives a WebP poster, seeking to 1 s or falling back to frame 0 for clips shorter than 1 s, plus a 4 s 480p preview, and pushes both to R2. afterDelete cleans them up. If conversion fails, the original is uploaded and a warning is logged.
End-to-end test with a synthetic 48.9 MB, 40 Mbps 4K clip: the output was a 3.1 MB MP4, with poster and preview served from R2. This worst case took about 8-10 minutes in a laptop container.
A mobile crash from 24 images decoding at once
Scrolling past the projects section on a phone killed the browser tab. 24 large images were decoding at the same time: a marquee used cloneNode(true), which doubled 8 decoded images to 16, and a selector rendered all 8 panels.
Approach. The first round replaced DOM cloning with JSX duplication and rendered only the active panel plus one on each side. Components were gated on isInView. Images then loaded 300 ms apart, because the panel guard caused black panels, and touch devices got light static layouts. The root cause came later: work photos were 21-33 MP (2.5-7 MB) shown in tiles about 340 px wide. Every photo now has a 720 px WebP thumbnail and a 1920 px lightbox version. Video tiles show posters, and the hero video pauses off screen.
In a stress test with 64 photos, the work grid scrolled smoothly at about 38 KB per lazy-loaded thumbnail.
Shipping a server app to non-technical staff
Three people with no IT support had to install, run and update a Node, Postgres and ffmpeg stack on Macs and PCs, without a visit each time something changed.
Approach. One multi-stage Dockerfile builds the public site from its sibling repo as a named build context, installs ffmpeg and builds Payload. The image is pushed to GHCR for arm64 and amd64. French double-click launchers start Docker Desktop if needed, run docker compose pull, start the stack, poll until it is healthy and open the admin. Ports bind to 127.0.0.1. Migrations are opt-in, because a dev-mode schema push had conflicted with them.
During an on-site visit, staff could not find the cover image fields. The fix shipped the same evening, and the client only had to reopen the app.
Moving hard-coded content into the CMS without breaking production
66 gallery items, 53 client logos and the hero video were hard-coded into the site. They had to become editable without a big-bang migration that could break the live site.
Approach. Collections carry legacy URL fields next to real upload fields, so existing items kept working while new uploads go through the pipeline. Seed scripts imported the old static data. When a required image field blocked saving 8 legacy gallery items, that rule was reverted.
An audit of 440 visible texts on the live site found only the language switch, the year and the counters still in code.
Code
This is the whole publishing model. The live site reads one JSON file, every publish keeps a timestamped copy for rollback, and CONTENT_KEY lets a staging copy be published without touching production.
// Overridable so a staging copy can be published without touching the live file.
export const CONTENT_KEY = process.env.CONTENT_KEY || 'content/content.json'
const HISTORY_PREFIX = CONTENT_KEY.replace(/[^/]+$/, 'history/')
export async function publishToLiveSite() {
const snapshot = await buildSnapshot()
const body = JSON.stringify(snapshot)
const client = s3()
const Bucket = process.env.R2_BUCKET || ''
const stamp = new Date().toISOString().replace(/[:.]/g, '-')
// Keep the previous publishes so any mistake can be rolled back.
await client.send(new PutObjectCommand({
Bucket, Key: `${HISTORY_PREFIX}content-${stamp}.json`, Body: body, ContentType: 'application/json',
}))
await client.send(new PutObjectCommand({
Bucket, Key: CONTENT_KEY, Body: body, ContentType: 'application/json',
CacheControl: 'public, max-age=30, must-revalidate',
}))
return { publishedAt: (snapshot as any).generatedAt as string, bytes: Buffer.byteLength(body) }
}// hooks.beforeOperation
async ({ operation, req }) => {
if (operation !== 'create' && operation !== 'update') return
if (!req.user) return // never run ffmpeg for anonymous requests
const file = req.file
if (!file?.mimetype?.startsWith('video/')) return
try {
file.data = await convertVideoToWebMp4(file.data, file.name)
file.mimetype = 'video/mp4'
// Unique suffix: the same filename uploaded twice would otherwise fail the unique-filename check.
file.name = `${file.name.replace(/\.[^.]+$/, '')}-${Math.random().toString(36).slice(2, 7)}.mp4`
file.size = file.data.length
} catch (err) {
req.payload.logger.warn(`Video conversion skipped, uploading original: ${err instanceof Error ? err.message : err}`)
}
},
// hooks.beforeChange
async ({ data, req, operation }) => {
...
const base = String(data.filename || file.name).replace(/\.[^.]+$/, '')
const { poster, preview } = await makePosterAndPreview(file.data)
data.posterUrl = await putObject(`media/${base}-poster.webp`, poster, 'image/webp')
data.previewUrl = await putObject(`media/${base}-preview.mp4`, preview, 'video/mp4')
...
},// Live API mode: the local admin's preview (window.__KICOM_API__ injected at runtime),
// dev, or VITE_PAYLOAD_API set at build time.
const API =
(typeof window !== "undefined" && window.__KICOM_API__) ||
import.meta.env.VITE_PAYLOAD_API || (import.meta.env.DEV ? "http://localhost:3000/api" : "");
let snapshotPromise = null;
function loadSnapshot() {
if (!snapshotPromise) {
snapshotPromise = fetch(CONTENT_URL, { cache: "no-cache" })
.then((res) => { if (!res.ok) throw new Error(`Published content ${res.status}`); return res.json(); })
.catch((err) => { snapshotPromise = null; throw err; }); // allow a retry on the next call
}
return snapshotPromise;
}
export async function getGlobal(slug, locale = "fr", opts = {}) {
if (!API) {
const g = (await snapshotLocale(locale)).globals?.[slug];
if (!g) throw new Error(`Published content has no "${slug}"`);
return g;
}
return fetchJSON(`/globals/${slug}`, { locale, ...opts });
}What I built
Public site
- React SPA with four department pages and a French/English switch that Chrome's auto-translate cannot override
- SEO: Open Graph, JSON-LD LocalBusiness + EventPlanner, sitemap and robots
- Uniform 4:3 media grid with lightbox: WebP thumbnails, posters for video tiles, failed tiles hidden
- Content bundled into the build as a fallback if the published snapshot cannot load
CMS
- Payload 3 with 5 collections and 10 globals, localized in French and English
- French editor layer: labels, hidden internal fields, sidebar groups, Publish and Preview in the top bar
- Local preview server that injects the live API so editors see unpublished changes
- Contact form endpoint and WhatsApp number editable without a deploy
Media pipeline
- Images capped at 2560 px, with WebP sizes at 400, 900 and 1920 px
- Videos re-encoded to H.264/AAC with +faststart, at most 1920 px
- A 900 px WebP poster and a 4 s, 480p muted preview for every video, uploaded to R2
- Derived files removed from R2 when their media item is deleted
Delivery
- Multi-stage image that builds the public site, installs ffmpeg and builds Payload, pushed to GHCR for arm64 and amd64
- Double-click launchers for macOS and Windows: pull updates, start the stack, wait for health, open the admin
- Ports bound to 127.0.0.1; database migrations run only when RUN_MIGRATIONS=1 is set
Screens
The English locale. Editors write both languages in the CMS, and one Publish sends them out in a single snapshot.
Work grid: right-sized WebP thumbnails instead of 21-33 MP originals. Full size loads only in the lightbox.
Video tiles show a lazy-loaded poster image. The video itself loads only when a tile is opened.
A department page with a full-bleed cover. Four routes are resolved from URL slugs.
Stack
Site
- React 19
- Vite 7
- React Router 7
- Framer Motion
- Tailwind CSS 4
CMS
- Payload 3
- Next.js 15
- TypeScript
- Lexical rich text
- FR/EN localized fields
Media
- ffmpeg (H.264, +faststart)
- sharp (WebP variants)
- Cloudflare R2 via the S3 API
Infra
- Docker multi-stage, arm64 + amd64
- GitHub Container Registry
- Neon Postgres
- Vercel
How it was built
Built solo with Claude Code as pair programmer. 45 of the 75 site commits carry a Claude co-author trailer; the CMS lives outside git, so it has no commit count. I chose the no-server architecture after the hosting options failed and specified each change. I checked the work with Playwright browser runs on the admin and the live site, and by pushing synthetic 4K test media through the real ffmpeg pipeline. The September redesign follows a reference site the client picked.
The code is private, and admin access and environment configuration are not shown. The client logos on the site belong to KICOM's own clients, not mine.