Skip to content

ahmetenesdur/similarity-api

Repository files navigation

Similarity API

This project is a web application that uses the OpenAI API to find similar sentences to the one you provide.

The project is built using the following technologies:

NextJS, Typescript, TailwindCSS, Prisma, Redis, OpenAI API, Google OAuth, Vercel

To see the project in action, visit the following link:

vercel

Getting Started

To get this application up and and running on your local machine follow these simple steps.

Prerequisites

You need to have Node.js and npm installed on your machine.

Installation

  1. Clone the repo

    git clone https://github.com/ahmetenesdur/similarity-api
  2. Install NPM packages

    npm install

    or

    yarn install
  3. Create an .env.local file looking like this

    NEXTAUTH_SECRET=
    NEXTAUTH_URL=
    GOOGLE_CLIENT_ID=
    GOOGLE_CLIENT_SECRET=
    DATABASE_URL=
    OPENAI_API_KEY=
    REDIS_URL=
    REDIS_SECRET=
  4. Create a Google OAuth Client and add the client id and secret to the .env.local file

  5. Create a OpenAI API Key and add the key to the .env.local file

  6. Create a Redis Cloud Account and add the url and secret to the .env.local file

  7. Prisma generate, db push and init

    npx prisma generate
    npx prisma init
    npx prisma db push
    
    or
    
    yarn prisma generate
    yarn prisma init
    yarn prisma db push
    
  8. Run the development server

    npm run dev

    or

    yarn dev
  9. Open http://localhost:3000 with your browser to see the result.

Usage

  • Login with your Google Account
  • Get your API Key
  • Use the API Key to make requests to the API
  • Similarly API is a REST API that takes a sentence and returns similar sentences to it.

Screenshots

dApp Screenshot1 dApp Screenshot2 dApp Screenshot3 dApp Screenshot4 dApp Screenshot5

License

Distributed under the MIT License. See LICENSE for more information.

Contact

linkedin github