Projects & API Keys
Key types, namespaces, and zero-code project scoping.
PushFlo has three kinds of keys, and one namespace concept that ties them together:
pub_...— publish key: safe for the browser; connects and subscribes.sec_...— secret key: server-side only; publishes messages and reads history.mgmt_...— management key: automates channels and projects (create, list, delete).
Projects group channels and keys into isolated namespaces — one per app, environment, or customer. The part that matters: scoping lives in the key, not in your code. Create a credential inside a project and every channel it touches is namespaced automatically. Two projects can both have an orders channel without colliding, and your code never changes — you just configure a different key per app.
Keys created without a project are organization-wide and see all channels across all projects, so existing setups keep working untouched.
exactly-the-same-code.tstypescript
// Nothing project-specific in your code — the key carries the scope.
const client = new PushFloClient({
publishKey: process.env.NEXT_PUBLIC_PUSHFLO_KEY, // project-scoped pub_ key
});
client.subscribe('orders', {
onMessage: (message) => console.log(message.content),
});
// Subscribed to THIS project's "orders" channel.manage-projects.tstypescript
import { PushFloServer } from '@pushflodev/sdk/server';
const pushflo = new PushFloServer({ secretKey: 'mgmt_xxxxxxxxxxxxx' });
const project = await pushflo.createProject({
name: 'My App',
slug: 'my-app', // immutable — it's the namespace identifier
});
const { projects } = await pushflo.listProjects();Worth knowing: project slugs are immutable (display names aren't). Deleting a project deletes its channels and their history — its keys revert to organization-wide. Free includes 1 project, Starter 3, Pro 10, Business unlimited. More in the announcement post and the multi-app tutorial.
