Migration Overview
REP is designed for incremental adoption. You don’t need to migrate everything at once — you can start with a single variable and expand from there.
Migration phases
Section titled “Migration phases”-
Infrastructure
Set up the gateway in your deployment pipeline:
- Download or build the gateway binary
- Add the gateway to your Dockerfile or Kubernetes deployment
- Configure
REP_GATEWAY_*settings - Verify with
curl /rep/health
-
SDK adoption
Replace env var reads in your application code:
- Install
@rep-protocol/sdk - Replace
import.meta.env.VITE_*/process.env.REACT_APP_*withrep.get() - Replace sensitive var reads with
await rep.getSecure() - Add default values for local development
- Run the codemod for automated migration (optional)
- Install
-
Build cleanup
Remove build-time env var configuration:
- Remove
.env.production,.env.stagingetc. from the build - Remove
--build-argflags from Docker builds - Remove framework-specific env var type declarations
- Run
rep typegento generate SDK type declarations - Update CI/CD to use environment-agnostic builds
- Remove
-
Hardening
Enable production security features:
- Create a
.rep.yamlmanifest with all variables declared - Enable
--strictmode for guardrail enforcement - Configure
allowed_originsfor session key CORS - Add
rep validateto CI - Add
rep lintto CI to scan bundles for leaked secrets - Review variable classification with the decision tree
- Create a
Using the codemod
Section titled “Using the codemod”For automated migration, the codemod transforms env var access patterns:
# Vite projectsnpx @rep-protocol/codemod --framework vite src/
# Create React App projectsnpx @rep-protocol/codemod --framework cra src/
# Next.js projectsnpx @rep-protocol/codemod --framework next src/Use --dry-run to preview changes before applying:
npx @rep-protocol/codemod --framework vite --dry-run src/See framework-specific migration guides:
After migration
Section titled “After migration”The codemod handles the code changes. You still need to:
- Remove framework-specific type augmentations (e.g.,
vite-env.d.tsImportMetaoverrides) - Run
rep typegento generate typed SDK overloads - Update container config to set
REP_PUBLIC_*/REP_SENSITIVE_*environment variables - Verify with a test deployment