Project Name: Lucent Core Purpose: A high-performance 3D asset pipeline and version control platform for creative web developers. Primary Mechanism: Ingest heavy 3D files (.glb/.fbx), process and optimize them via a Go microservice, store them securely with zero-egress fees, and provide developers with a persistent, version-controlled CDN link and ready-to-use Next.js code snippets.
AI agents must strictly adhere to this stack. Do not suggest alternatives unless explicitly prompted by the user.
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS v4
- UI Components: ShadCN UI (customized for Glassmorphism)
- 3D Engine: Three.js + React Three Fiber (R3F) + Drei
- Animation/Motion: GSAP (Complex UI choreography), Framer Motion (Simple layout shifts)
- State Management: Zustand
- Language/Framework: Go (Golang) with Gin or Echo
- 3D Processing:
gltf-pipeline(via CGo or shell sub-process) for Draco compression and Auto-LOD. - Database: Neon (Serverless PostgreSQL)
- Storage: Cloudflare R2 (S3-compatible API, chosen specifically for $0 egress fees)
- Authentication: NextAuth.js
- Payments: Lemon Squeezy
AI agents generating UI code must apply these rules rigidly to maintain the "Lucent" brand authority.
- Theme: Strict Dark Mode.
- Color Palette:
Background Base:#050505Surface:#0F0E17Primary Accent (Aesthetic Violet):#7C3AEDSecondary Glow:#A855F7Success State:#10B981
- UI Paradigm (Glassmorphism): Sidebars, modals, and floating action bars must use
backdrop-filter: blur(12px)over a semi-transparent surface background (rgba(15, 14, 23, 0.7)). - Motion: No generic loading spinners. Use GSAP for smooth staggering, spring-based entrances, and seamless 3D camera transitions.
- Upload: Client posts
.glbbinary to Next.js API route. - Pass-through: Next.js securely pipes the stream to the Go microservice.
- Processing: Go service calculates SHA-256 hash (deduplication). Executes
gltf-pipelineto compress textures and geometry. - Storage: Go streams the optimized binary directly to Cloudflare R2 bucket.
- Database: Go writes a new
Snapshotrecord in Neon Postgres, linking the R2 URL to the parentProject.
- Raycasting: User clicks on the R3F mesh in the browser.
- Vector Capture: Capture intersection
XYZcoordinates. - Storage: Save comment text +
XYZvector to Postgres. - Retrieval: On load, map over comments and render small HTML overlays via R3F
<Html>component at the precise 3D coordinates.
Agents should use these core tables when generating Prisma/Drizzle schemas or raw SQL.
- Users:
id,email,subscription_tier,storage_used,bandwidth_used - Projects:
id,user_id,name,created_at - Assets:
id,project_id,base_filename - Snapshots (Versioning):
id,asset_id,version_number,r2_url,file_size_bytes,polygon_count,parent_snapshot_id(Self-referencing for history tree) - Comments:
id,snapshot_id,user_id,text,pos_x,pos_y,pos_z,status
- DO NOT generate code that processes heavy 3D files in the browser (client-side). All optimization must be routed to the Go backend.
- DO NOT save files to local disk or Next.js
publicfolders. Always stream directly to Cloudflare R2 to prevent server memory bloat. - DO NOT use default ShadCN styling. Always inject the Lucent color variables and blur filters into the component generation.
- DO NOT propose alternative cloud providers like AWS S3. The architecture relies on Cloudflare R2's specific pricing model.
- DO wrap 3D canvas components in React
<Suspense>boundaries. - DO implement progressive loading: load a low-poly or heavily compressed version of the asset first, then swap to high-res.
When prompted to begin coding, agents should ask the user which phase to execute:
- Phase 1: Go Microservice Setup & Cloudflare R2 Connection.
- Phase 2: Neon Database Schema & NextAuth Integration.
- Phase 3: Next.js 15 App Router Shell & Glassmorphism UI Setup.
- Phase 4: R3F Viewer, GSAP Integration, and Spatial Raycasting.
- Phase 5: Snippet Generator & Pipeline Visualization Dashboard.