How madarco/mada-vector works
Component Details
a. Client Layer:
• Public Page (app/page.tsx)
• Admin Panel (app/admin/page.tsx)
• UI Components (components/ directory)
• Use rounded rectangles for these components
b. Application Layer:
• Authentication API (app/api/auth)
• RAG API (app/api/rag)
• Vector Search API (app/api/vector-search)
• Secure Page APIs (app/api/secure)
• Middleware (middleware.ts) as a gateway
c. Data Access Layer:
• PgVector extension
• Database tables based on prisma/schema.prisma:
• Pages
• Content
• Chunks
• Documents
d. External Services Layer:
• OpenAI Services:
• text-embedding-ada-002 model
• API integration
• Vercel Postgres
Connections and Data Flow
• User interactions with frontend
• API calls between layers
• Database queries
• External service calls
• Authentication flow
Technical Details
Annotations for:
• Next.js 13+ App Router
• Prisma ORM with pgvector
• OpenAI Embeddings
• LlamaIndex Integration
• Vercel Postgres
Important Notes
Callouts for:
• Environment Variables Configuration
• Admin Authentication
• Vector Search Capabilities
• Database Migrations
• The RAG pipeline flow
• Vector search implementation
• Secure admin access
• Database structure with vector capabilities
• Integration with OpenAI services
Remember to show the relationship between the frontend search dialog (components/SearchDialog.tsx) and the vector search API, as this is a core feature of the application.