Skip to content

ABHAY627/ArchVision_Technical_Assessment

Repository files navigation


⛩️

ArchVision

Tagline

Next.js TypeScript Tailwind Prisma PostgreSQL Gemini


Describe a building, space, or structural vision — and watch AI render it into stunning architectural concept art.

🌸 View Live Demo →




🏯 一目見て — At First Glance


✍️ The Generator — Create Your Vision


ArchVision Generator Page — Describe an architectural concept and generate AI-powered concept art

🖼️ The Gallery — Your Personal Museum


ArchVision Gallery Page — Browse, refine, and manage your generated architectural concepts



🎋 特徴 — Features


 ┌─────────────────────────────────────────────────────────────────┐
 │                                                                 │
 │   🎨  Text-to-Image Generation    Describe → AI renders it     │
 │   🏛️  6 Style Presets             Brutalist, Japanese, Deco…   │
 │   🖼️  Personal Gallery            Auto-saved, session-based    │
 │   🔄  Refine & Regenerate          Tweak prompts seamlessly     │
 │   🛡️  Dual AI Fallback            Gemini → Pollinations.ai     │
 │   🍪  Zero-Auth Sessions          No signup, just create       │
 │   🗑️  Gallery Management          Delete concepts you don't    │
 │                                    need anymore                 │
 │                                                                 │
 └─────────────────────────────────────────────────────────────────┘

Style Preset Aesthetic
🏗️ Brutalist Raw concrete, monolithic forms, dramatic shadows
🏯 Minimalist Japanese Wabi-sabi, clean lines, zen spatial composition
🔲 Bauhaus Functional modernism, primary colors, flat roofs
🚀 Futuristic Parametric design, fluid curves, sci-fi aesthetic
Art Deco Geometric patterns, gold accents, 1920s opulence
🌿 Organic Biomorphic forms, living walls, landscape blending



🔧 仕組み — How It Works


The journey of a single prompt — from your mind to a rendered concept:

                    ┌─────────────────────┐
                    │   👤 User Types a   │
                    │   Prompt + Styles    │
                    └────────┬────────────┘
                             │
                             ▼
                    ┌─────────────────────┐
                    │  🌐 POST Request    │
                    │  /api/generate       │
                    │  { prompt, styles }  │
                    └────────┬────────────┘
                             │
                             ▼
                    ┌─────────────────────┐
                    │  🔧 Server-Side     │
                    │  Prompt Enrichment   │
                    │  + Style Descriptors │
                    └────────┬────────────┘
                             │
                    ┌────────┴────────────┐
                    │                     │
                    ▼                     ▼
          ┌─────────────────┐   ┌─────────────────┐
          │  🤖 Gemini 2.0  │   │  🎨 Pollinations │
          │  Flash (Primary) │──▶│  .ai (Fallback)  │
          │                  │   │                   │
          └────────┬─────────┘   └────────┬──────────┘
                   │                      │
                   └──────────┬───────────┘
                              │
                              ▼
                    ┌─────────────────────┐
                    │  💾 Vercel Blob     │
                    │  CDN Storage         │
                    │  {uuid}.png          │
                    └────────┬────────────┘
                             │
                             ▼
                    ┌─────────────────────┐
                    │  🗃️ Prisma ORM      │
                    │  → PostgreSQL        │
                    │  Record Created      │
                    └────────┬────────────┘
                             │
                             ▼
                    ┌─────────────────────┐
                    │  ✅ Response Sent   │
                    │  Image Rendered     │
                    │  in the Browser      │
                    └─────────────────────┘

🛡️ Key Design Decision: The browser never talks to AI APIs directly. All requests are proxied through secure Next.js API routes, keeping API keys hidden and preventing abuse.




🏗️ 構造 — Project Architecture


