Skip to content
SATANG.B
All workCase study
Chiang Mai University · freelance

CMU Journal

A rebuild of Chiang Mai University’s academic journal, replacing a legacy CodeIgniter site, with a public reader and a full editorial back office.

Role
Solo — backend, frontend and the data migration
Stack
NestJS 11 · Fastify · Prisma · PostgreSQL
The journal’s home page
Problem
Years of articles lived in the old CodeIgniter site’s MySQL, and editors needed a system that handled review properly.
What I did
Designed the new API and site, wrote a migration that checks every file, and built the editorial back office.
Result
All 1,014 articles, 25 volumes and 76 issues migrated, with 25 post-import integrity checks passing.

Results

Sep → Nov 2026 · live on 10 Nov 2026 at journal.red-cmu.com
  • All 1,014 articles imported (1,009 published), 25 volumes, 76 issues and 9,707 new files
  • 25 post-import integrity checks passed; 7,070 text fields compared with nothing lost
  • Article list 41,232 ms → ~95–124 ms (local production build) and payload 4.59 → ~3.0 MB
  • SonarQube quality gate passed on both repos

How it works

  1. 01

    A migration that loses nothing

    Every asset is verified against its source by SHA-256, not just counted.

  2. 02

    Safe concurrent editing

    Publishing checks revisions under transaction locks, so a late editor can’t silently overwrite someone else.

  3. 03

    Sign-in security

    CMU SSO, compact JWE tokens and rotating refresh tokens — a replayed token revokes its whole family.

  4. 04

    Math in the editor

    A TipTap editor with KaTeX and MathLive for scientific articles.

What went wrong — and how I fixed it

Real problems from the commit history, not a highlight reel.

  1. 01
    Problem

    Legacy columns didn’t mean what they said (the “description” held authors), with BMP and base64 images mixed in.

    How I fixed it

    A staged migration that runs in a transaction and always rolls back unless --apply is given with a verified backup.

  2. 02
    Problem

    544 old articles failed the new publishing rules (missing emails or affiliations).

    How I fixed it

    Kept their original public state instead of inventing data.

  3. 03
    Problem

    Every page carried every article (~7 MB).

    How I fixed it

    Load only what’s shown, abstracts on demand, gzip on the API, and paging in the back office.

  4. 04
    Problem

    Unsafe legacy HTML and scanner findings.

    How I fixed it

    Sanitize at import and at read, make parsing linear-time, and harden dependencies.

  5. 05
    Problem

    Pasting a long Word document froze the editor.

    How I fixed it

    Moved picture processing to a worker with a progress bar.

Decisions & trade-offs

  • Redesign the back office from evidence

    Ran a before/after design review on desktop and mobile before picking a direction.

Screens

10 screens · click to enlarge
What I owned
  • NestJS API, Prisma and PostgreSQL
  • The Next.js 16 site and back office
  • The migration and its verification
  • Playwright tests
Stack
  • NestJS 11
  • Fastify
  • Prisma
  • PostgreSQL
  • MinIO
  • Next.js 16
  • Tailwind v4
  • TipTap
  • Playwright