How nutlope/roomgpt works
This repository is a small Next.js App Router application for AI room redesign. The architecture is intentionally thin: a browser-based UI collects a room photo and preferences, a serverless API route invokes the ML model, and the generated result is sent back to the UI for comparison.
The top-level runtime is Next.js with React and TypeScript. app/layout.tsx provides the shared application shell, while app/page.tsx is the main landing/upload experience and app/dream/page.tsx appears to be the generated-result view.
The presentation layer is split into reusable UI pieces under components/. These include page chrome (Header, Footer), interaction controls (DropDown, Toggle), generation/preview affordances (CompareSlider, ResizablePanel), and loading/decoration components (LoadingDots, SquigglyLines). This suggests the app is centered around a highly visual before/after workflow rather than a multi-page information site.
The core data flow starts in the browser: the user uploads an input image of a room, selects generation options, and triggers a request to the backend. The client UI likely manages local state for the upload preview, selected room style/type, and loading state while the model runs.
The backend boundary is app/generate/route.ts, which is the main server-side execution point. This route is responsible for preparing the request to the AI model, handling the image pipeline, and returning the generated output to the client. In architectural terms, this is the only part that needs to know about model invocation and external storage details.
The AI/ML dependency is Replicate, as described in the README. The app uses ControlNet to transform an input room image into a redesigned version. That means the server route is the orchestration layer between user input and the hosted inference service.
Image handling is offloaded to external storage, with Bytescale named in the README as the image host. The utils/downloadPhoto.ts and utils/appendNewToName.ts helpers indicate a small image-processing pipeline around fetching, storing, and renaming generated assets before they are displayed or returned.
There is also an optional persistence/rate-limiting boundary via Redis. utils/redis.ts connects to Upstash Redis when configured, which means the architecture can enforce request limits without adding a full database or auth system.
The app is styled with Tailwind CSS and global stylesheet files in styles/, with build/runtime config handled by tailwind.config.js, postcss.config.js, and next.config.js. These influence presentation and deployment behavior but do not add new business subsystems.
Static assets live in public/, which is used for screenshots and other browser-served files. The README and file structure together suggest a deploy-on-Vercel model, where the UI and the /generate route run as serverless functions backed by the external Replicate, Bytescale, and optional Upstash services.
For an architecture diagram, the key boundaries are: browser UI, Next.js serverless app, AI inference service, image storage service, and optional Redis rate limiter. The main end-to-end flow is user image upload → generate request → external model/storage processing → returned transformed room image → compare/display in the UI.
Main entry points: app/page.tsx Upload page · route.ts Generate API · layout.tsx App shell · dream/page.tsx Result page
Components 18
Client UI
Browser-facing pages and reusable interaction components.
- App shell · Shared application frame and global UI wrapper.
app/layout.tsx - Upload page · Main room upload and preference selection experience.
app/page.tsx - Result page · Generated-room display and comparison view.
app/dream/page.tsx - Header · Top-level page chrome.
components/Header.tsx - Footer · Bottom-level page chrome.
components/Footer.tsx - DropDown · Selection control for room options.
components/DropDown.tsx - Toggle · Binary preference control.
components/Toggle.tsx - Compare slider · Before/after image comparison UI.
components/CompareSlider.tsx - Resizable panel · Flexible preview and content container.
components/ResizablePanel.tsx - Loading dots · Generation-in-progress feedback.
components/LoadingDots.tsx - Squiggly lines · Visual accent used in the landing experience.
components/SquigglyLines.tsx
Server API
Next.js server route that orchestrates generation.
- Generate API · Server-side generation boundary for image transformation requests.
app/generate/route.ts
Shared Utils
Small helper modules for image handling and optional rate limiting.
- Download photo · Fetches and prepares remote image assets.
utils/downloadPhoto.ts - Rename asset · Creates derived filenames for generated images.
utils/appendNewToName.ts - Redis client · Optional Upstash Redis connection for request limiting.
utils/redis.ts
External Services
Hosted model, storage, and cache dependencies.
- Replicate · Hosted model execution for room redesign.
- Bytescale · External image hosting for uploaded and generated assets.
- Upstash Redis · Optional hosted Redis backing for rate limiting.
Connections 18
- App shell → Header: wraps · Shared shell provides top-level navigation chrome.
- App shell → Footer: wraps · Shared shell provides bottom-level page chrome.
- Upload page → DropDown: collects · Captures room and style choices.
- Upload page → Toggle: collects · Captures binary generation preferences.
- Upload page → Compare slider: previews · Supports before/after comparison while iterating.
- Upload page → Resizable panel: lays out · Uses responsive content panels for upload and preview.
- Upload page → Loading dots: shows · Indicates the model is running.
- Upload page → Squiggly lines: decorates · Adds visual emphasis to the landing flow.
- Upload page → Generate API: submits · Sends the upload and preferences to generation.
- Result page → Compare slider: displays · Presents the generated result against the source image.
- Result page → Resizable panel: lays out · Hosts the result comparison and related content.
- Generate API → Download photo: uses · Fetches source or generated image assets.
- Generate API → Rename asset: uses · Creates output asset names.
- Generate API → Redis client: checks · Applies optional request limiting.
- Generate API → Replicate: invokes · Runs the redesign model pipeline.
- Generate API → Bytescale: stores · Persists or retrieves image files.
- Download photo → Bytescale: downloads · Pulls remote image content from hosted storage.
- Redis client → Upstash Redis: connects · Backs the cache client with hosted Redis.