archvision/
├── 📁 prisma/
│   └── schema.prisma          # Generation model + PostgreSQL config
├── 📁 public/
│   └── 📁 generated/          # AI-generated images stored here
├── 📁 src/
│   ├── 📁 app/
│   │   ├── 📁 api/
│   │   │   ├── 📁 generate/   # POST — AI image generation endpoint
│   │   │   └── 📁 gallery/    # GET/DELETE — Gallery CRUD operations
│   │   ├── 📁 gallery/        # Gallery page (browse saved concepts)
│   │   ├── layout.tsx          # Root layout with fonts + metadata
│   │   ├── page.tsx            # Generator page (main interface)
│   │   └── globals.css         # Global styles + design tokens
│   ├── 📁 components/
│   │   ├── Nav.tsx             # Navigation bar (Generate / Gallery)
│   │   ├── StyleSelector.tsx   # Style preset toggle buttons
│   │   ├── ImageResult.tsx     # Generated image display + save
│   │   ├── GalleryGrid.tsx     # Responsive grid of saved concepts
│   │   ├── GalleryModal.tsx    # Full-screen image viewer + actions
│   │   ├── LoadingSkeleton.tsx # Shimmer loading animation
│   │   └── ErrorMessage.tsx    # Error state display
│   ├── 📁 lib/
│   │   ├── imageApi.ts         # AI providers + prompt construction
│   │   └── prisma.ts           # Prisma client singleton
│   └── 📁 types/
│       └── index.ts            # TypeScript interfaces
├── .env.example                # Environment variable template
├── tailwind.config.ts          # Tailwind + custom design tokens
├── package.json
└── tsconfig.json



始めよう — Quick Start


📋 Prerequisites

Before you begin, make sure you have:

Requirement Version Note
Node.js 18+ Download
PostgreSQL Any Local install, Neon (free), or Supabase (free)
Git Any Download

🪜 Step-by-Step Setup


ステップ 1 — Clone the Repository

git clone https://github.com/ABHAY627/ArchVision_Technical_Assessment.git
cd ArchVision_Technical_Assessment

ステップ 2 — Install Dependencies

npm install

ステップ 3 — Configure Environment Variables

cp .env.example .env.local

Now open .env.local and fill in your values:

# ──────────────────────────────────────────────
# 🗄️ Database — Your PostgreSQL connection string
# ──────────────────────────────────────────────
# 💡 Get a free hosted DB from https://neon.tech or https://supabase.com
# Format: postgresql://USER:PASSWORD@HOST:PORT/DATABASE?sslmode=require
DATABASE_URL=postgresql://username:password@host:5432/archvision?sslmode=require

# ──────────────────────────────────────────────
# 🗂️ Vercel Blob — Persistent image storage
# ──────────────────────────────────────────────
# Get from: Vercel Dashboard → Storage → Blob → your store → .env.local tab
BLOB_READ_WRITE_TOKEN=vercel_blob_rw_...

# ──────────────────────────────────────────────
# 🤖 AI Provider — Choose your image generation engine
# ──────────────────────────────────────────────
# Options: "pollinations" (free, no key needed) or "gemini" (needs API key)
AI_PROVIDER=pollinations

# ──────────────────────────────────────────────
# 🔑 Gemini API Key — Only required if AI_PROVIDER=gemini
# ──────────────────────────────────────────────
# Get yours free at https://aistudio.google.com/apikey
GEMINI_API_KEY=

ステップ 4 — Initialize the Database

npx prisma migrate dev --name init

This creates the Generation table in your PostgreSQL database and generates the Prisma client.


ステップ 5 — Start the Development Server

npm run dev

ステップ 6 — Open and Create! 🎉

🌐 Open http://localhost:3000 in your browser

You're all set. Type a prompt, pick a style, and hit Generate Concept!




🎮 使い方 — How to Use


🖊️ Generating a Concept

  1. Navigate to the Generate page (homepage)
  2. Describe your architectural vision in the text area
    • Example: "A modern glass skyscraper surrounded by zen gardens with flowing water"
  3. Select style presets (optional) — click one or more style chips:
    • Brutalist · Minimalist Japanese · Bauhaus · Futuristic · Art Deco · Organic
  4. Click Generate Concept and wait 10–30 seconds
  5. View your AI-rendered concept art!

