Use pubflow add when you already have a project and want to add Pubflow pieces without recreating the app.
The goal is simple: keep your project structure, add only what is needed, and get clear next steps.
Add AI context:
pubflow add contextAdd env vars:
pubflow add envAdd a Flowfull client:
pubflow add clientAdd Bridge Validation middleware:
pubflow add middlewareCheck the project:
pubflow inspectpubflow add contextThis installs local Pubflow context for coding agents and IDEs.
Default output:
.pubflow/context/pubflow-context.md
AGENTS.mdUse full context when you want all reference files:
pubflow add context --fullAdd editor-specific references:
pubflow add context --cursor
pubflow add context --copilot
pubflow add context --claude
pubflow add context --allpubflow add envAdds Pubflow env vars to .env.example and optionally .env.
Frontend projects get public-safe env names:
Vite / React: VITE_FLOWLESS_URL, VITE_FLOWFULL_API_URL, VITE_BRIDGE_VALIDATION_SECRET
Expo: EXPO_PUBLIC_FLOWLESS_URL, EXPO_PUBLIC_FLOWFULL_API_URL, EXPO_PUBLIC_BRIDGE_VALIDATION_SECRET
Next.js: NEXT_PUBLIC_FLOWLESS_URL, NEXT_PUBLIC_FLOWFULL_API_URL, NEXT_PUBLIC_BRIDGE_VALIDATION_SECRETBackend projects get:
FLOWLESS_URL=https://your-flowless-instance.com
BRIDGE_VALIDATION_SECRET=replace-me
FLOWFULL_API_URL=http://localhost:3001
PUBFLOW_VALIDATION_MODE=standardFLOWLESS_URL points to your Flowless instance. FLOWFULL_API_URL points to the current Flowfull/backend API. BRIDGE_VALIDATION_SECRET is sent as X-Bridge-Secret during Bridge Validation.
pubflow add clientThe CLI detects your project and recommends a client.
Examples:
pubflow add client react
pubflow add client react-native
pubflow add client universal-js
pubflow add client python
pubflow add client go
pubflow add client rust
pubflow add client elixirRecommended installs use latest versions where the package manager supports it:
npm install @pubflow/flowfull-client@latest
npm install @pubflow/core@latest @pubflow/react@latest swr zod
npm install @pubflow/react-native@latest
python -m pip install --upgrade flowfull-python
go get github.com/pubflow/flowfull-go@latest
cargo add flowfullElixir projects get a safe manual hint:
{:flowfull, "~> 0.1.3"}Client docs:
- https://clients.flowfull.dev/
- https://clients.flowfull.dev/packages
- https://clients.flowfull.dev/starter-kits
pubflow add middlewareThis adds Bridge Validation middleware for supported backends.
Supported targets:
- Node / TypeScript
- Python / FastAPI
- Go / Gin
- Rust / Axum
- Elixir / Phoenix
Generated files use bridge as the default namespace:
src/bridge/auth.ts
app/bridge/auth.py
internal/bridge/auth.go
src/bridge/auth.rs
lib/bridge_auth.exIf a bridge file already exists, the CLI falls back to pubflow naming to avoid overwriting your code.
Rust/Axum projects may need these dependencies if they are not already installed:
cargo add axum chrono reqwest serde serde_json thiserror towerBridge Validation uses:
POST {FLOWLESS_URL}/auth/bridge/validate
X-Session-ID: <sessionId>
X-Bridge-Secret: <BRIDGE_VALIDATION_SECRET>Generated middleware gives you helpers like:
optionalAuth()
requireAuth()
requireUserType()
require_roles()
require_roles_csv()
requirePermission()
requireAdmin()Exact helper names vary by language/framework, but the pattern is the same.
The CLI detects common project types from files like:
package.json
app.json
requirements.txt
pyproject.toml
go.mod
Cargo.toml
mix.exsIt also detects package managers:
npm
bun
pnpm
yarn
pip
go
cargo
mixWhen the project is unclear, the CLI asks instead of guessing.
pubflow add is designed to be safe:
- It creates new middleware files instead of editing route files directly.
- It does not overwrite existing middleware files.
- It writes placeholders, never real secrets.
- It updates
.env.exampleby default. - It updates
.envonly when you confirm. - Agent/editor references use marked blocks so they can be updated without duplicating content.
Every add command prints next steps. You can also review hints later:
pubflow hints
pubflow hints clients
pubflow hints middleware
pubflow hints env
pubflow hints context