
Description
NanoRewind 4K takes a scan of an old family photo and has Gemini's image model repair the scratches, tears and faded color. Before restoring you pick one of six photographic processes, like Cyanotype or Kodachrome 64, and afterwards you compare the result against the original with a loupe, a slider or side by side. Every restoration goes into a private album, and any of them can be published as an unlisted share link. Accounts start with 3 free credits and get 1 more every 24 hours. It is built to run in public, with privacy, terms and cookie policies, an 18+ sign-up check, WCAG AA contrast, full keyboard support and a strict Content Security Policy. Despite the name, output is about one megapixel for now.
Media
The sign-in page, with a before and after of a restored print.
Features
Six Darkroom Processes & Atmospheric Modifiers
Before restoring, you choose Standard, Silver Gelatin, Albumen, Cyanotype, Lumière Autochrome or Kodachrome 64. Two optional extras go on top of that, Chiaroscuro for deeper shadows and Matte Emulsion for softer, paper-like highlights.
Loupe, Slider & Side-by-Side Comparison
The loupe is a 2.4x lens that shows the restored photo over the original wherever you hover. The slider is drag to reveal, and side by side shows both images with their pixel sizes. The app remembers the mode you used last.
Private Family Album
Every restoration is saved to your album automatically. From there you can reopen one in the workspace with its original style settings, download it, share it or delete it. Settings has a single button that deletes every stored photo.
Unlisted Share Links With Generated Preview Cards
Sharing a photo gives it a link at /share/<id> with a before/after slider. Each link gets its own 1200x630 preview card for chat apps, drawn on the server with the before and after held in photo corners. Links are kept out of search engines and can be turned off at any time.
Batch Restore Queue
Drop up to 10 photos and they restore one after another, each with its own status and progress bar. When credits run out, the rest are marked "No credits left" and get picked up on the next run. Photos over 3 MB are shrunk in the browser to fit Vercel's 4.5 MB request limit.
Locked-Down Accounts & Rate-Limited API
Sessions live in HttpOnly cookies, and email links carry a one-time PKCE code that only works in the browser that asked for it. Restores are capped at 5 per 10 minutes per IP. Location and camera data are stripped from photos in the browser before upload.
Key Responsibilities
- Built the React 19 and TypeScript front end with Vite and Tailwind CSS, including the restore workspace, the album view and three before/after comparison modes.
- Wrote Vercel serverless functions in TypeScript that call the Gemini image model, store originals and results in a private Supabase Storage bucket, and deduct credits through a Postgres RPC.
- Designed the Supabase schema with row-level security and least-privilege grants, limiting each user to their own profile, album rows and storage folder.
- Implemented per-IP rate limiting as a withRateLimit wrapper backed by an atomic sliding-window Postgres function that stores client IPs only as hashes.
- Moved sign-in sessions to HttpOnly, SameSite=Strict cookies with server-side renewal, and switched confirmation and password reset emails to PKCE links.
- Wrote privacy, terms and cookie policies covering India's DPDP Act and the GDPR, plus a Vite build plugin that prerenders them as static HTML and emits per-route meta tags and sitemap.xml.
- Brought all text to WCAG AA contrast (lowest 5.37:1), added skip links and focus trapping in dialogs, and code-split the bundle to cut home page JavaScript from 91 to 79 KB gzipped.
Additional Information
- A solo personal project, built on and off between December 2025 and November 2026.
- The "4K" is only the name. Free restorations come out at about one megapixel, and I rewrote the landing page, terms and preview card to say so. Real 4K output is planned for a paid tier with Stripe, which I haven't built yet.
- Some of my own marketing copy was wrong. "3 free restorations a day" didn't match the logic, which refills 1 credit every 24 hours, and "a few seconds" was closer to a minute. I fixed both everywhere, including the preview image.
- I ran a security audit partway through. It found a token leak in the Decap CMS login proxy that lives in this repo, where any website could receive a CMS user's GitHub token. It now only goes to an allowlist of origins, and the same pass took dependency advisories from 23 to 0.
- I left out a public gallery on purpose. These are mostly family photos, so share links stay unlisted.
- For the redesign I wrote down what I didn't want it to look like, which was purple and black, glassmorphism, bento grids and Inter. I picked an oxblood family-album look out of three mockups.
- Before calling it ready for the public I spent a whole phase on compliance and accessibility. It is 18+ because India's DPDP Act treats under-18s as children and the Gemini API terms rule them out. I also dropped Google Fonts, since it sent every visitor's IP to Google, and now self-host the fonts.
