Skip to main content
Ron Raksmey
LiveFeaturedWeb ApplicationEducation TechnologyAcademic RepositoryUX/UI

PTEC Digital Library

A bilingual academic repository for Phnom Penh Teacher Education College — books, theses, publications and curated learning paths, readable online, installable as an app and searchable in Khmer and English.

The problem

Academic material at a teacher-education college is scattered: print on shelves, syllabuses on personal drives, theses bound once and rarely opened again. A student who cannot find a text is in the same position as a student for whom it does not exist. And catalogue records that live only in a back-office system solve the librarian's problem, not the reader's.

The approach

One bilingual site carrying the whole collection — digital and physical, the college's own work and hosted material — with each item's rights stated on the item. Readers browse and search without an account; an account adds saved lists and offline reading. Everything crawlable is described in structured data and in a machine-readable guide, so the collection is findable from outside the site as well as inside it.

What it does now

The platform is live at library.ptec.edu.kh and serves the college's collection publicly in Khmer and English. As of 31 July 2026 it publishes 114 digital resources, 7 active physical catalogue records and 4 learning paths — figures the site itself reports in its public llms.txt. It installs as an app, keeps saved books readable offline, and describes its public sections well enough that search and answer engines can cite individual records rather than only the home page.

114 Published digital resources

Overview

The PTEC Digital Library publishes the college's teaching and research collection at library.ptec.edu.kh. It covers five kinds of resource — digital books, the physical library catalogue, student theses, academic publications and curated learning paths — and documents the physical library alongside them, so the on-site and online services read as one service rather than two.

Every public section exists twice, once in English and once under a /km prefix, with reciprocal hreflang and the English URL as canonical. The site installs as a Progressive Web App and keeps saved books readable offline.

Who it is for

Student teachers, lecturers and librarians at PTEC, and anyone researching Cambodian teacher education. The public sections are open without an account; a reader account adds a profile, saved lists and offline reading.

Goals

The library states its own mission in the machine-readable guide it publishes at /llms.txt: to preserve, organise and share the college's teaching and research materials, and to improve access to teacher-education resources, student research and catalogue information for the PTEC community and the wider public. The platform is built to serve that mission to three audiences at once — human readers, search engines and answer engines.

My role

I build and maintain this platform as a full-stack developer. What follows describes the system as it runs today; the detailed breakdown of who did what across the project's history is deliberately not asserted here.

Constraints

Two constraints shape most of the visible decisions. The collection is mixed-rights — some items are the college's own and freely readable, others are bibliographic landing pages for third-party journal articles whose full text sits behind a publisher paywall — so the platform cannot treat "has a record" and "can be downloaded" as the same thing. And readers are on phones and variable connections, which is why the site is installable, caches through a service worker, and treats "saved for offline" as a route of its own rather than a browser feature.

UX decisions

The catalogue is organised by what a reader is looking for rather than by how the data is stored: Books, Theses, Publications, Learning Paths and the physical catalogue are separate entry points, each with its own listing and detail layout. A book page opens on its description, with reading and reviews as sibling tabs, so the first thing a reader sees is whether this is the right book. Learning paths exist because a list of a hundred books is not a curriculum — they order books and theses into a sequence around a real teacher-training topic. The language switcher sits in the header on every page, and the mobile bar keeps Home, Digital Library, Search, News and Profile within thumb reach.

Architecture

A Next.js application deployed on Vercel. Pages are prerendered and revalidated on a 300-second window — visible on the response as x-nextjs-prerender and x-nextjs-stale-time — so a catalogue page is served from cache without going stale for long. Supabase provides the database and a realtime channel. File delivery is deliberately not the application's job: covers and documents come from Cloudflare R2 and Vercel Blob, fronted by a separate storage host, so download traffic never competes with page rendering. Sign-in uses Google OAuth, and Cloudflare Turnstile guards the forms.

Database decisions

The record model separates a resource from its people and its subjects: authors and subjects have their own browsable pages rather than sitting as free text on the item, which is what makes "more by this author" and "more in this subject" possible at all. Academic identifiers — DOI, ORCID, ISSN — are validated before publication, so any identifier that reaches a public page is well formed. Rights live on the item too: each record carries its own licence and free-to-read flag, and the platform states plainly that it is the provider of most hosted books, not their publisher.

Key features

The features below are the ones a reader actually touches. Each is verifiable from the public site.

Security

