Advanced Guides
/Vite Build Configuration
Building Open LangGraph Server Projects with Vite
This document explains how to use Vite to bundle an entire Open LangGraph Server project into production-ready build artifacts. This is particularly useful for scenarios where you need to deploy a LangGraph server independently (e.g., Docker, AWS Lambda, VPS).
Overview
Key advantages of using Vite to build Open LangGraph Server projects:
- ✅ Single-file deployment: Bundle the entire project into standalone JavaScript files
- ✅ Dependency optimization: Automatically handle external dependencies to reduce bundle size
- ✅ Static asset handling: Automatically copy necessary static resource files
- ✅ ESM support: Generate standard ES module format
- ✅ Developer experience: Fast builds and hot module replacement
Installing Dependencies
First, install the necessary Vite plugins:
Configuration File
Create a vite.config.ts file in your project root. This configuration handles Node.js built-ins, excludes dependencies that shouldn't be bundled, and sets up static asset copying.
Adding Build Scripts
Add the following scripts to your package.json:
Running the Build
Execute the build command:
This will generate a dist folder containing your bundled server and any static assets.
Deployment
Running with Node.js
Running with Bun
Built with
Show your support! Star us on GitHub ⭐️