百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

ai-getting-started

> 编程语言
开源

一个用于周末项目的 JavaScript AI 入门栈,包括图像/文本模型、向量存储、身份验证和部署配置

4.1K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个用于周末项目的 JavaScript AI 入门栈,包括图像/文本模型、向量存储、身份验证和部署配置

AI Getting Started

Live Demo (deployed on fly.io)

Join our community Discord: AI Stack Devs

Stack

  • Auth: Clerk
  • App logic: Next.js
  • VectorDB: Pinecone / Supabase pgvector
  • LLM Orchestration: Langchain.js
  • Image Model: Replicate
  • Text Model: OpenAI
  • Text streaming: ai sdk
  • Deployment: Fly
  • Security: Arcjet

Overview

  • Quickstart
  • Contribute to this repo

Quickstart

The simplest way to try out this stack is to test it out locally and traverse through code files to understand how each component work. Here are the steps to get started.

1. Fork and Clone repo

Fork the repo to your Github account, then run the following command to clone the repo:

git clone [email protected]:[YOUR_GITHUB_ACCOUNT_NAME]/ai-getting-started.git

2. Install dependencies

cd ai-getting-started
npm install 

3. Fill out secrets

cp .env.local.example .env.local

a. Clerk Secrets

Go to https://dashboard.clerk.com/ -> "Add Application" -> Fill in Application name/select how your users should sign in -> Create Application Now you should see both NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY on the screen

b. OpenAI API key

Visit https://platform.openai.com/account/api-keys to get your OpenAI API key

c. Replicate API key

Visit https://replicate.com/account/api-tokens to get your Replicate API key

NOTE: By default, this template uses Pinecone as vector store, but you can turn on Supabase pgvector easily. This means you only need to fill out either Pinecone API key or Supabase API key.

d. Pinecone API key

  • Create a Pinecone index by visiting https://app.pinecone.io/ and click on "Create Index"
  • Give it an index name (this will be the environment variable PINECONE_INDEX)
  • Fill in Dimension as 1536
  • Once the index is successfully created, click on "API Keys" on the left side nav and create an API key: copy it to PINECONE_API_KEY

e. Supabase API key

  • Create a Supabase instance here; then go to Project Settings -> API
  • SUPABASE_URL is the URL value under "Project URL"
  • SUPABASE_PRIVATE_KEY is the key starts with ey under Project API Keys
  • Now, you should enable pgvector on Supabase and create a schema. You can do this easily by clicking on "SQL editor" on the left hand side on supabase UI and then clicking on "+New Query". Copy paste this code snippet in the SQL editor and click "Run".

f. Arcjet key

Visit https://app.arcjet.com to sign up for free and get your Arcjet key.

4. Generate embeddings

There are a few markdown files under /blogs directory as examples so you can do Q&A on them. To generate embeddings and store them in the vector database for future queries, you can run the following command:

If using Pinecone

Run the following command to generate embeddings and store them in Pinecone:

npm run generate-embeddings-pinecone

If using Supabase pgvector

In QAModel.tsx, replace /api/qa-pinecone with /api/qa-pg-vector. Then run the following command to generate embeddings and store them in Supabase pgvector:

npm run generate-embeddings-supabase

5. Run app locally

Now you are ready to test out the app locally! To do this, simply run npm run dev under the project root.

6. Deploy the app

Deploy to fly.io

  • Register an account on fly.io and then install flyctl
  • Run fly launch under project root -- this will generate a fly.toml that includes all the configurations you will need
  • Run fly deploy --ha=false to deploy the app -- the --ha flag makes sure fly only spins up one instance, which is included in the free plan. You also want to run fly scale memory 512 to scale up the fly vm memory for this app.
  • For any other non-localhost environment, the existing Clerk development instance should continue to work. You can upload the secrets to Fly by running cat .env.local | fly secrets import
  • If you are ready to deploy to production, you should create a prod environment under the current Clerk instance. For more details on deploying a production app with Clerk, check out their documentation here. Note that you will likely need to manage your own domain and do domain verification as part of the process.
  • Create a new file .env.prod locally and fill in all the production-environment secrets. Remember to update NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY by copying secrets from Clerk's production instance -cat .env.prod | fly secrets import to upload secrets

Other deployment options

  • Netlify
  • Vercel

How to contribute to this repo

Code contribution workflow

You can fork this repo, make changes, and create a PR. Add @ykhli or @timqian as reviewers.

If you are new to contributing on github, here is a step-by-step guide:

  1. Clcik on Fork on the top right of this page

  2. Work on your change and push it to your forked repo. Now when you navigate to the forked repo's UI, you should see something like the following:

  3. Click on "Contribute" -> "Open Pull Request".

  4. Once you have a PR, you can add reviewers.

Other contributions

Feel free to open feature requests, bug reports etc under Issues.

Refs

  • https://js.langchain.com/docs/modules/indexes/vector_stores/integrations/pinecone
  • https://js.langchain.com/docs/modules/models/llms/integrations#replicate
  • https://js.langchain.com/docs/modules/chains/index_related_chains/retrieval_qa

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言