Getting Started - jariwala-jay/food-rx-app GitHub Wiki

This guide will walk you through setting up the Food Rx project on your local machine for development.

Prerequisites

  • An understanding of Flutter and Dart.
  • Flutter SDK installed (version >=3.0.0 <4.0.0).
  • An IDE like VS Code or Android Studio with the Flutter plugin.
  • Access to a MongoDB instance, Spoonacular API key, and a Google Cloud Platform project with Dialogflow enabled.

1. Clone the Repository

Clone the project to your local machine:

git clone <your-repository-url>
cd food-rx-app

2. Install Dependencies

Install the required Dart packages as defined in pubspec.yaml:

flutter pub get

3. Configure Environment Variables

The application uses environment variables to manage sensitive keys and configuration details.

  1. Create a file named .env in the root directory of the project.

  2. Copy the contents of .env.example (or create from scratch) and fill in the values. The app requires the following variables:

    # Spoonacular API Key for recipe and ingredient data
    SPOONACULAR_API_KEY="YOUR_SPOONACULAR_API_KEY"
    
    # MongoDB Connection String
    MONGODB_URL="mongodb+srv://<user>:<password>@<cluster-uri>/<database-name>?retryWrites=true&w=majority"
    
    # Dialogflow Configuration
    DIALOGFLOW_PROJECT_ID="your-gcp-project-id"
    DIALOGFLOW_AGENT_ID="your-dialogflow-agent-id"
    DIALOGFLOW_LOCATION="global" # Or your specific location
    DIALOGFLOW_LANGUAGE_CODE="en"
  3. Dialogflow Service Account: Place your Google Cloud service account JSON key file in assets/dialogflow_auth.json. This file is used by the DialogflowService to authenticate requests.

Security Note: The .env and dialogflow_auth.json files are included in the .gitignore and should never be committed to version control.

4. Running the Application

Once the setup is complete, you can run the application on a connected device or simulator:

flutter run

The application uses provider for state management. The main providers and services are initialized in lib/main.dart. The app will start with a LoginPage and navigate to the MainScreen upon successful authentication.

⚠️ **GitHub.com Fallback** ⚠️