ProofFoundery
$ cat project_description.md
# ProofFoundery MVP (Hackathon Build) ProofFoundery (“Build Your Own Product”) is a social product discovery platform for **physical products** where ideas are tested publicly, contributors take **stakes**, creators get analytics, and only market-validated products qualify for a **capital trigger** (status + admin action only; no real money flows). This repository contains a running end-to-end demo built with **Next.js**, **Supabase (Postgres)**, **Qdrant**, and **HuggingFace**. ## Primary goal Deliver running software (not slides) with an end-to-end demo: - Create - Publish - Feed interactions (including stake rules) - Threshold gate + Market Decision Card - Creator analytics dashboard - Profile stake history ## Non-goals (MVP) - No blockchain - No external social integrations - No stake marketplace - No complex manufacturing workflows - No real payments ## Tech stack - **Frontend + Backend**: Next.js (App Router) - **Relational DB**: Supabase Postgres - **Vector DB**: Qdrant - **Embeddings/AI**: HuggingFace Inference API (feature extraction) ## Core concepts ### Stake rules (MVP) - Users can place stakes on an idea as either: - `SUPPORT` - `SKEPTIC` - A product qualifies when: `support_total - skeptic_total >= NEXT_PUBLIC_STAKE_THRESHOLD` ### Capital trigger (MVP) There is **no real money flow**. “Capital trigger” is represented as a **status** and an **admin override** action. ## Data model (Supabase) Defined in `supabase/schema.sql`. - `users` - `id`, `handle`, `created_at` - `products` - `id`, `creator_id`, `title`, `description`, `feedback_prompt`, `status`, `created_at`, `published_at`, `qualified_at`, ... - `comments` - `id`, `product_id`, `user_id`, `body`, `created_at` - `stakes` - `id`, `product_id`, `user_id`, `type`, `amount`, `created_at` - `market_decisions` - `product_id`, `decision_card` (json), `admin_override`, `updated_at` - `product_stake_totals` (view) - `support_total`, `skeptic_total` aggregated per product ## Qdrant usage (non-decorative) Qdrant is used for two concrete platform features: 1) **Semantic discovery** in search/feed 2) **Grounded evidence retrieval** for analytics/insights (top evidence snippets) ### Collections - `product_ideas` - Points represent product-level text: title + description + feedbackPrompt + tags + targetUser + useContext - Payload includes: `productId`, `creatorId`, `status`, `createdAt`, `category` - `product_evidence` - Points represent comment-level evidence - Payload includes: `productId`, `commentId`, `userId`, `createdAt` ### Ingestion rules - On publish: upsert into `product_ideas` - On comment create: upsert into `product_evidence` - On edit: re-embed relevant product fields and upsert `product_ideas` ## Demo pages - `/` — Feed - `/create` — Create a draft idea - `/products/[id]` — Product detail (publish, stake, comment, decision card) - `/dashboard` — Creator analytics (by handle) - `/profile/[handle]` — Stake history - `/admin` — Admin override for Market Decision Card ## API endpoints (high level) ### Core - `POST /api/users/ensure` - `GET /api/feed` - `POST /api/products` - `GET /api/products/:id` - `POST /api/products/:id/publish` - `POST /api/products/:id/stakes` - `POST /api/products/:id/comments` - `GET /api/dashboard?handle=...` - `GET /api/profile/:handle` - `POST /api/admin/products/:id/override` (requires `x-admin-secret`) ### Qdrant-required (task) - `GET /api/search/products?q=...` (semantic search via Qdrant) - `GET /api/products/:id/similar` (nearest neighbors on `product_ideas`) - `GET /api/products/:id/evidence?q=...` (top-k evidence snippets from `product_evidence`, filtered by productId) ## Local setup 1) Install dependencies: ```bash npm install ``` 2) Create `.env.local` from `.env.local.example` and fill in values. 3) Create Supabase tables by running `supabase/schema.sql` in the Supabase SQL editor. 4) Start dev server: ```bash npm run dev ``` ## Demo walkthrough 1) Open `/` and set a **demo handle** (no auth) 2) Go to `/create` and create a draft 3) Open the product and **publish** it 4) Return to `/` to see it in the feed 5) Place stakes and add comments 6) Once qualified, Market Decision Card becomes visible 7) View creator analytics in `/dashboard` 8) View stake history in `/profile/[handle]` ## Security notes - Do **not** commit secrets. - Use `.env.local` for local development. - The Supabase **service role key** must remain server-side only.
$ project_links --show
$ event_source --show
