Skip to content

AgrI-Mitra/bff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

fcf44f0 · Feb 20, 2025
Dec 19, 2024
Jul 22, 2023
Feb 19, 2025
Feb 20, 2025
Apr 10, 2023
Apr 13, 2023
Apr 21, 2023
Apr 10, 2023
Feb 19, 2025
Nov 26, 2024
Apr 26, 2023
Apr 25, 2023
May 25, 2023
Apr 10, 2023
Feb 19, 2025
Jul 23, 2023
Apr 10, 2023
Jun 20, 2023
Feb 19, 2025

Repository files navigation

BFF - Backend For Frontend

BFF is a powerful orchestrator designed to streamline and optimize interactions with various APIs, providing a seamless experience for frontend applications. It serves as a central hub, combining the functionalities of Bhashini APIs for translations, Automatic Speech Recognition (ASR), Speech-to-Text, Text-to-Speech, and PM Kisan APIs, specifically catering to Farmers' Aadhaar status and OTP services.

Key Features:

  1. API Orchestration
  • BFF acts as a sophisticated orchestrator, seamlessly integrating multiple APIs to deliver a comprehensive set of language-related services and crucial information for farmers.
  1. Xstate for Flow Control
  • The project leverages Xstate to create a flexible and easily configurable flow for the bot. The entire conversation or interaction logic is defined in Xstate JSON, allowing for quick adjustments and modifications without extensive code changes.
  1. Additional Features:
  • Telemetry for Metrics

    • BFF provides built-in telemetry features to collect and analyze metrics. This data is crucial for understanding system performance and user behavior. The metrics can be visualized on tools like Grafana, offering valuable insights into the system's health and usage patterns.
  • Logging

    • Comprehensive logging mechanisms are implemented to capture relevant information during the execution of the bot. This aids in debugging, monitoring, and maintaining a transparent record of activities.

Getting Started:

To integrate BFF into your project, follow these steps:

  1. Clone the repository.
git clone https://github.com/AgrI-Mitra/bff.git
  1. Setting up the server
# Setup DB and Hasura
# For Local:
docker-compose -f ./docker-compose.local.yaml up -d --build
# For Server:
ocker-compose up -d

# Migrate Database
npx prisma migrate dev
# Due to a certain glitch in the matrix, doing it twice works for dev setup.

# Start dev server
yarn start:dev
  1. Deploy and run BFF to start orchestrating API calls and managing the conversation flow. BFF aims to simplify the development process by providing a robust and extensible backend solution for frontend applications, offering not only powerful API orchestration but also advanced features for monitoring and logging.

Deployment

along with all existing params only 1 additional param: scheme_name Possiible scheme names: ['PM Kisan', 'Kisan Credit Card', 'PM Fasal Bima Yojana'] ==> scheme names that are displayed on the top right corner of the chatbot.

Once the Backend team starts sending scheme_name to WAI API, send only the original user query. Don't append it by the scheme name that we were doing till now.