How osanseviero/geminicoder works
Main Components
a) Frontend Layer:
• Next.js Application (App Router)
• Main interface (/app/(main))
• Sharing functionality (/app/share)
• UI Components (components/)
• Sandpack Code Sandbox integration
b) Backend Layer:
• API Routes (/app/api)
• Code Generation endpoint (/api/generateCode)
• OG Image generation endpoint (/api/og)
c) External Services:
• Gemini API (Google AI)
• Database (Prisma with likely PostgreSQL)
[Client Layer]
[Application Layer]
[External Services Layer]
Component Relationships
a) Frontend Flow:
Main Page → Code Generation Interface → Sandpack Viewer
• ↓
Sharing Interface
b) Backend Integration:
Frontend → API Routes → Gemini API
• ↓
• Database
Key Technical Elements to Highlight
• Next.js App Router architecture
• API route handlers
• Prisma ORM integration
• Gemini API integration
• Sandpack code sandbox implementation
Specific Implementation Details
a) Core Application:
Main Layout (/app/(main)/layout.tsx)
• ↓
Page Components
• ↓
Shared Components (Header, Footer, CodeViewer)
b) API Layer:
Generate Code Route
• ↓
OG Image Generation
c) Database Schema:
Prisma Schema → Database Tables
Important Architectural Notes
• Separation between the frontend and API routes in Next.js
• How the Gemini API integration works with the code generation
• Database interactions through Prisma
• Demonstrate how the Sandpack integration fits into the frontend
Remember to include a section showing the static assets and utility functions, as they play a supporting role in the application's architecture. The shadcn UI components should be represented as a utility layer that feeds into the main component structure.