Loading repository data…
Loading repository data…
grep-many / repository
AI-powered architectural visualizer that converts 2D floor plans into photorealistic top-down 3D renders. Built with React Router SSR, TypeScript, and Puter SDK for auth, storage, and AI (txt2img). Supports project persistence, image hosting, and interactive before/after comparison UI.
AI-assisted architectural visualizer that turns 2D floor plans into top‑down 3D renders using the Puter platform.
txt2img) to generate the rendered view and presents a before/after comparison UI.@tailwindcss/vite and app/app.css)react-compare-slider (before/after comparison)lucide-react (icons)txt2img (provider: Gemini, model: gemini-2.5-flash-image-preview)@heyputer/puter.js) for auth, hosting, KV storage, filesystem, and worker callsThe app is rendered via React Router SSR and performs most data operations in the browser using the Puter SDK. Projects are saved through a Puter Worker API that stores metadata in Puter KV, while images are hosted in Puter Hosting/FS.
graph TD
User[User] --> UI[React Router UI]
UI --> Auth[Puter Auth]
UI --> AI[Puter AI txt2img]
UI --> Worker[Puter Worker API]
UI --> Hosting[Puter Hosting/FS]
Worker --> KV[Puter KV Storage]
.
├─ app/
│ ├─ app.css
│ ├─ root.tsx
│ └─ routes/
├─ components/
├─ constants/
├─ lib/
│ ├─ ai.action.ts
│ ├─ puter.action.ts
│ ├─ puter.hosting.ts
│ └─ puter.worker.js
├─ utils/
├─ public/
├─ .env.example
├─ react-router.config.ts
├─ vite.config.ts
└─ package.json
app/ React Router routes, layout, and global styles.components/ Reusable UI pieces (navbar, upload, buttons).constants/ App constants and the AI prompt.lib/ Puter integration, AI generation, and the worker script.utils/ Hosting helpers and image conversions.public/ Static assets.app/root.tsx
Purpose: Global layout, app-wide auth state, and outlet context for routes.
Interactions: Calls Puter auth helpers from lib/puter.action.ts and provides auth context to routes.
Design decisions: Centralizes auth refresh and exposes signIn/signOut to all routes via outlet context.
app/routes/home.tsx
Purpose: Landing page, upload entry point, and project listing for signed-in users.
Interactions: Uses Upload component and calls createProject + getProjects from lib/puter.action.ts.
Design decisions: Creates a project immediately after upload and navigates to the visualizer route.
app/routes/visualizer.$id.tsx
Purpose: Project visualizer/editor view with AI generation and before/after comparison.
Interactions: Fetches project data via getProjectById, triggers generate3DView, then saves via createProject.
Design decisions: Auto-generates if no render exists and provides share/export actions on the client.
lib/ai.action.ts
Purpose: Generates 3D renders using Puter AI (txt2img).
Interactions: Called from the visualizer route; uses the prompt from constants/index.ts.
Design decisions: Normalizes source images to data URLs before sending to the AI provider.
lib/puter.action.ts
Purpose: Puter auth and project CRUD through the worker API.
Interactions: Uses lib/puter.hosting.ts to host images and PUTER_WORKER_URL from constants/index.ts.
Design decisions: Ensures images are hosted before saving project metadata.
lib/puter.worker.js
Purpose: Puter Worker API for saving and retrieving projects in Puter KV.
Interactions: Invoked by lib/puter.action.ts via puter.workers.exec.
Design decisions: Uses a project key prefix and returns JSON responses for list/get/save.
sequenceDiagram
participant U as User
participant UI as React Router UI
participant PAuth as Puter Auth
participant PAI as Puter AI
participant PWorker as Puter Worker API
participant PHost as Puter Hosting/FS
participant PKV as Puter KV
U->>UI: Upload floor plan
UI->>PAuth: Sign in (if needed)
UI->>PHost: Upload source image
UI->>PWorker: Save project metadata
PWorker->>PKV: Store project
UI->>PAI: Generate 3D render
UI->>PHost: Upload rendered image
UI->>PWorker: Update project
UI-->>U: Show before/after comparison
Prerequisites:
Install dependencies:
npm install
Development:
npm run dev
Production build:
npm run build
Run the production server:
npm run start
Optional checks:
npm run lint
npm run typecheck
Environment variables (see .env.example):
| Variable | Description | Required |
|---|---|---|
| VITE_PUTER_WORKER_URL | URL of the deployed Puter Worker providing /api/projects/* endpoints | Yes |
VITE_PUTER_WORKER_URL.