package
JavaScript bindings for the Replit protocol
npm install @replit/protocolGitHub-flavored package documentation.
Across all versions, last 30 days.
2,446,220 in 30 days
Runtime metadata.
Estimated unpacked size across 5 packages.
30.2 MB
Includes dependencies.
3 direct · 1 outdated
JavaScript/TypeScript bindings for the Replit protocol.
This package now includes a tree-shakeable ES Module build alongside the existing CommonJS build.
Legacy namespace imports (default, fully backward compatible):
import { api } from '@replit/protocol';
// Access types via namespace
const target = api.DeploymentConfig.Target.VM;
const token = api.token.ReplToken.create({ ... });This is the default import and works in all environments without configuration changes.
Tree-shakeable ESM imports (recommended for new code in Next.js apps):
import { Persistence, ReplToken_WireFormat, Timestamp } from '@replit/protocol/esm';
// Direct access to types
const persistence: Persistence = Persistence.NONE;
const format: ReplToken_WireFormat = ReplToken_WireFormat.PROTOBUF;⚠️ Note: ESM imports require adding @replit/protocol to transpilePackages in next.config.js:
transpilePackages: ['@replit/protocol', /* other packages */]CommonJS (Node.js require):
const { api } = require('@replit/protocol');
const { Command } = api;The ESM build enables ~80-90% bundle size reduction through tree-shaking:
@replit/protocol): Uses api.token.ReplToken, imports everything@replit/protocol/esm): Uses ReplToken_WireFormat, tree-shakeabletoBinary()/fromBinary() instead of encode()/decode()BigInt instead of Long.jspnpm build"@replit/protocol": "^0.4.9","@replit/protocol": "file:../goval/api/npm","@replit/protocol": "^0.4.9","@replit/protocol": "file:../../goval/api/npm",After your .proto changes are merged:
api/npmpnpm version <new-version> --no-git-tag-versionmainapi/npmpnpm login if you're not authed (will need to be in our npm org)pnpm publishmoudy
moudy.elkammash@gmail.com