Skip to content

shayancoin/3DIX

Repository files navigation

VoxelGen / 3DIX

Full-stack platform for "vibe-coding" indoor layouts. Next.js 15 frontend with React Three Fiber, FastAPI orchestration, and ML layout stubs (gen-sem-layout) backed by Postgres + Drizzle. Ships a layout worker to call the ML service and persist jobs/results.

✨ New Features

Parametric Furniture Editor (CADAM Integration)

VoxelGen now includes a browser-based parametric CAD editor powered by OpenSCAD WASM. This integration brings:

  • AI-Driven Furniture Generation: Describe furniture in natural language, get OpenSCAD code
  • Live Parameter Editing: Adjust dimensions, materials, and features with real-time preview
  • STL Export: Download manufacturing-ready mesh files
  • Library Support: BOSL2, MCAD, and custom OpenSCAD libraries

Access the editor at /studio/furniture or via the "Furniture Editor" button in VoxelGen Studio.

Architecture

  • apps/web: Next.js (App Router), Tailwind 4, Drizzle ORM (Postgres), Stripe stub, layout worker (scripts/layoutJobWorker.ts), R3F viewers (@3dix/three).
  • services/api: FastAPI gateway with vibe encode/search, jobs stubs, and proxies to ML; Prometheus optional.
  • services/gen-sem-layout: Stub layout generator + CLIP vibe encoder + constraint solver.
  • packages:
    • types - TypeScript contracts and type definitions
    • three - React Three Fiber viewers and 3D components
    • ui - Chat panel and shared UI components
    • openscad - OpenSCAD WASM integration for parametric CAD (CADAM)
    • config - Shared configuration
  • infra: Dockerfiles/compose, observability.

Quick Start (local, Postgres)

# 0) From repo root
cd /path/to/VoxelGen

# 1) Postgres (container on 54322)
docker run -d --name voxelgen-postgres \
  -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=postgres \
  -p 54322:5432 postgres:15

# 2) Web env
cp apps/web/.env.example apps/web/.env.local
# ensure POSTGRES_URL=postgres://postgres:postgres@localhost:54322/postgres

# 3) Install deps
pnpm install
cd services/api && pip install -r requirements.txt && cd ../..

# 4) Migrations
cd apps/web && POSTGRES_URL=postgres://postgres:postgres@localhost:54322/postgres pnpm exec drizzle-kit migrate && cd ../..

# 5) Run services (separate terminals)
cd services/api && ENV_STATE=dev uvicorn manage:app --host 0.0.0.0 --port 8000 --reload
cd services/gen-sem-layout && uvicorn main:app --host 0.0.0.0 --port 8001 --reload
cd apps/web && pnpm dev --port 3000
# Layout worker (optional): cd apps/web && pnpm dlx tsx ./scripts/layoutJobWorker.ts

Open http://localhost:3000 (web), http://localhost:8000/api/v1/ (API), http://localhost:8001/health (layout stub).

Furniture Editor Route

Navigate to http://localhost:3000/studio/furniture for the parametric furniture editor.

Environment Files

  • apps/web/.env.local
    • POSTGRES_URL=postgres://postgres:postgres@localhost:54322/postgres
    • STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET (stubs ok locally)
    • BASE_URL=http://localhost:3000
    • NEXT_PUBLIC_API_URL=http://localhost:8000
    • AUTH_SECRET any dev secret
    • OPENROUTER_API_KEY - Required for AI furniture generation (get from OpenRouter)
  • services/api/.env.dev
    • ENV_STATE=dev
    • DEV_* metadata + DEV_PORT=8000, DEV_LOG_LEVEL=debug
    • DEV_DB currently unused (Mongo stub), Postgres used via web app

Notable Commands

  • Web: pnpm dev --port 3000, pnpm build, pnpm test
  • API: ENV_STATE=dev uvicorn manage:app --port 8000 --reload
  • Layout service: uvicorn main:app --port 8001 --reload
  • DB: pnpm exec drizzle-kit migrate (uses drizzle.config.ts)
  • Worker: pnpm dlx tsx ./scripts/layoutJobWorker.ts (reads LAYOUT_ML_URL, defaults to http://localhost:8001/generate-layout)

Health Checks

  • Web → API proxy: curl -s http://localhost:3000/api/vibe/echo -X POST -H "Content-Type: application/json" -d '{"message":"hi"}'
  • API echo: curl -s http://localhost:8000/api/v1/vibe/echo -X POST -H "Content-Type: application/json" -d '{"message":"hi"}'
  • ML stub: curl -s http://localhost:8001/health
  • Postgres tables: docker exec voxelgen-postgres psql -U postgres -c '\dt'

Testing

  • Frontend: cd apps/web && pnpm test
  • Python: cd services/api && python -m pytest (tests mostly template)
  • ML stubs: cd services/gen-sem-layout && python -m pytest tests/ -v

Notes / Known Gaps

  • API code still carries Mongo scaffolding; production persistence should be Postgres/pgvector.
  • gen-sem-layout attempts to load CLIP (Hugging Face); provide a token/model or rely on mock embeddings.
  • Many API routes are stubs; job system relies on web worker + Postgres layout_jobs.

CADAM Integration Credits

The parametric furniture editor is based on the CADAM project, which provides:

  • OpenSCAD WASM compilation for browser-based CAD
  • AI-assisted OpenSCAD code generation
  • Real-time parametric editing with live preview

OpenSCAD Package (packages/openscad)

The @3dix/openscad package provides:

  • OpenSCADWrapper - Core WASM wrapper for compilation
  • useOpenSCAD - React hook for OpenSCAD operations
  • parseParameters - Extract and manipulate OpenSCAD parameters
  • Worker-based compilation for non-blocking UI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5