YC idea matcher
This project allows you Submit your idea and get a list of similar ideas that YCombinator has invested in before.
The project is built using the following technologies:
- Neon: Serverless Postgres
- pg_embedding: open-source Postgres extension for vector storage and similarity search
- Neon Serverless Driver
- Next.js: Fullstack framework for React
- Vercel: deployment platform
- OpenAI API: generating vector embeddings
- TailwindCSS: Utility-first CSS framework
- Upstash Redis: serverless Redis for rate limiting
- Zod: TypeScript-first schema validation
- React Query: data fetching and caching library
- Vaul: Drawer component for React.
How the app works
You will find a script called generate-embeddings.ts
located in the root directory of this project. After running npm run generate-embeddings
, the script does the following:
- It creates the database schema and installs the
pg_embedding
extension - It goes through the YCombinator API 'https://api.ycombinator.com/v0.1/companies?page=1' and gets all the companies
- For each company it generates embeddings using the long description and then stores the company data in the database.
Some companies don't have a long description, so we needed to manually remove those from the database by running
delete from companies WHERE embedding = ARRAY[]::real[];
The app itself is a Next.js app with an API route located at /api/idea
. Whenever a user submits an idea, the following happens:
- The idea is sent to the OpenAI API to generate an embedding
- We then use pg_embedding to retrieve the top 3 most similar ideas