🖼️ Using the Gallery

  1. After generating an image, it's automatically saved to your gallery
  2. Navigate to the Gallery page via the top nav bar
  3. Click any image to open the full-screen modal view, where you can:
    • 📋 View the original prompt and style tags used
    • 🔄 Refine & Regenerate — sends the prompt back to the generator for tweaking
    • 🗑️ Delete — permanently removes the concept from your gallery

🔄 Switching AI Providers

ArchVision supports two AI providers that you can switch between:

Provider API Key? Speed Quality
Pollinations.ai (default) ❌ Not needed 10–30s High quality, free public API
Gemini 2.0 Flash ✅ Required 5–15s Excellent quality, Google AI

To switch providers, update .env.local:

AI_PROVIDER=gemini
GEMINI_API_KEY=your_api_key_here

Then restart the dev server (Ctrl+Cnpm run dev).

💡 Pro Tip: ArchVision has a built-in fallback mechanism. If your primary provider (Gemini) fails due to rate limits, it automatically falls back to Pollinations.ai — ensuring your generation always succeeds.




🗃️ データベース — Database Schema


model Generation {
  id        String   @id @default(cuid())    // Unique ID (collision-safe)
  sessionId String                            // Anonymous user session
  prompt    String                            // Original user prompt
  styles    String[]                          // Selected style presets
  imagePath String                            // Path to saved image
  createdAt DateTime @default(now())          // Timestamp

  @@index([sessionId])                        // Fast session-scoped queries
}

Session Model:

  • On first visit, a UUID is generated and stored as an HTTP-only cookie (archvision_session)
  • All database queries are scoped to this session ID — your gallery is private to your browser
  • No login required — zero-friction anonymous sessions with a 1-year cookie TTL



🚀 展開 — Deployment (Vercel)


1.  Push your code to GitHub
2.  Import the project on Vercel (vercel.com/import)
3.  Create a Vercel Blob store (Storage → Blob) and connect it to your project
4.  Add environment variables in the Vercel dashboard:
      → DATABASE_URL
      → BLOB_READ_WRITE_TOKEN  (auto-added when Blob store is connected)
      → AI_PROVIDER
      → GEMINI_API_KEY (if using Gemini)
5.  Deploy 🚀



🧩 技術スタック — Tech Stack Deep Dive


Layer Technology Why?
Framework Next.js 14 (App Router) Full-stack React — frontend + API routes in one repo
Language TypeScript Strict type safety across frontend/backend contract
Styling Tailwind CSS Rapid iteration with a curated, warm design system
Database PostgreSQL (Neon) Reliable, scalable, free hosted options available
ORM Prisma Type-safe queries, auto-generated client, migrations
Image Storage Vercel Blob Persistent CDN-backed storage — survives every redeploy
AI (Primary) Gemini 2.0 Flash Google's fast image generation with high fidelity
AI (Fallback) Pollinations.ai Free, no-key-needed public API for resilience
Session HTTP-only Cookie Secure, anonymous session management (no auth needed)



⚠️ 制限事項 — Known Limitations


Limitation Details Production Fix
🔒 No Authentication Gallery is cookie-scoped — clearing cookies loses gallery Add OAuth / NextAuth.js
🚦 No Rate Limiting /api/generate is unprotected Add middleware (e.g., next-rate-limit)
⏱️ Pollinations SLA Free public API — generation time varies (10–30s) Use Gemini as primary provider




    ⛩️
   /   \
  /     \
 /  🌸  \
/─────────\

Made with love

Made with ❤️ by Abhay Gautam


🏯 「建築のビジョン」 — Where imagination meets architecture



About

AI-powered architectural concept generator — text to image, personal gallery, dual AI provider with fallback. Built with Next.js 14, Prisma, PostgreSQL, and Vercel Blob.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors