How I refactored my Svelte website using Codex
Upgrade to Svelte 5/SvelteKit 2, simplified deployment, proper SEO, fixing of runtime errors and an improved admin workflow.
Date: 6 Mar 2026 · 3 min read
The background
My personal website already had a strong visual identity in the style of NieR:Automata, but under the bonnet it was starting to show its age: dependencies in need of updating, a non-linear deployment process, runtime errors and a fragile content management system.
Objective: to carry out a proper refactor, without losing the design or breaking the UX.
What I actually rebuilt
1. Stack upgrade
- Migration to Svelte 5 and SvelteKit 2
- updating key dependencies
- Alignment with Node 22
This has reduced issues with modern builds and package compatibility.
2. Cleaner and more predictable deployment
One of the most insidious bugs was having artefacts .vercel/output tracked in Git: the result was a ‘Ready’ deployment but the site not updated as it was locally.
Key fix:
- removing build artefacts from tracking
- Always build from source
- Consistent pipeline: commit → push → deploy
3. Proper SEO (not just meta descriptions)
I’ve made the project more indexable with:
- improved metadata per page
- Open Graph/Twitter support
- more consistent sitemaps and robots.txt files
- stronger internal linking on the homepage and content pages
4. Runtime stability
During the refactoring, actual client-side and server-side errors occurred:
- crashes due to
categoriesmissing - serialisation error in
__data.json(non-serialisable content) - form action mismatch in SvelteKit (
default+ named actions)
These have been fixed by hardening load/action and normalising the data.
Admin: what has improved and what hasn’t
I have improved the local admin panel with:
- separate actions
save/remove - login persistence via cookies
- creation and deletion of posts/projects via the UI
But there is an important architectural consideration:
In production on Vercel, the filesystem is read-only.
Therefore, writing to or deleting Markdown files at runtime is unreliable.
In other words: it works locally, but online a different strategy needs to be devised (DB/CMS/API or a Git-based workflow).
UX and transitions
I’ve been working on NieR-style route transitions:
- removed the unwanted ‘pop-up’ effect
- introduced a more glitchy/pixelated transition
- maintained the responsiveness and the site’s CSS theme
What I’ve learnt
This refactor wasn’t just a case of ‘update and done’. It involved work on:
- code
- build/deploy
- SEO
- operational reliability
The real difference is this: the project is now more maintainable, not just ‘working’.
Next steps (recommended)
- Migrate the production admin to Supabase (or a headless CMS) for real online CRUD.
- Add proper authentication (no hard-coded passwords).
- Implement error monitoring (Sentry or equivalent).
- Add smoke tests on the main routes before deployment.