TheRare Visuals

TheRare Engineering · 12 posts

How we built a studio platform, and what broke along the way

Behind TheRare’s photos is software we wrote ourselves: bookings, payments, a dashboard that delivers thousands of photos and hours of 4K video, our own video player and an AI photo studio. Here’s how it works, with the real code, the real mistakes, and little playgrounds you can poke.

engineer@therare: ~

$

gallery that crashed a phone
0 GB
database migrations, zero edited
0
to sign one photo link
0 ms
our whole Google Cloud bill
₹0/mo

The map

The whole system on one page

Two services, one database, two storage buckets and a job queue. Every post zooms into one part of this picture. Go on, poke it.

or tap any box to see what it does
TheRare Visuals system architectureThe browser loads pages from Next.js and calls the Spring Boot API with a session cookie. The API reads and writes PostgreSQL, signs URLs so the browser fetches media straight from a private bucket, and queues encoding jobs on Cloud Tasks, which runs them on a separate encoder service that writes video renditions back to the bucket. Portfolio media is served from a public bucket. The API also calls Razorpay, Resend and Gemini.HTMLJSON + session cookieSQLenqueuePOST jobsigns URLsphotos & video, directportfoliorenditionsBrowserSite · dashboard · adminNext.js 14Cloud Run · pages & SEOSpring Boot APICloud Run · Java 17PostgreSQLFlyway migrationsPrivate media bucketSigned URLs onlyCloud TasksJob queue, retriesEncoderffmpeg · HLSPublic portfolio bucketCached, no signingRazorpay · Resend · GeminiPayments, email, RareAI (called by the API)
Big files never pass through our servers: the API hands out short-lived signed links and the browser talks to storage directly. Press Trace a request to watch it happen.

The stack

Frontend
Next.js 14 (App Router), React 18, TypeScript, Tailwind
Backend
Spring Boot 3, Java 17, Spring Security, JPA
Data
PostgreSQL with 99 Flyway migrations
Media
Cloud Storage, ffmpeg, HLS, Cloud Tasks
Hosting
Google Cloud Run, Singapore region
Also
Razorpay, Resend, Gemini, three.js

The series

Twelve posts, basics to production

Read them in order or jump to the one you need. Most posts have a playground you can play with, and we’ll remember which ones you’ve finished (in this browser only).

0/12
Nothing read yetNext up: Part 1 →
  1. Part 1Beginner6 min read

    The architecture behind TheRare Visuals

    A photography studio's booking platform, end to end: Next.js and Spring Boot on Cloud Run, Postgres, two storage buckets, a job queue, and why each piece is there.

    • System design
    • Cloud Run
    • Next.js
    • Spring Boot
    18 August 2026Read →
  2. Part 2Beginner to advanced10 min read

    React from basics to advanced, taught with a real product

    Components, state, effects, refs, custom hooks, memoisation, Server Components and code splitting, each one explained with code that runs on our customer dashboard.

    • React
    • Next.js
    • Hooks
    • TypeScript
    25 August 2026Read →
  3. Part 3Intermediate9 min read

    Why our gallery crashed phones, and why pagination fixed it

    A 15 GB portrait gallery took down mobile browsers. The memory maths behind it, why lazy loading alone wasn't enough, and the frontend and backend changes that fixed it.

    • Performance
    • Pagination
    • Memory
    • Signed URLs
    1 September 2026Read →
  4. Part 4Intermediate9 min read

    Backend system design: bookings, jobs and money

    How the Spring Boot API is organised: the data model, 99 schema migrations, role-based access, background jobs on Cloud Tasks, and the locks that stop two requests spending the same credit.

    • Spring Boot
    • PostgreSQL
    • Concurrency
    • RBAC
    8 September 2026Read →
  5. Part 5Advanced6 min read

    Moving gigabytes through a browser: uploads and downloads

    Resumable direct-to-storage uploads that survive a dropped connection, cleaning up the ones that never finish, why bulk downloads are not a zip file, and clipping just the moment you want.

    • Uploads
    • Downloads
    • Cloud Storage
    • Resumable
    11 September 2026Read →
  6. Part 6Advanced9 min read

    Building our own video player: HLS, ffmpeg and a watermark you can't delete

    Why a photo studio wrote its own player: adaptive streaming, the ffmpeg flags that make quality switches invisible, one file per quality, a watermark burned into the pixels with a bit of maths, and hover previews from sprite sheets.

    • Video
    • HLS
    • ffmpeg
    • React
    16 September 2026Read →
  7. Part 7Intermediate7 min read

    Security by design for a small team

    Cookie sessions, tokens that can't be mistaken for each other, rate limits, security headers, private storage, and a paywall the browser can't bypass.

    • Security
    • Auth
    • CSP
    • JWT
    21 September 2026Read →
  8. Part 8Beginner6 min read

    Lessons from production: the bugs that cost us a day

    A trailing newline that broke the database password, emails that failed only after deploys, and a sitemap that pointed at the wrong domain. What went wrong and what we changed.

    • Debugging
    • Deployment
    • SEO
    • Email
    26 September 2026Read →
  9. Part 9Intermediate9 min read

    Building Shootlo: what broke while we built a same-day marketplace

    A migration that broke queries through a connection pooler, a scheduler locked out by our own auth, an AI reviewer that ran out of memory, iPhone location prompts, fake ratings, and a 'delivered' that ended the job too early.

    • Marketplace
    • PostgreSQL
    • Debugging
    • Product
    27 September 2026Read →
  10. Part 10Intermediate17 min read

    The film that played for 45 seconds

    An hour-long film stopped after 45 seconds. A signed link that expired mid-encode, a queue that doubled itself, an all-or-nothing stream, encodes fighting over one machine, the files we deleted by mistake, and the ₹685 day it all cost.

    • Video
    • Cloud Tasks
    • ffmpeg
    • Cloud costs
    28 September 2026Read →
  11. Part 11Intermediate10 min read

    The shoot that came before the booking: moving media without moving bytes

    Files used to live only inside a booking, so a shoot done before its booking existed meant downloading gigabytes and uploading them again. A media library and a move that changes one database row, and everything that must not follow a file to its new owner.

    • Data modelling
    • Cloud Storage
    • PostgreSQL
    • Privacy
    15 October 2026Read →
  12. Part 12Intermediate9 min read

    One customer, two spellings: when a capital letter split an account in two

    A customer booked with a capital letter in their email and signed in with Google in lower case, and our code saw two people. How exact matching slipped through, the three-layer fix, and a migration that repaired the split accounts without deleting anything.

    • Auth
    • PostgreSQL
    • Data quality
    • Debugging
    19 October 2026Read →

Build something useful

None of this needed a big team. It needed a real problem, like a customer waiting a minute for their portrait photos, and the patience to find out why. Pick a problem you can see from where you stand and fix it properly. Then write down what you learned.

Want to build with us?

We’re working on Shootlo, a same-day photographer marketplace, and we work with freelance web, mobile and backend developers.