Skip to content

Commit

Permalink
Readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rbs333 committed Jul 30, 2024
1 parent e00858c commit 4db2e2e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
push:
branches:
- main
- feat/RAAE-9/repo-upgrades

jobs:
test:
Expand Down
85 changes: 59 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

<div align="center">
<a href="https://github.com/spartee/redis-vector-search"><img src="https://github.com/Spartee/redis-vector-search/blob/master/app/vecsim_app/data/redis-logo.png?raw=true" width="30%"><img></a>
<a href="https://github.com/spartee/redis-vector-search"><img src="https://redis.io/wp-content/uploads/2024/04/Logotype.svg?raw=true" width="30%"><img></a>
<br />
<br />
<div display="inline-block">
<a href="https://ecommerce.redisventures.com"><b>Hosted Demo</b></a>&nbsp;&nbsp;&nbsp;
<a href="https://github.com/Spartee/redis-vector-search"><b>Code</b></a>&nbsp;&nbsp;&nbsp;
<a href="https://github.com/redis-developer/redis-product-search"><b>Code</b></a>&nbsp;&nbsp;&nbsp;
<a href="https://redis.io/docs/stack/search/reference/vectors/"><b>Redis VSS Documentation</b></a>&nbsp;&nbsp;&nbsp;
</div>
<br />
Expand Down Expand Up @@ -33,13 +33,10 @@ The following Redis Stack capabilities are available in this demo:
This app was built as a Single Page Application (SPA) with the following components:

- **[Redis Stack](https://redis.io/docs/stack/)**: Vector database + JSON storage
- **[FastAPI](https://fastapi.tiangolo.com/)** (Python 3.8)
- JWT authentication using [OAuth2 "password
flow"](https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/) and
PyJWT
- **[RedisVL](https://redisvl.com)** for Python vector db client
- **[FastAPI](https://fastapi.tiangolo.com/)** for backend API
- **[Pydantic](https://pydantic-docs.helpmanual.io/)** for schema and validation
- **[React](https://reactjs.org/)** (with Typescript)
- **[Redis OM](https://redis.io/docs/stack/get-started/tutorials/stack-python/)** for ORM
- **[Docker Compose](https://docs.docker.com/compose/)** for development
- **[MaterialUI](https://material-ui.com/)** for some UI elements
- **[React-Bootstrap](https://react-bootstrap.github.io/)** for some UI elements
Expand All @@ -48,6 +45,43 @@ This app was built as a Single Page Application (SPA) with the following compone
Some inspiration was taken from this [Cookiecutter project](https://github.com/Buuntu/fastapi-react)
and turned into a SPA application instead of a separate front-end server approach.

### General Project Structure

```
/backend
/productsearch
/api
/routes
product.py # primary API logic lives here
/db
load.py # seeds Redis DB
redis_helpers.py # redis util
/schema
# pydantic models for serialization/validation from API
/tests
/utils
config.py
spa.py # logic for serving compiled react project
main.py # entrypoint
/frontend
/public
# index, manifest, logos, etc.
/src
/config
/styles
/views
# primary components live here
api.ts # logic for connecting with BE
App.tsx # project entry
Routes.tsk # route definitions
...
/data
# folder mounted as volume in Docker
# load script auto populates initial data from S3
```

### Datasets

The dataset was taken from the the following Kaggle links.
Expand All @@ -56,12 +90,10 @@ The dataset was taken from the the following Kaggle links.
- [Smaller Dataset](https://www.kaggle.com/datasets/paramaggarwal/fashion-product-images-small)


## Running the App
## Running the App with docker-compose
Before running the app, install [Docker Desktop](https://www.docker.com/products/docker-desktop/).



#### Redis Cloud (recommended)
#### Using Redis Cloud (recommended)

1. [Get your Redis Cloud Database](https://app.redislabs.com/) (if needed).

Expand All @@ -79,34 +111,35 @@ Before running the app, install [Docker Desktop](https://www.docker.com/products

> The benefit of this approach is that the db will persist beyond application runs. So you can make updates and re run the app without having to provision the dataset or create another search index.

#### Redis Docker
#### Using Redis Docker
```bash
$ docker compose -f docker-local-redis.yml up
```

### Customizing (optional)
You can use the Jupyter Notebook in the `data/` directory to create product embeddings and product metadata JSON files. Both files will end up stored in the `data/` directory and used when creating your own container.

Create your own containers using the `build.sh` script and then make sure to update the `.yml` file with the right image name.

## Running without docker-compose

### Using a React development env
It's typically easier to write front end code in an interactive environment, testing changes in realtime.
### Run frontend

1. Deploy the app using steps above.
2. Install NPM packages (you may need to use `npm` to install `yarn`)
1. Install NPM packages
```bash
$ cd gui/
$ yarn install --no-optional
$ cd frontend/
$ npm install
````
4. Use `yarn` to serve the application from your machine
2. Use `npm` to serve the application from your machine
```bash
$ yarn start
$ npm run start
```
5. Navigate to `http://localhost:3000` in a browser.
3. Navigate to `http://localhost:3000` in a browser.

All changes to your local code will be reflected in your display in semi realtime.

### Run backend
Pre-step: install [poetry](https://python-poetry.org/).

1. `cd backend`
2. `poetry install` to get necessary python deps
3. `poetry run start` to launch uvicorn server with FastAPI app

### Troubleshooting
Sometimes you need to clear out some Docker cached artifacts. Run `docker system prune`, restart Docker Desktop, and try again.

Expand Down

0 comments on commit 4db2e2e

Please sign in to comment.