How mukil571/portfolio-builder works
This is a Next.js website-builder with portfolio/product sites, an owner dashboard, and an AI chat widget grounded in each published site’s content and approved knowledge. The main workflow runs from an owner editing a site or managing knowledge and visitor questions, through API and server-side logic to persistent records; visitors then chat with the published site. The source excerpts show chat orchestration and selected persistence calls; several dashboard pages and routes are unsampled, so their detailed connections are omitted.
Main entry points: route.ts Chat endpoint · dashboard Owner dashboard · knowledge.ts Knowledge service · index.ts Database client
Components 23
Site Experiences
- Published site
src/app/site/[slug]/page.tsx - Site renderer
src/components/public/site-renderer.tsx - AI chat widget
src/components/public/chat-widget.tsx
Owner Management
- Owner dashboard
src/app/dashboard - Content editor
src/components/dashboard/content-editor.tsx - Website manager
src/components/dashboard/website-manager.tsx - Knowledge manager
src/components/dashboard/knowledge-manager.tsx - Questions manager
src/components/dashboard/questions-manager.tsx
Server Services
- Chat endpoint
src/app/api/chat/route.ts - Site and section APIs
src/app/api - Knowledge APIs
src/app/api/knowledge - Question APIs
src/app/api/questions - Knowledge service
src/server/ai/knowledge.ts - Question service
src/server/ai/questions.ts - Prompt builder
src/server/ai/prompt.ts - AI provider
src/server/ai/provider.ts - Input validation
src/server/security/validation.ts - Rate limiting
src/server/security/rate-limit.ts - Authentication
src/lib/auth.ts
Persistence
- Postgres data
src/server/db/schema.ts - Database client
src/server/db/index.ts
Other components
- Site owner
- Site visitor
Connections 28
- Site visitor → Published site: visits
- Published site → Site renderer: renders
- Site visitor → AI chat widget: asks
- AI chat widget → Chat endpoint: sends chat
- Site owner → Owner dashboard: manages site
- Owner dashboard → Content editor: offers editing
- Owner dashboard → Website manager: offers setup
- Owner dashboard → Knowledge manager: offers curation
- Owner dashboard → Questions manager: offers review
- Knowledge manager → Knowledge service: uses knowledge
src/components/dashboard/knowledge-manager.tsx - Questions manager → Question service: uses questions
src/components/dashboard/questions-manager.tsx - Chat endpoint → Input validation: validates payload
src/app/api/chat/route.ts - Chat endpoint → Rate limiting: checks limit
src/app/api/chat/route.ts - Chat endpoint → Knowledge service: loads context
src/app/api/chat/route.ts - Chat endpoint → Question service: records question
src/app/api/chat/route.ts - Chat endpoint → AI provider: gets model
src/app/api/chat/route.ts - Knowledge service → Prompt builder: builds prompt
src/server/ai/knowledge.ts - Knowledge APIs → Authentication: checks session
src/app/api/knowledge/route.ts - Knowledge APIs → Knowledge service: calls service
src/app/api/knowledge/route.ts - Question APIs → Authentication: checks session
src/app/api/questions/route.ts - Question APIs → Question service: calls service
src/app/api/questions/route.ts - Site and section APIs → Authentication: checks session
src/app/api/websites/route.ts - Site and section APIs → Input validation: validates fields
src/app/api/websites/route.ts - Site and section APIs → Database client: writes site records
src/app/api/websites/route.ts - Knowledge service → Database client: reads and writes
src/server/ai/knowledge.ts - Question service → Database client: reads and writes
src/server/ai/questions.ts - Database client → Postgres data: uses schema
src/server/db/index.ts - Authentication → Database client: uses database
src/lib/auth.ts