Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bohdan-mykhailenko/api_ai-coach-chat

An API for the AI coach chat app with real time messaging and database.
https://github.com/bohdan-mykhailenko/api_ai-coach-chat

nestjs nodejs postgresql sequelize socket-io

Last synced: 8 days ago
JSON representation

An API for the AI coach chat app with real time messaging and database.

Awesome Lists containing this project

README

        

# AgileGPT API

## Overview

- [**Demo Link**](https://bohdan-mykhailenko.github.io/ai_coach/#/)
- [**Frontend Repo**](https://github.com/bohdan-mykhailenko/ai_coach)

## Description

This repository contains the source code for the AgileGPt project, which serves as the backend side for the application.

## Features

**The API provides the following features:**

- **Get data:** Get history of user messages and AI responses.
- **Real-time data transferring:** Allow to send and get data in real-time.

## Technologies

- [TypeScript](https://www.typescriptlang.org/)
- [Nest.js](https://nestjs.com/)
- [Socket.io](https://socket.io/)
- [Sequelize](https://sequelize.org/)
- [Sequelize CLI](https://sequelize.org/docs/v7/cli/)
- [PostgreSQL](https://www.postgresql.org/)

## Getting Started

To get started with the API, follow these steps:

1. Clone the repository:

```shell
https://github.com//ai_coach_backend.git
```

2. Install dependencies:

```shell
npm install
```

3. Set up PostgreSQL Database:
- Open the `src/config/database.config.ts` file and add your PostgreSQL database configuration.

```
export const db = {
DB_HOST: 'host',
DB_NAME: 'name',
DB_USERNAME: 'username',
DB_PASSWORD: 'password',
};
```

4. Run migration:

```shell
npm run migrate
```

5. Set openAI secret key:
- Open the `src/config/api-key.config.ts` file and add your secret key.
- Add environment variable `API_KEY` with your key.

6. Start the server:

```shell
npm run start
```

## Endpoints and messages

The base URL for the API is: **https://aicoachbackend-production.up.railway.app**


HTTP



Method


Endpoint


Description


Body




GET


/messages


Get all messages.


NULL


Web Socket



Message


Description


Body




messageToOpenAI


Send user input to open AI model



{
role: string;
content: string;
}



responseFromOpenAI


Get response from open AI model


null