Bhuwan Jung Thapa

Blog

From a Single Theme to a Portfolio CMS: My System Design Journey

By Bhuwan Jung Thapa · · Updated 2026-11-03

From a Single Theme to a Portfolio CMS: My System Design Journey

How a small project from my early coding days grew into a portfolio CMS with one shared core, detachable themes, optimized content and image loading, and a backend that manages much more than visitors see.

Topics: Web Development, System Design, portfolio, system design, modular architecture, full stack development, React, TypeScript, Supabase, Netlify, Cloudflare R2, image optimization, web performance

I started this project with a single theme when I was first learning the basics of coding. At that time, I was mainly trying to understand how a website was built and how I could make things work on a page. Later, when I learned about domains and hosting, I decided to expand it into my personal portfolio.

Since then, I have kept playing with it. Sometimes I added a basic feature, sometimes I tried a new design, and sometimes I changed something just to understand how it worked. As I learned more through my studies and work, I started bringing that understanding back into this project.

What started as a small learning project has now grown into a complete portfolio CMS. It has one shared core, attachable and detachable themes, an admin dashboard, content publishing, optimized image delivery, analytics, and several layers of access control. Behind the pages visitors see, there is a much larger system managing how everything works together.

In this blog, I want to share how that change happened, the decisions behind the system, and what building it has helped me understand.

Connecting What I Studied with What I Built

During my undergraduate studies, I learned many things about system design, software architecture, databases, and how different parts of an application should connect. I understood the concepts in theory, but I still did not have a clear practical picture of how they worked inside a complete system.

When I joined a company and started working on CMS projects, those ideas became much clearer. A CMS helped me understand an application from the inside out. The public website was only one part of it. Behind that website, there were content structures, admin tools, database relationships, APIs, permissions, and publishing workflows.

This experience changed how I looked at my own portfolio. I was still adding features and trying new themes, but I started thinking more about the structure supporting them. How should the content be managed? Which features should be shared? What should happen when I change the design? How could I keep improving one part without creating problems in another?

The things I had studied started making more sense because I now had a project where I could apply them myself.

Why I Moved Away from a Branch for Every Design

Before this, I was creating a separate branch for each template and changing which branch I published under the same domain to show different designs. It gave me a way to experiment, but every design was becoming another version of the website to maintain.

Then an idea came to mind. Instead of keeping each design in a separate branch, why not build one system that could hold all of them?

The content, authentication, admin dashboard, and shared features could belong to one core. Each template could have its own design and connect to that core. I could attach a new template when I wanted another design and detach one when I no longer needed it.

That became the main idea behind the architecture I built for my own use. I wanted the freedom to keep experimenting with the frontend while maintaining one content system underneath it.

One Shared Core with Detachable Themes

The project is built with React and TypeScript. The shared core handles common responsibilities such as content access, authentication, admin tools, SEO, analytics, and site settings. The templates use that core and provide their own layouts, styles, and interactions.

This is where modular architecture and separation of concerns became practical for me. I had heard these terms before, but here I could see what they meant when I needed to change something.

For example, adding a new design should not require creating another blog database or rebuilding the admin dashboard. Updating a shared content feature should not mean making the same change separately in every theme.

There are currently six registered theme bundles in the code, including the Milky Way theme used on my site. A single registry keeps track of them. Adding a template means adding its folder and registry entry; removing it means removing those two things. The loading system also has a fallback if a requested template is unavailable.

Vite dynamic imports provide code splitting, so the site loads the selected theme on demand. It does not need to download all six designs just to show one of them.

The photo wheel on my home page is one example of this structure being useful. I could develop it for Milky Way while keeping the other designs and the full photography gallery separate. I wrote more about that part in Bringing My Photography Hobby to My Home Page.

The System Behind the Public Website

The admin dashboard is where I manage blogs, projects, photography, skills, experience, SEO, themes, and other settings. It can also be installed on my phone as a PWA, which makes the dashboard easier to open when I need it.

Supabase handles authentication and the PostgreSQL database. It stores the content, relationships, publishing information, and settings. Cloudflare R2 stores photos, my resume, new blog images, and other uploaded site assets. Some older assets can still be served from Supabase Storage.

The architecture image at the top gives an overview of these connections.

Netlify hosts the website and runs the serverless functions. These functions handle operations that need server-side checks or private credentials, including storage access, contact delivery, and requests to rebuild the published site.

A visitor might see a blog card, a photograph, or a contact form. Behind those features, the system has to decide what is public, which image to serve, whether an operation is allowed, and how an update reaches the deployed website. Working on these connections has helped me understand APIs and backend design much more clearly.

The Portfolio CMS Platform project on my home page also gives a shorter overview.

Loading Content Without Making Visitors Wait for Every Request

As the project grew, I started thinking more carefully about when work should happen. Content needs to remain easy to update, but a visitor should not have to wait for every database request before seeing the page.

During a production build, a script reads the public content from Supabase. It generates HTML pages for blogs and photos, along with their metadata, structured data, sitemap, and RSS feed. This gives search engines and link previews content they can read directly.

The build also embeds public content in the HTML as JSON. The React app can use this data for its initial display instead of waiting for a new database response. There is a 512 KB limit on this embedded data, so adding content cannot silently make it grow without a check.

The page can then refresh content in the background. Shared requests use request deduplication and a five-minute in-memory cache. If two components ask for the same content at the same time, they can share the pending request instead of sending duplicate calls.

Published blog and photography updates can queue a rebuild from the dashboard. The rebuild flow groups nearby changes and uses a server-side cooldown to reduce repeated build requests. An hourly function also checks for newly scheduled content and queues a build when the static pages need updating.

Building this helped me understand the difference between making a request faster and avoiding unnecessary work in the first place. Both matter when designing how a page loads.

Making Photography Lighter to Load

Photography added another practical problem. My original photos can be several megabytes each, and showing a small card does not require downloading the full original.

For the set of 24 home page photos I checked, the originals together were about 124 MB. A typical original was around 4.6 MB. Those numbers made me think more seriously about image delivery, especially for someone visiting on mobile data.

When I save a new photo, the admin browser prepares smaller versions before uploading them. It creates a thumbnail with a maximum edge of 800px and a display copy with a maximum edge of 1600px, using WebP where supported. It also records the dimensions and dominant colour.

The dimensions help reserve the correct space before the image loads. The dominant colour provides a placeholder while the image is arriving. These details reduce layout shifts and make the loading state feel more connected to the photograph.

On the production site, responsive image candidates from the Netlify Image CDN let the browser choose a size based on the display area and screen density. The stored thumbnail and display copies also provide smaller sources for the image-loading flow.

The desktop photo wheel prioritizes a window of about 11 thumbnails around the active photo, including the edge buffers, and requests sharper images for the open photo and the next one. The remaining images are deferred. The full gallery uses batches of 24 entries rather than requesting the entire collection at once.

For that 24-photo set, the estimated initial wheel images were around 1 MB, compared with roughly 124 MB if all 24 originals were downloaded. This estimate covers the wheel's initial images, and the actual amount varies with the screen and selected photos.

Together, upload-time image preparation, responsive delivery, lazy loading, and selective preloading let me keep photography as a proper part of the site while controlling how much a visitor needs to download.

Security Behind the Admin Features

Working on the backend also helped me understand that a login screen is only one part of access control. The database and server functions need to check permissions for themselves.

Supabase Row Level Security controls access to the database records. Public reads are limited to public content, while admin operations and private data have their own rules. The serverless admin functions validate the Supabase access token and check the configured admin allowlist before allowing protected operations.

For an upload, the function creates a presigned R2 URL that expires after five minutes. The browser uploads directly to storage using that link, while the storage credentials stay on the server. The upload functions also validate the accepted file types and size limits.

The contact form has server-side validation, Cloudflare Turnstile verification, and rate limiting. The deployment also sets security headers that restrict framing, prevent content-type sniffing, and enforce HTTPS through HSTS.

These are concrete parts of the system that visitors usually never notice. Building them made authentication, authorization, input validation, and credential handling feel much more connected than they did when I studied them separately.

What Visitors Do Not See

The backend now manages much more than the visible sections suggest. It includes drafts and scheduled publishing, photo ordering and metadata, theme settings, content relationships, upload management, and analytics reports.

For analytics, the database calculates summaries through SQL functions instead of sending every raw event to the dashboard for the browser to count. This helped me think about where processing belongs and how to keep the amount of returned data manageable as records grow.

I also questioned whether I needed to build my own persistent image cache. The stored R2 files already have unique names and one-year cache headers, so the browser can reuse a cached response when the same URL is requested again. Different image sizes can have different URLs, and cached files can be cleared, so reuse is not guaranteed for every visit.

Understanding that helped me avoid adding another storage layer without a clear need. Sometimes improving a system means using an existing browser feature properly and keeping the implementation smaller.

Each Completed Idea Shows Me the Next Step

The biggest realization from this project is how new ideas appear after I finish the current one.

For me, it feels like a staircase. When I am standing on one step, I can only see so much. Once I complete that step and move up, I get a clearer view of the next one. The same thing keeps happening with the design, features, and techniques I can use in this project.

A new theme led me to think about a shared core. A shared core made it easier to add more features. More content brought questions about loading and publishing. Photography brought questions about image sizes, caching, and how the interface should adapt to the content.

I did not have this whole system planned when I first wrote the single-theme project. It grew as my understanding grew. Completing one idea gave me enough experience to recognize another problem and think about a better way to solve it.

Today I use this as the production CMS for my own website. It brings together modular architecture, serverless APIs, database access rules, build-time content generation, caching, image optimization, and SQL-based analytics in one working system. These are the kinds of engineering concerns I began to understand through professional work, and I can now keep practising them in a system of my own.

My Direction Going Forward

I want to keep improving this system as I add content and try new designs. I also want to keep checking the loading behaviour and access rules as the project changes, because maintaining the system is part of the learning too.

The personal website assistant I described in From Traditional Web Apps to AI-Powered Applications is another idea I want to explore. Having structured projects, blogs, and profile information gives me a useful starting point for that work.

When I look back at the single theme I started with, I can see how much this project has grown alongside my own understanding. It is still my personal portfolio, but it has also become a place where I can connect what I study, what I learn at work, and what I want to build next.

There is always another step becoming visible.