Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
clemfromspace committed Jun 29, 2021
0 parents commit 5f75183
Show file tree
Hide file tree
Showing 17 changed files with 886 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Algolia credentials
# https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl
ALGOLIA_APP_ID=
ALGOLIA_API_KEY=
ALGOLIA_INDEX_NAME=

# Envs
STATIC_DIR=../../client
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.env
.DS_Store
.vscode/*
!.vscode/extensions.json

# Dependencies
node_modules
package-lock.json
yarn.lock
!/yarn.lock
composer.lock

# Python files
__pycache__
venv
env

# Google creds
service-account-file.json
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 - Algolia. (https://www.algolia.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Sample application template

This is a template you can use to create other Algolia sample applications. It contains a variety of features that every Algolia sample app should ideally include. You can use the [Github repository template](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template) functionality to create your sample app from this template.

## Features

The sample app uses the following features:

- Three back-end implementations in different languages
- ...

## Demo (Try it yourself!)

Adding a live demo (e.g., on [CodeSandbox](https://codesandbox.io/)) will let the people quickly test your sample application!

## How to run the sample app locally

The sample app implements three servers in the following programming languages:

- [Python](server/python)
- [Node.js/JavaScript](server/node)
- [Go](server/go)

The [client](client) is a single HTML page.

### 1. Clone this repository

```
git clone https://github.com/algolia-samples/chatbot-with-algolia-answers
```

Copy the file `.env.example` to the directory of the server you want to use and rename it to `.env`. For example, to use the Python implementation:

```bash
cp .env.example server/python/.env
```

### 2. Set up Algolia

To use this sample app, you need an Algolia account. If you don't have one already, [create an account for free](https://www.algolia.com/users/sign-up). Note your [Application ID](https://deploy-preview-5789--algolia-docs.netlify.app/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/importing-with-the-api/#application-id).

In the `.env` file, set the environment variables `ALGOLIA_APP_ID`:

```bash
ALGOLIA_APP_ID=<replace-with-your-algolia-app-id>
```

### 3. Create your Algolia index and upload data

After you set up your Algolia account and Algolia application, [create and populate an index](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/).

To upload your data, you can use the [Algolia dashboard](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/importing-from-the-dashboard/) or use on of Algolia's [API clients](https://www.algolia.com/developers/#integrations).

After creating the index and uploading the data, set the environment variables `ALGOLIA_INDEX_NAME` and `ALGOLIA_API_KEY` in the `.env` file:

```bash
ALGOLIA_INDEX_NAME=<replace-with-your-algolia-index-name>
ALGOLIA_API_KEY=<replace-with-your-algolia-api-key>
```

### 6. Follow the instructions in the server directory

Each server directory has a file with instructions:

- [Node.js](server/node/README)
- [Python](server/python/README)
- [Go](server/go/README)

For example, to run the Python implementation of the server, follow these steps:

```bash
cd server/python # there's a README in this folder with instructions
python3 venv env
source env/bin/activate
pip3 install -r requirements.txt
export FLASK_APP=server.py
python3 -m flask run --port=4242
```

## Resources

- [GitHub's repository template](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template) functionality

## Contributing

This template is open source and welcomes contributions. All contributions are subject to our [Code of Conduct](https://github.com/algolia-samples/.github/blob/master/CODE_OF_CONDUCT.md).

## Authors

- [@cdenoix](https://twitter.com/cdenoix)
113 changes: 113 additions & 0 deletions client/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
:root {
--transparent: transparent;
--white: #fff;
--black: #000;
--grey-900: #23263b;
--grey-800: #36395a;
--grey-700: #484c7a;
--grey-600: #5a5e9a;
--grey-500: #777aaf;
--grey-400: #9698c3;
--grey-300: #b6b7d5;
--grey-200: #d6d6e7;
--grey-100: #f5f5fa;
--grey-050: #fcfcfd;
--grey-000: #fff;
--pink-900: #59063d;
--pink-800: #88085c;
--pink-700: #b80979;
--pink-600: #e90a96;
--pink-500: #f82caa;
--pink-400: #fb5abc;
--pink-300: #fd89ce;
--pink-200: #feb9e2;
--pink-100: #ffeaf6;
--nebula-900: #141d61;
--nebula-800: #1e2b8f;
--nebula-700: #2b3cbb;
--nebula-600: #3c4fe0;
--nebula-500: #5468ff;
--nebula-400: #7c8aff;
--nebula-300: #a3acff;
--nebula-200: #cacfff;
--nebula-100: #f2f3ff;
--cyan-900: #00526c;
--cyan-800: #00769b;
--cyan-700: #009bcb;
--cyan-600: #0db7eb;
--cyan-500: #2cc8f7;
--cyan-400: #5adaff;
--cyan-300: #89e5ff;
--cyan-200: #b9efff;
--cyan-100: #e8faff;
--green-900: #005e36;
--green-800: #028950;
--green-700: #06b66c;
--green-600: #0de589;
--green-500: #5feb9e;
--green-400: #88f0b3;
--green-300: #aaf4c8;
--green-200: #c9f8de;
--green-100: #e6fcf3;
--orange-900: #963209;
--orange-800: #bf470a;
--orange-700: #e8600a;
--orange-600: #f78125;
--orange-500: #faa04b;
--orange-400: #fcbc73;
--orange-300: #fed59a;
--orange-200: #ffe9c3;
--orange-100: #fff9ec;
--red-900: #83111e;
--red-800: #ab1325;
--red-700: #d4142a;
--red-600: #ee243c;
--red-500: #f4495d;
--red-400: #f86e7e;
--red-300: #fc95a1;
--red-200: #febdc5;
--red-100: #ffe6e9;
--current: currentColor;
}

* {
box-sizing: border-box;
}

html, body {
font-size: unset;
}

body {
font-family: Hind,Arial,sans-serif;
font-size: unset;
-webkit-font-smoothing: antialiased;
text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-moz-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}

.banner {
max-width: 825px;
margin: 0 auto;
padding: 0 22px;
font-size: 16px;
background: white;
color: var(--grey-800);
border-radius: 6px;
box-shadow: 0px 0px 0px 0.5px rgb(50 50 93 / 10%), 0px 2px 5px 0px rgb(50 50 93 / 10%), 0px 1px 1.5px 0px rgb(0 0 0 / 7%);
display: flex;
align-items: center;
padding: 15px;
line-height: 1.15;
position: fixed;
top: 2vh;
left: 0;
right: 0;
text-align: center;
}

.banner > span {
margin: 0 auto;
}
Loading

0 comments on commit 5f75183

Please sign in to comment.