Skip to content

manthanank/genkit-ai-app

Repository files navigation

Genkit AI API

A simple Express.js application that uses Genkit AI to interact with Google AI's Gemini models through a RESTful API.

Features

  • REST API to generate AI responses using Google's Gemini 2.0 Flash model
  • Express.js backend with organized MVC architecture
  • Environment-based configuration

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn
  • Google AI API key

Installation

  1. Clone this repository

    git clone https://github.com/manthanank/genkit-ai-app.git
  2. Install dependencies:

    npm install
  3. Create a .env file in the root directory and add your Google AI API key:

    PORT=5000
    GOOGLE_GENAI_API_KEY=your_api_key_here
    
  4. Start the server:

    npm start
    # or development mode:
    npm run dev
  5. The server will run on http://localhost:5000 by default.

API Endpoints

POST /api/ai/generate

Generate a response using the Gemini model.

Request Body

{
  "prompt": "Your prompt here"
}

Response

{
  "response": "Generated response here"
}

Directory Structure

genkit-ai-api
├── .env                # Environment variables
├── .example.env        # Example environment file
├── .gitignore          # Git ignore file
├── index.js            # Entry point
├── package.json        # Dependencies and scripts
├── README.md           # Project documentation
├── controllers/        # Request handlers
│   └── aiController.js
├── routes/             # API routes
│   └── aiRoutes.js
└── services/           # Business logic
    └── aiService.js

License

This project is licensed under the MIT License. See the LICENSE file for details.

Releases

No releases published

Packages

No packages published