The response headers are strict and deliberate: frame-ancestors 'none' with X-Frame-Options DENY, object-src 'none', form-action 'self', base-uri 'self', HSTS with preload, and a Content-Security-Policy that enumerates every permitted origin for scripts, images, fonts and network calls instead of relying on wildcards. Cross-Origin-Opener-Policy is same-origin-allow-popups — tight enough to isolate the page, loose enough for the Google sign-in popup to work — with Cross-Origin-Resource-Policy same-origin and X-Permitted-Cross-Domain-Policies none. robots.txt keeps the administrative, API, dashboard, authentication and private-list routes out of the index.

Accessibility

Every page opens with a skip-to-content link. Both language versions are marked at the document level and carry reciprocal hreflang, so assistive technology switches voice instead of reading Khmer through an English speech engine. Links that leave the site announce that they open in a new tab, and the persistent mobile bar keeps the primary destinations at a comfortable touch size.

SEO

Technical SEO is treated as a feature rather than an afterthought. Pages emit structured data — Library and EducationalOrganization for the institution, WebSite with a SearchAction, Book and ScholarlyArticle for individual records, BreadcrumbList for position, FAQPage on the home page. The sitemap lists both language versions of every URL with reciprocal hreflang annotations. Beyond conventional SEO the site publishes an llms.txt: a plain-text guide for answer engines stating the entity, the mission, the resource types, the current collection counts, the rights position and how to cite an item — and robots.txt grants a named allowlist to AI crawlers for the public sections while keeping admin, API and account routes out.

Performance

Catalogue pages are prerendered and revalidated on a 300-second window rather than rendered per request, so the common path is a cache hit. Cover images are served as pre-generated WebP derivatives from object storage rather than resized on demand. A service worker caches the shell and saved books, which is what makes the site usable on an intermittent connection rather than only on a fast one.

Challenges

The hardest problem here is not technical. A library that hosts other people's books has to be precise about what it is: PTEC is the provider of most hosted books, not their publisher, and some publications are citation-only landing pages for paywalled articles. The platform encodes that distinction on each record — its own licence and free-to-read flag — and states it explicitly in its public guidance, so neither a reader nor a crawler is misled about what can actually be downloaded.

Next improvements

The thesis and publication collections are at an early stage next to the published books, so the immediate work is depth rather than new surface: more student research online, and more curated paths across the material that is already there.

Key features

  • Five resource types in one catalogue

    Digital books, the physical library catalogue, student theses, academic publications and curated learning paths, each with its own listing and record layout.

  • Search, subject and author browsing

    A dedicated search route plus browsable subject and author pages, so a reader can move sideways from a record instead of starting over.

  • Read in the browser, download when permitted

    Book records open on their description with reading and reviews as sibling tabs, and each record states its own licence and free-to-read status.

  • Curated learning paths

    Ordered sequences of books and theses built around a real teacher-training topic, because a long list of books is not a curriculum.

  • Installable app with offline reading

    A Progressive Web App with a service worker, install shortcuts to Books, Theses and saved items, and "Saved for offline" as a route of its own.

  • Complete Khmer and English parity

    Every public section exists in both languages under a /km prefix, with reciprocal hreflang in the sitemap and the English URL as canonical.

  • Structured data and an llms.txt

    Library, EducationalOrganization, WebSite, Book, ScholarlyArticle, FAQPage and BreadcrumbList schemas, plus a plain-text guide written for answer engines.

  • The physical library, documented

    Rules, opening times, the collection, the committee, the team and the library's history since 2017 — so the on-site service is part of the same site.

  • Reader accounts and saved lists

    Google sign-in with Cloudflare Turnstile on the forms; an account adds a profile, private lists and offline items on top of the open catalogue.

  • Hardened response headers

    A Content-Security-Policy that enumerates every permitted origin, frame-ancestors none, form-action self, HSTS with preload, and admin routes kept out of the index.

Measured results

Only figures with a recorded source are shown.

114
Published digital resources

Reported by the platform itself in its public llms.txt: 112 e-books, 1 thesis, 1 publication.

Jul 2026

5
Public resource types

Books, physical catalogue, theses, publications and learning paths — the five public sections listed in the sitemap and llms.txt.

Jul 2026

151
Indexable URLs

Counted from the published sitemap.xml, each URL carrying reciprocal English/Khmer hreflang.

Jul 2026

2
Interface languages

English and Khmer, with every public section available under both a canonical and a /km URL.

Jul 2026

300s
Page revalidation window

Read from the x-nextjs-stale-time response header on a prerendered catalogue page.

Jul 2026