DriveWise Assistant - Technical Documentation

Introduction

Welcome to the technical documentation for the DriveWise Assistant. This document provides a comprehensive overview of the application's architecture, AI capabilities, and integration points.

DriveWise Assistant is an AI-powered tool designed for the Ferrari Driving School to streamline operator workflows. It assists with managing student conversations, generating personalized lesson plans, and providing intelligent response suggestions.

System Architecture
A high-level overview of the technologies used to build the DriveWise Assistant.

Tech Stack

Next.js (App Router)
React
TypeScript
Tailwind CSS
ShadCN UI
Genkit (Google AI)
Twilio

Frontend

The user interface is built as a single-page application using Next.js with the App Router for efficient routing and Server Components. Styling is handled by Tailwind CSS, with a component library provided by ShadCN UI for a consistent and modern look.

Backend & AI

All AI-powered features are implemented using Genkit, a framework for building production-ready AI applications. Genkit flows, powered by Google's Gemini models, handle tasks like text generation and summarization. These flows are exposed as server-side functions that can be securely called from our React components.

AI Flows (Genkit)
Detailed information about the core AI functions of the application.

Twilio Integration
How DriveWise Assistant connects to the Twilio API for SMS communication.

The application can receive incoming SMS messages from students via a Twilio phone number. This is handled by a dedicated API route.

API Endpoint: /api/twilio

This endpoint is designed to be used as a webhook for Twilio. When a message is sent to the configured Twilio number, Twilio sends an HTTP POST request to this endpoint.

Security

The endpoint validates incoming requests using the x-twilio-signature header to ensure they originate from Twilio.

Environment Variables

The following variables must be set in the .env file for the integration to work:

TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token
APP_URL=https://your-app-url.com

Current Functionality

Currently, the endpoint logs the incoming message to the server console and sends a simple acknowledgement SMS back to the user. Future work would involve storing these messages in a database and displaying them in the chat interface.