TheRare Visuals

TheRare Engineering · 25 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

25 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/25
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 →
  13. Part 13Intermediate11 min read

    The booking that renamed its booker: shared bookings, and a fix that was right for the wrong person

    Before building shared bookings we found that booking for someone else would have renamed your account and moved your login to their email. Fixing it without losing the original fix, then letting co-owners view and pay without touching fifty ownership checks.

    • Authorization
    • Auth
    • Data modelling
    • Spring Boot
    23 October 2026Read →
  14. Part 14Advanced7 min read

    Lightroom in a browser tab: turning camera JPEGs into deliverables

    How Apply TheRare look reads Lightroom presets out of XMP and DNG files and renders them with a WebGL shader, tile by tile so a 24 MP photo fits on a phone's graphics chip, keeping the camera's EXIF on the way out.

    • WebGL
    • Image processing
    • Performance
    • Browser
    24 October 2026Read →
  15. Part 15Advanced6 min read

    Text behind the subject: cutting people out of photos in the browser

    Putting a title word behind the bride like the studio's PSDs: MediaPipe person segmentation on the device, loaded only when asked, served from our own origin to keep the security policy, and one drawing function for preview and export.

    • Machine learning
    • Canvas
    • Security
    • Browser
    25 October 2026Read →
  16. Part 16Intermediate6 min read

    From a designer's PSD to a template customers can fill

    We didn't convert the studio's 375 reference spreads; we read their rules and wrote a generator. Layouts in inches, vector print masters, rectangles-only enforced by the build, and why changing a layout is a migration.

    • Design systems
    • Code generation
    • Print
    26 October 2026Read →
  17. Part 17Intermediate6 min read

    Two people, one album: revisions, undo and going back to what the customer sent

    Letting the customer and the studio edit the same album: edit rules on the status enum, revision numbers against lost updates, undo that groups a drag into one step, and a backfill that only filled what it actually knew.

    • Concurrency
    • Data modelling
    • React
    • Spring Boot
    27 October 2026Read →
  18. Part 18Beginner to advanced5 min read

    Nothing goes on Instagram until the customer says yes

    A beginner-friendly state machine: six states, rules that live on the enum, an approval that's voided by any change, per-photo feedback, and emails that can never roll back the real work.

    • State machines
    • Authorization
    • Spring Boot
    28 October 2026Read →
  19. Part 19Beginner4 min read

    The download button that did nothing

    A multi-gigabyte zip download went from crashing the tab, to a hidden iframe that two security headers silently refused, to a plain link, plus a pre-flight request so errors still reach the page.

    • Browser
    • Security headers
    • Debugging
    29 October 2026Read →
  20. Part 20Beginner5 min read

    Golden hour, calculated

    The free shoot planner at /golden-hour: the sun's altitude from a few lines of astronomy, a day sampled minute by minute instead of solved, times in the place's time zone, and the studio's experience turned into data.

    • Maths
    • Time zones
    • Product
    30 October 2026Read →
  21. Part 21Intermediate5 min read

    One invoice, the wrong customer: linking bills to bookings safely

    An invoice list that crashed only when nothing was linked (Map.of() and null keys), then the check that stops one family's bill landing in another family's account, with emails and phones normalised before comparing.

    • Java
    • Authorization
    • Data quality
    • Debugging
    31 October 2026Read →
  22. Part 22Intermediate9 min read

    Folders, print shops and wedding days

    Four studio requests in one week: nested gallery folders with private per-folder links, view counts that ignore reloads, page JPEGs for the album printer, and weddings tracked event by event, plus the race and the token gap that testing caught.

    • System design
    • Authorization
    • Concurrency
    • Product
    24 November 2026Read →
  23. Part 23Intermediate16 min read

    Finding someone in every photo, and nobody else

    Splitting a shoot's photos and footage by person when several people ask for theirs, with no outside AI service: the licence that ruled out the obvious model, tuning the threshold on wedding makeup, a consent-first design where deletion lives in the database schema, why it now looks at photos only, and the two out-of-memory crashes that real studio photos caused in production.

    • Computer vision
    • Privacy
    • OpenCV
    • Cloud Run
    26 November 2026Read →
  24. Part 24Intermediate7 min read

    Two cameras, one filename: when a re-upload deleted the other shooter's photo

    Two photographers' cameras both write DSC_0001.JPG, and our replace-in-place upload treated the second as a corrected copy of the first, deleting the original. Scoping replacement to the uploader, preventing the clash in camera with a custom filename prefix per body, testing the delete call rather than the response, and pinning a Docker base image that broke the build on its own.

    • Data integrity
    • Spring Boot
    • Testing
    • Docker
    1 December 2026Read →
  25. Part 25Intermediate7 min read

    The zip that cost ₹3,489: tracing a Cloud Run egress spike

    Our Google Cloud bill jumped 718% in a day, all on one line: internet egress. Tracing it through billing, Cloud Monitoring and request logs to one 40 GB zip downloaded ten times, and the server-side limits that stop it happening again.

    • Cloud costs
    • Cloud Run
    • Debugging
    • Google Cloud
    3 December 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.