✨ newIntroducing Fleek AI agent hosting, with Eliza framework support

🦜️🔗 Fleek-LangChain Starter Tenplate

This template scaffolds a LangChain.js + Next.js starter app. It showcases how to use and combine LangChain modules for several use cases. Specifically:

It is perfect for developers looking to build AI applications in Next.js and on Fleek seamlessly with any features they want.

Prerequisites

Getting Started

  1. Fork the repository
  2. Clone the repository by running the following command:
git clone https://github.com/<your-id>/langchain-nextjs-fleek.git
  1. Enter the correct directory, install dependencies and run locally:
cd langchain-nextjs-fleek
npm i
npm run dev
  1. Ensure that you install the Fleek CLI and the Fleek Next Adapter:
// local installation
npm i @fleek-platform/cli
npm i @fleek-platform/next

// global installation
npm i -g @fleek-platform/cli
npm i -g @fleek-platform/next
  1. Set up your an .env.local file with the following environment variables:
# NEXT_PUBLIC_OPENAI_API_KEY=""
# NEXT_PUBLIC_SERPAPI_API_KEY=""
# NEXT_PUBLIC_LANGCHAIN_CALLBACKS_BACKGROUND=true

# Required for retrieval examples
# SUPABASE_PRIVATE_KEY="YOUR_SUPABASE_PRIVATE_KEY"
# SUPABASE_URL="YOUR_SUPABASE_URL"

# Optional: For Tracing with LangSmith
# LANGCHAIN_TRACING_V2=true
# LANGCHAIN_API_KEY=YOUR_API_KEY
# LANGCHAIN_PROJECT=nextjs-starter

# Optional: Other model keys
# ANTHROPIC_API_KEY="YOUR_API_KEY"

# Turn on demo mode
# NEXT_PUBLIC_DEMO="true"

💡: you can check the Fleek CLI version by running fleek -v. Any version >= 2.10.1 should be good. As for the Fleek Next adapter, you can check the Fleek Next Adapter version by running fleek-next -v. Any version >= 2.1.0 should be good.

Building and Deploying

  1. Build the project using the Fleek Next Adapter:
npx fleek-next build
# or if installed globally
fleek-next build
  1. Now, Create the Fleek Function using the Fleek CLI:
//syntax
fleek functions create --name '<name of your function>'

//example
fleek functions create --name fumadocs
  1. Finally, deploy using the Fleek CLI:
//syntax
fleek functions deploy --bundle=false --path .fleek/dist/index.js --assets .fleek/static --name '<name of your function>' --envFile '<path to your environment>'

//example
fleek functions deploy --bundle=false --path .fleek/dist/index.js --assets .fleek/static --name langchain-fleek-project --envFile .env

As you complete all the steps successfully here, you will be able to access your fullstack Next.js app using a link that looks like this- https://millions-smartphone-ancient.functions.on-fleek.app/

Deploying from the Fleek web application

To deploy your application from the Fleek web app, you need to ensure that the project exists as a Github repository.

  1. Go to the app.fleek.xyz
  2. Connect your Github account to your project
  3. Click on the repository
  4. Add your environment variables
  5. Deploy your application

Contributing

Reporting Issues

  • Use GitHub Issues to report bugs or suggest features.
  • Provide clear details and steps to reproduce any issues.

Pull Requests

  • Fork the repository.
  • Create a feature branch:
git checkout -b feature/your-feature
  • Commit changes with clear messages.
  • Push to your fork and submit a pull request.

Learn More

Screenshot

Template preview

Details

December, 11, 2024

Creation date

Next.js

Framework

Bootstrap

Category

Report template for abuse