Spaces:
Runtime error
Runtime error
docs: Introduce comprehensive technical documentation and update planning artifacts to reflect MVP completion and detailed FR implementation status.
d03d74d | # Vault - Source Tree Analysis | |
| **Generated:** 2026-02-11 | |
| **Project Root:** `/` | |
| --- | |
| ## Root Directory Structure | |
| ``` | |
| vault/ | |
| βββ .github/ # GitHub workflows and configuration | |
| β βββ workflows/ | |
| β βββ deploy.yml # CI/CD: Build, test, deploy to Vercel + Railway | |
| β | |
| βββ .husky/ # Git hooks (pre-commit linting) | |
| β | |
| βββ _bmad/ # BMAD methodology configuration | |
| β βββ _config/ # Manifests and configuration | |
| β βββ bmm/ # BMAD Method Module | |
| β βββ core/ # BMAD Core Module | |
| β | |
| βββ _bmad-output/ # BMAD-generated artifacts | |
| β βββ planning-artifacts/ # PRD, Architecture, Epics, Product Brief | |
| β βββ implementation-artifacts/ # Sprint status, story files | |
| β | |
| βββ docs/ # Project documentation (this documentation) | |
| β | |
| βββ drizzle/ # Database migrations | |
| β βββ *.sql # Migration files | |
| β | |
| βββ legacy_configs/ # Legacy deployment configurations | |
| β βββ fly/ # Fly.io configs (deprecated) | |
| β | |
| βββ public/ # Static assets | |
| β | |
| βββ src/ # Source code (main application) | |
| β βββ app/ # Next.js 15 App Router | |
| β βββ components/ # Shared UI components | |
| β βββ features/ # Feature-based modules | |
| β βββ inngest/ # Background job functions | |
| β βββ lib/ # Core utilities | |
| β βββ config/ # Application configuration | |
| β βββ types/ # TypeScript type definitions | |
| β | |
| βββ supabase/ # Supabase configuration | |
| β | |
| βββ package.json # Dependencies and scripts | |
| βββ tsconfig.json # TypeScript configuration | |
| βββ next.config.ts # Next.js configuration | |
| βββ drizzle.config.ts # Drizzle ORM configuration | |
| βββ tailwind.config.ts # Tailwind CSS configuration | |
| βββ vitest.config.ts # Vitest test configuration | |
| βββ eslint.config.mjs # ESLint configuration | |
| βββ Dockerfile # Docker configuration (Hugging Face Spaces) | |
| βββ vercel.json # Vercel deployment configuration | |
| ``` | |
| --- | |
| ## Source Code Structure (`src/`) | |
| ### App Router (`src/app/`) | |
| Next.js 15 App Router pages and API routes. | |
| ``` | |
| src/app/ | |
| βββ layout.tsx # Root layout (theme, fonts, toaster) | |
| βββ page.tsx # Homepage (public landing) | |
| βββ globals.css # Global styles (Tailwind) | |
| βββ favicon.ico # Site favicon | |
| β | |
| βββ api/ # API Route Handlers | |
| β βββ auth/[...all]/route.ts # Better Auth endpoints | |
| β βββ inngest/route.ts # Inngest webhook handler | |
| β βββ health/route.ts # Health check endpoint | |
| β βββ manual-trigger/route.ts # Manual workflow triggers (dev) | |
| β βββ youtube/ | |
| β βββ callback/route.ts # YouTube OAuth callback | |
| β βββ connect/route.ts # Initiate YouTube connection | |
| β βββ disconnect/route.ts # Disconnect YouTube channel | |
| β | |
| βββ login/ | |
| β βββ page.tsx # Login page | |
| β | |
| βββ register/ | |
| β βββ page.tsx # Registration page | |
| β | |
| βββ dashboard/ # Creator Dashboard | |
| β βββ page.tsx # Main dashboard (videos, metrics) | |
| β βββ moderation/ | |
| β β βββ page.tsx # Moderation queue | |
| β βββ requests/ | |
| β β βββ page.tsx # Product requests & proposals | |
| β βββ fix-channels/ | |
| β βββ page.tsx # Channel repair utility | |
| β | |
| βββ admin/ # Admin Operations | |
| β βββ page.tsx # Redirects to /admin/dashboard | |
| β βββ layout.tsx # Admin layout with navigation | |
| β βββ dashboard/ | |
| β β βββ page.tsx # Platform overview | |
| β βββ moderation/ | |
| β β βββ page.tsx # Admin moderation queue | |
| β βββ analysis-queue/ | |
| β β βββ page.tsx # Video analysis queue | |
| β βββ analysis/[id]/ | |
| β β βββ page.tsx # Individual analysis detail | |
| β βββ requests/ | |
| β β βββ page.tsx # Request hub (proposals, requests) | |
| β βββ users/ | |
| β βββ page.tsx # User management | |
| β | |
| βββ vault/[creatorSlug]/ # Public Creator Vault | |
| β βββ page.tsx # Vault grid (SSR/ISR) | |
| β βββ product/[productId]/ | |
| β βββ page.tsx # Product detail page | |
| β | |
| βββ showcase/ # Demo/Showcase Mode | |
| β βββ page.tsx # Featured creators grid | |
| β βββ [videoId]/ | |
| β βββ page.tsx # Video showcase | |
| β βββ moderate/ | |
| β βββ page.tsx # Showcase moderation | |
| β | |
| βββ creators/ | |
| β βββ page.tsx # Creator discovery | |
| β | |
| βββ design/ | |
| β βββ page.tsx # Design system preview | |
| β | |
| βββ unsubscribe/[token]/ | |
| βββ page.tsx # Email unsubscribe | |
| ``` | |
| ### Components (`src/components/`) | |
| Shared UI components (shadcn/ui based). | |
| ``` | |
| src/components/ | |
| βββ mode-toggle.tsx # Dark/light theme toggle | |
| βββ theme-provider.tsx # Theme context provider | |
| β | |
| βββ auth/ | |
| β βββ sign-in-form.tsx # Login form | |
| β βββ sign-up-form.tsx # Registration form | |
| β βββ user-nav.tsx # User avatar dropdown | |
| β βββ auto-claimer.tsx # Auto-claim vault ownership | |
| β | |
| βββ ui/ # shadcn/ui components | |
| βββ alert-dialog.tsx | |
| βββ alert.tsx | |
| βββ avatar.tsx | |
| βββ badge.tsx | |
| βββ button.tsx | |
| βββ card.tsx | |
| βββ checkbox.tsx | |
| βββ dialog.tsx | |
| βββ dropdown-menu.tsx | |
| βββ input.tsx | |
| βββ label.tsx | |
| βββ scroll-area.tsx | |
| βββ select.tsx | |
| βββ separator.tsx | |
| βββ skeleton.tsx | |
| βββ sonner.tsx # Toast notifications | |
| βββ tabs.tsx | |
| βββ textarea.tsx | |
| ``` | |
| ### Feature Modules (`src/features/`) | |
| Feature-based organization for business logic. | |
| ``` | |
| src/features/ | |
| β | |
| βββ analytics/ # Metrics and tracking | |
| β βββ components/ | |
| β βββ key-metrics-row.tsx # Dashboard metrics display | |
| β | |
| βββ discovery/ # AI Video Scanning | |
| β βββ actions/ | |
| β β βββ connect-youtube.ts # YouTube OAuth action | |
| β βββ components/ | |
| β β βββ youtube-connect-section.tsx | |
| β βββ services/ | |
| β βββ youtube-videos.service.ts # YouTube Data API | |
| β βββ frame-extraction.service.ts # FFmpeg processing | |
| β βββ ai-vision.service.ts # Vision provider abstraction | |
| β βββ vision-provider.factory.ts # Provider factory | |
| β βββ storage.service.ts # Supabase storage | |
| β βββ providers/ | |
| β βββ vision-provider.interface.ts | |
| β βββ gemini.provider.ts | |
| β βββ huggingface.provider.ts | |
| β | |
| βββ interest/ # "I Want This" Feature | |
| β βββ actions/ | |
| β β βββ create-interest-pledge.ts | |
| β βββ components/ | |
| β β βββ interest-capture-modal.tsx | |
| β βββ types/ | |
| β βββ interest.types.ts | |
| β | |
| βββ marketplace/ # Marketplace Integration | |
| β βββ actions/ | |
| β β βββ trigger-marketplace-match.ts | |
| β β βββ trigger-link-health-check.ts | |
| β βββ services/ | |
| β βββ amazon.service.ts # Amazon PA-API | |
| β βββ ebay.service.ts # eBay Finding API | |
| β βββ etsy.service.ts # Etsy Open API | |
| β βββ errors.ts # Custom errors | |
| β βββ link-health.service.ts | |
| β βββ marketplace-cache.service.ts | |
| β | |
| βββ moderation/ # Creator Moderation | |
| β βββ actions/ | |
| β β βββ approve-detection.ts | |
| β β βββ reject-detection.ts | |
| β β βββ bulk-approve.ts | |
| β β βββ bulk-reject.ts | |
| β β βββ edit-detection.ts | |
| β β βββ delete-detection.ts | |
| β β βββ add-detection.ts | |
| β β βββ admin-correct-detection.ts | |
| β β βββ admin-mark-incorrect.ts | |
| β β βββ fetch-product-metadata.ts | |
| β β βββ handle-proposal.ts | |
| β β βββ transfer-temporary-products.ts | |
| β β βββ upload-product-image.ts | |
| β βββ components/ | |
| β β βββ moderation-queue.tsx | |
| β β βββ admin-moderation-queue.tsx | |
| β β βββ admin-detection-card.tsx | |
| β β βββ edit-detection-dialog.tsx | |
| β β βββ add-product-dialog.tsx | |
| β β βββ product-form.tsx | |
| β β βββ image-upload-field.tsx | |
| β β βββ admin-correction-modal.tsx | |
| β β βββ admin-mark-incorrect-modal.tsx | |
| β βββ services/ | |
| β β βββ moderation.service.ts | |
| β β βββ admin-moderation.service.ts | |
| β βββ utils/ | |
| β βββ demo.ts # Demo mode utilities | |
| β | |
| βββ vault/ # Public Vault Experience | |
| β βββ actions/ | |
| β β βββ add-to-workbench.ts | |
| β β βββ quick-analyze.ts | |
| β β βββ redirect-to-marketplace.ts | |
| β β βββ refresh-metadata.ts | |
| β β βββ search-products.ts | |
| β β βββ trigger-analysis.ts | |
| β βββ components/ | |
| β β βββ vault-grid.tsx # Main product grid | |
| β β βββ vault-header.tsx # Creator info header | |
| β β βββ vault-filters.tsx # Filter controls | |
| β β βββ vault-grid-skeleton.tsx | |
| β β βββ vault-grid-with-temp-products.tsx | |
| β β βββ product-card.tsx # Individual product | |
| β β βββ product-grid.tsx | |
| β β βββ product-card-skeleton.tsx | |
| β β βββ product-request-dialog.tsx | |
| β β βββ category-filter.tsx | |
| β β βββ search-bar.tsx | |
| β β βββ search-results.tsx | |
| β β βββ video-card.tsx | |
| β β βββ video-embed.tsx | |
| β β βββ discovery-panel.tsx | |
| β β βββ claim-handler.tsx | |
| β β βββ claim-vault-button.tsx | |
| β β βββ unauthenticated-banner.tsx | |
| β β βββ affiliate-submission-dialog.tsx | |
| β β βββ quick-analyze-tool.tsx | |
| β β βββ add-to-workbench-button.tsx | |
| β βββ services/ | |
| β β βββ vault.service.ts # Data fetching + caching | |
| β β βββ showcase.service.ts | |
| β β βββ click-tracking.service.ts | |
| β βββ hooks/ | |
| β β βββ use-temporary-products.ts | |
| β βββ config/ | |
| β β βββ demo-config.ts | |
| β β βββ sample-data.ts | |
| β βββ types/ | |
| β βββ vault.types.ts | |
| β | |
| βββ admin/ # Admin Operations | |
| β βββ actions/ | |
| β βββ stats.ts # Platform statistics | |
| β | |
| βββ dashboard/ # Creator Dashboard | |
| βββ actions/ | |
| β βββ fetch-videos.ts | |
| βββ components/ | |
| βββ video-workbench.tsx | |
| ``` | |
| ### Inngest Functions (`src/inngest/`) | |
| Background job orchestration. | |
| ``` | |
| src/inngest/ | |
| βββ client.ts # Inngest client configuration | |
| β | |
| βββ functions/ | |
| βββ scan-video-archive.ts # YouTube archive scanning | |
| βββ detect-objects.ts # AI object detection | |
| βββ match-marketplace.ts # Marketplace matching | |
| βββ monitor-link-health.ts # Link health monitoring | |
| βββ social-healing.ts # Social metadata repair | |
| βββ warm-featured-creators-cache.ts | |
| ``` | |
| ### Core Libraries (`src/lib/`) | |
| Core utilities and configurations. | |
| ``` | |
| src/lib/ | |
| βββ auth.ts # Better Auth configuration | |
| βββ auth-client.ts # Client-side auth utilities | |
| βββ admin.ts # Admin utilities | |
| βββ redis.ts # Upstash Redis client | |
| β | |
| βββ db/ | |
| βββ index.ts # Drizzle client | |
| βββ schema.ts # Database schema (590 lines) | |
| ``` | |
| ### Configuration (`src/config/`) | |
| Application configuration files. | |
| ``` | |
| src/config/ | |
| βββ vision.config.ts # AI vision provider config | |
| ``` | |
| --- | |
| ## Configuration Files | |
| ### Root Configuration | |
| | File | Purpose | | |
| |------|---------| | |
| | `package.json` | Dependencies, scripts, npm configuration | | |
| | `tsconfig.json` | TypeScript compiler options | | |
| | `next.config.ts` | Next.js configuration (images, externals, Sentry) | | |
| | `drizzle.config.ts` | Drizzle ORM configuration | | |
| | `tailwind.config.ts` | Tailwind CSS configuration | | |
| | `vitest.config.ts` | Vitest test runner configuration | | |
| | `eslint.config.mjs` | ESLint rules and plugins | | |
| | `vercel.json` | Vercel deployment settings | | |
| | `Dockerfile` | Docker image for Hugging Face Spaces | | |
| ### Environment Variables | |
| Required environment variables (see `.env.example`): | |
| ``` | |
| # Database | |
| DATABASE_URL= | |
| DIRECT_URL= | |
| # Authentication | |
| BETTER_AUTH_SECRET= | |
| BETTER_AUTH_URL= | |
| GOOGLE_CLIENT_ID= | |
| GOOGLE_CLIENT_SECRET= | |
| # Inngest | |
| INNGEST_EVENT_KEY= | |
| INNGEST_SIGNING_KEY= | |
| # Supabase | |
| NEXT_PUBLIC_SUPABASE_URL= | |
| NEXT_PUBLIC_SUPABASE_ANON_KEY= | |
| # Redis | |
| UPSTASH_REDIS_REST_URL= | |
| UPSTASH_REDIS_REST_TOKEN= | |
| # AI/Vision | |
| GEMINI_API_KEY= | |
| HUGGINGFACE_API_KEY= | |
| VISION_PROVIDER=gemini|huggingface | |
| # Marketplaces | |
| AMAZON_ACCESS_KEY= | |
| AMAZON_SECRET_KEY= | |
| AMAZON_AFFILIATE_TAG= | |
| EBAY_APP_ID= | |
| EBAY_CERT_ID= | |
| EBAY_CAMPAIGN_ID= | |
| ETSY_API_KEY= | |
| # Monitoring | |
| SENTRY_ORG= | |
| SENTRY_PROJECT= | |
| # Admin | |
| ADMIN_EMAILS= | |
| ``` | |
| --- | |
| ## Key Entry Points | |
| | Entry Point | Description | | |
| |-------------|-------------| | |
| | `src/app/layout.tsx` | Root layout, theme provider | | |
| | `src/app/page.tsx` | Homepage | | |
| | `src/app/api/inngest/route.ts` | Inngest webhook handler | | |
| | `src/inngest/client.ts` | Background job client | | |
| | `src/lib/db/index.ts` | Database connection | | |
| | `src/lib/auth.ts` | Authentication setup | | |
| --- | |
| ## Related Documentation | |
| - [Project Overview](./project-overview.md) - Architecture and features | |
| - [Data Models](./data-models.md) - Database schema | |
| - [API Contracts](./api-contracts.md) - Endpoints and actions | |
| - [Development Guide](./development-guide.md) - Setup instructions | |