expresssequelizeredismysqlvuejsvuexvue-i18n

Building a Scalable Dialogflow Chatbot

INHO LEE
September 16th, 2025

Building a production chatbot system involves much more than natural language processing. While Dialogflow excels at converting user queries into structured intents, the real complexity lies in processing these intents to deliver meaningful responses using your internal systems, databases, and APIs across a distributed architecture. In this post, I'll share the technical challenges we faced and solutions we implemented when building a scalable chatbot system where Dialogflow serves as our NLP engine, and our Express.js application handles all the heavy lifting of data processing, caching, and response generation across multiple server nodes.

Architecture Overview

Our chatbot system was built with the following technology stack:

Backend:

  • Express.js with express-session for session management
  • Redis for session storage and caching
  • MySQL with Sequelize ORM for persistent data
  • Winston for comprehensive logging

Frontend:

  • Vue.js with Vuex for state management
  • Vue-i18n for internationalization
  • Axios for HTTP client communication

Infrastructure:

  • Multi-node deployment with load balancing
  • Redis Sentinel for high availability
  • Sticky session implementation

Architecture: The Blueprint Behind the Bot

At its core, this system is a microservices-inspired setup with Dialogflow as the NLP powerhouse. Here's a high-level view of how everything connects:

chatbot.drawio.png

  • Frontend (Shinsegae Chat Client): Built with Vue.js, this is where users interact—sending chat requests or button clicks.
  • API Server (Node.js/Express): The central hub. It receives requests from the frontend, processes them, and routes to Dialogflow for intent analysis.
  • Dialogflow: Handles natural language understanding, identifying user intents, and generating responses.
  • Database (MySQL): Stores persistent data like user profiles and chat logs.
  • Redis Cache: Acts as a speed demon for frequently accessed data, with batch processing for updates.
  • Batch Processor: A background job that warms up caches and handles async tasks.

The flow? A user types a message in the chat UI → Frontend sends it to the API server → Server forwards to Dialogflow for analysis → Intent identified → Response crafted (pulling from cache if possible) → Back to the user. Simple, yet powerful. This design ensures low latency and high throughput—crucial for a chatbot that needs to feel instantaneous.

Key Functions: From Login to Lively Chats

Let's get into the meat: the features that make this system tick. I focused on reliability, speed, and user delight.

Login: Secure and Sticky

Authentication is the gatekeeper, so I made it bulletproof:

  • Sticky Sessions: Using express-session, sessions stick to the same server instance in a clustered environment, preventing "who are you?" errors during load balancing.
  • Redis Store: Sessions are persisted in Redis for distributed access. No more losing your login mid-convo if a server restarts.

Users log in once, and boom—they're in, with sessions lasting as long as needed.

Cache: Smart Storage for Speed Demons

Caching isn't an afterthought—it's the secret sauce for scalability:

  • Cache Preheating: On startup, the system proactively loads hot data (like common responses) into Redis to avoid cold starts.
  • Cache-Aside Pattern: Read from cache first—if miss, fetch from DB, store in cache, then respond. Writes update both for consistency.
  • High Availability with Redis Sentinel: Redis runs in sentinel mode for automatic failover. If a master node goes down, sentinels promote a replica in seconds—no downtime.

Result? Sub-100ms response times, even with thousands of concurrent users.

Wrapping Up: Lessons from the Build

Building this chatbot was a masterclass in full-stack harmony. Dialogflow handled the AI heavy lifting, while Redis and MySQL kept things fast and durable. Challenges? Tuning cache eviction policies and ensuring Dialogflow's intents didn't overlap—trial and error, baby.

If you're tackling similar projects, start with the architecture diagram; it'll save you headaches. Got questions? Drop a comment below—let's chat (pun intended). What's your favorite tool for chatbots? Hit me up!