# Fullmetal Chat Example

Try Fullmetal Chat—a cool chat demo on the web! It uses FullMetal for instant, smart conversations. Easy and fun—experience it now! Dive into the demo—unleash the power of Fullmetal Chat now [Github](https://github.com/m0dE/fullmetal-chat-example.git)🌐✨

1. **Clone the following repository**<br>

   ```
   git clone https://github.com/m0dE/fullmetal-chat-example.git
   ```

   \
   Clone the repository to your local machine, then create the `.env` file in the root directory of the project<br>

2. **Install NPM Packages**<br>

   ```
     npm install
   ```

3. **Enter your API key (**[**How to obtain it**](/docs/getting-an-api-key.md)**)**\
   \
   Create the `FULLMETAL_API_KEY` variable in it, and pass your private FULLMETAL key

   ```properties
   // .env
   FULLMETAL_API_KEY=YOUR_API_KEY
   ```

   <br>

4. **How to run the project**\
   \
   Start frontend server with vite.

   ```
     npm run dev:frontend
   ```

   \
   Start backend server with nodemon.

   ```
     npm run dev:backend
   ```

   \
   To use the app with https server, you need to configure the key in vite.config.js file and use following command<br>

   <pre class="language-javascript" data-title="./vite.config.js" data-overflow="wrap" data-line-numbers><code class="lang-javascript">import { defineConfig } from 'vite';
   import react from '@vitejs/plugin-react-swc';

   // https://vitejs.dev/config/
   export default defineConfig({
     plugins: [react()],
     server: {
       port: '443',
       https: {
         key: 'key.pem',
         cert: 'cert.pem',
       },
       proxy: {
         '/socket.io': {
           target: 'YOUR_WEBSOCKET_LINK', // This is chat backend websocket address. As we are using websocket connection between chat-frontend and chat-backend, we need to configure this proxy in order to make it work
           ws: true,
         },
       },
     },
   });

   </code></pre>

   <br>

   ```
     npm run dev:secure:backend
   ```

   \
   For this chat app, we have used [socket.io](https://www.npmjs.com/package/socket.io) in backend and [socket.io-client](https://www.npmjs.com/package/socket.io-client) on frontend. You need to configure the /socket.io/ proxy in vite.config.js file.<br>

5. **Enjoy using the app!** :thumbsup:\
   \
   If everything goes as planned, the app should be running at <http://localhost:5173> and the following page should load.\ <br>

   <figure><img src="/files/Hn6clnFcKfiluaRN50pY" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fullmetal.gitbook.io/docs/examples/fullmetal-chat-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
