All entries

    Connect a React Chat UI to Vertex AI Through Firebase Functions

    Connect a React chat screen to a Firebase callable function and use server-side identity for model access.

    A laptop connects through a locked service to a chat model
    Conceptual pixel-art illustration.

    Connect a React chat screen to a Firebase callable function and use server-side identity for model access.

    Build the example

    Build a neutral hobby assistant that suggests public reading topics. Authenticate the request, enforce a length limit and call Vertex AI from the function’s configured identity with only the required permissions. Return a compact response and surface permission and quota failures separately. Apply rate limits and check pricing before enabling real traffic.

    Create an emulator fixture that returns a fixed reading suggestion and increments a counter. A successful call should invoke it once. Then deny the caller and send a long payload; both cases should leave the count unchanged. Keep provider request configuration in the server project, and show deployment instructions separately from the emulator exercise.

    EXPLAINED / SEQUENCE

    Chat request boundary

    Connect a React chat screen to a Firebase callable function and use server-side identity for model access.

    Example

    1. React client

      send a bounded hobby question

    2. Callable function

      check caller and rate limits

    3. Vertex AI

      use server identity to call the model

    THE KEY DISTINCTION

    use server identity to call the model

    Conceptual diagram for the synthetic example in this guide.

    Watch the failure boundary

    Return an explicit error when the caller has hit a limit or the model service is unavailable. If a message is retried, track the same request reference to help detect duplicate effects. Start with a non-streaming response for the demo and add streaming only when you can test interruption and reconnect behavior.

    Verify the behavior

    Use the Firebase emulator and a model stub for the first test. Verify that an unauthenticated request and an oversized message fail before the stub runs. Then test model timeouts and duplicate sends. Run any live model smoke test with a harmless example and a defined budget.

    FURTHER READING

    Sources

    Technical references checked .

    END OF ENTRY / 85
    Eeshan Singh with Big Ben in London
    BEHIND THE JOURNAL

    Eeshan Singh

    I’m Eeshan Singh Pokharia, an AI Full Stack Developer and CoFounder of UltraFit360. I work across AI features, full-stack product development, and web and mobile experiences—from Figma and frontend interactions to the systems behind them.

    Return an explicit error when the caller has hit a limit or the model service is unavailable. If a message is retried, track the same request reference to help detect duplicate effects. Start with a non-streaming response for the demo and add streaming only when you can test interruption and reconnect behavior.

    Meet the author
    THE CONVERSATION

    Your side of the story.