Skip to content

💼 An enterprise-grade Next.js boilerplate for high-performance, maintainable apps. Packed with features like Tailwind CSS, TypeScript, ESLint, Prettier, testing tools, and more to accelerate your development.

License

Notifications You must be signed in to change notification settings

uf-hobi-informatics-lab/next-enterprise-langserv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This Boilerplate is extended by the Next.js Enterprise Boilerplate ("https://github.com/Blazity/next-enterprise"). I've added langchain server into this template.

You can check detailed information in ("https://github.com/Blazity/next-enterprise")

🎯 Getting Started

To get started with this boilerplate, follow these steps:

0. Prerequisits:

1. Setup dedicated venv for langchain

conda create -n langchain
conda activate langchain

pip install -U poetry #langserv uses poetry to manage python dependencies https://python-poetry.org/

pip install -U langchain-core langchain-community "langserve[all]" langchain-cli langsmith

2. Use gh to fork; this will make your repo public;

gh repo fork uf-hobi-informatics-lab/next-enterprise-langserv --fork-name <your_app_name> --clone

If you want to have a private "fork", do this

git clone --bare https://github.com/uf-hobi-informatics-lab/next-enterprise-langserv.git <your_app_name>
cd <your_app_name>

gh repo create <your_app_name> --private ## create a empty repo under your own account; assuming you have already run gh auth, etc.
git push --mirror <your_github_link/your_app_name>

cd ..
rm -rf <your_app_name> #delete the old one

git clone <your_github_link/your_app_name>
cd <your_app_name>

## To pull updates from the public templates (in case this gets updated, and there are features you want to merge into your private repo
git remote add template https://github.com/uf-hobi-informatics-lab/next-enterprise-langserv
git pull template main

3. Run it

You need two terminal. In terminal 1, run frontend

  yarn dev

In terminal 2, run backend

conda activate langchain # make sure you use the right python venv

cd langserv 
uvicorn app.server:app --reload

4. Use it

5. MISC

brew install pre-commit
pre-commit install -t commit-msg
npx shadcn-ui@latest add form button label dropdown-menu badge drawer input select textarea tooltip scroll-area

Frontend

  • Take a look at "playground.tsx", which has set up dark model
  • It aslo links to the backend with some example codes on both the frontend and backend side
  • We use next.config.mjx rewrites to route calls to the backend
{
  source: "/backend/:path*",
  destination: process.env.NODE_ENV === "development" ? "http://127.0.0.1:8000/:path*" : "/"
}
  • In your front, endpoint can be written as
 const endpoint = `backend/playground/get`
 const response = await fetch(endpoint, {
   method: "POST",
   headers: {
     "Content-Type": "application/json",
   },
   body: JSON.stringify({ url: data.message }),
 })

langserv

- app/
	- routers/                       -----API routes
	- schemas/                       ----- Pydantic models
	- services/                      ----- Business logic
	- utils/                         ----- Utils
	- playground/                    -----Playground
	- dependencies.py                ----- dependencies across modules when needed
	- server.py                      ----- main file
	- cli.py                         -----commandline
	- exc.py                         -----Exception handler
- tests/
- docs/
	- README.md
- pyproject.toml                   ----- peotry config; python dependency management
- README.md
- .env                             ----- dotenv (python-dotenv) for environment variables
  • Operate under the langserv folder
cd ./langserv
  • If you want to add a python package
poetry add langchain-openai

About

💼 An enterprise-grade Next.js boilerplate for high-performance, maintainable apps. Packed with features like Tailwind CSS, TypeScript, ESLint, Prettier, testing tools, and more to accelerate your development.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 84.3%
  • JavaScript 11.3%
  • Python 2.3%
  • CSS 1.7%
  • Dockerfile 0.4%