VibeFast
Core Concepts

State Management

How VibeFast keeps the app light with Convex, Zustand, and local component state.

VibeFast keeps the clients thin by letting Convex do the heavy lifting. The principle is simple: push as much state as possible to the server and keep only the UI bits on the client.

Server-first state

Most features read and write through Convex. The hooks from convex/react keep your UI automatically subscribed to changes, so your chat, tracker, payments, and AI workflows stay in sync without manual polling.

Reading data with useQuery

apps/native/src/features/chatbot/hooks/use-conversation.ts
const conversation = useQuery(api.chatbot.getOrCreateConversation, { userId });

Every Convex query is real-time and typed, so you get consistent data everywhere.

Updating data with useMutation

apps/native/src/features/tracker-app/services/tracker-service.ts
const mutate = useMutation(api.tracker.recordFood);
mutate({ userId, entry });

Mutations run server-side business logic, validate inputs, and keep the store consistent for every client.

Client-only state

There is no global Redux store. Zustand is used sparingly for lightweight UI concerns that never belong in the backend, for example the authentication status that powers the AuthWatcher and navigation guards. The slice lives in apps/native/src/lib/state/auth-client-slice.ts.

For per-screen details (form inputs, tab visibility, animation state) rely on local React state with useState, useReducer, or useRef.

Summary: When to use what

Type of stateTool to useWhy
Persisted user data, chat history, payments, tracker entriesConvex useQueryReal-time subscriptions with a single backend source of truth.
Creating, updating, deleting recordsConvex useMutationRuns server-side logic and keeps every client consistent.
Global, ephemeral UI state (auth status, transition flags)ZustandLightweight client-only store that does not duplicate server logic.
Component-local inputs, temporary toggles, animation progressuseState / useReducerFast, familiar React API for local concerns.

This server-first approach minimizes client complexity and leaves Convex to manage consistency.

Found an issue or bug in the docs?

Help me improve! If you spot any errors, typos, or have suggestions, please let me know.

Reach out on X/Twitter @zafarbuildzz