Skip to content

anish-sahoo/AnimeDiscovery

Repository files navigation

AnimeVisualizer

Alt

System Architecture

Network Config:

Service Host Port Container Port Purpose
postgres 7001 5432 PostgreSQL database
elasticsearch 7002 9200 Elasticsearch HTTP API
elasticsearch 7003 9300 Elasticsearch transport
redis 7004 6379 Redis cache
ml-service 7005 7005 ML gRPC server
ml-service 7006 7006 grpcui web UI for ML service
spring server 7007 8080 Graph layer
rec-service 7008 7008 Recommendation gRPC server
rec-service 7009 7009 grpcui web UI for Rec service
alloy 7010 12345 alloy web UI
alloy 7011 4317 alloy rest endpoint
alloy 7012 4318 alloy grpc endpoint
kibana 7013 5601 kibana web ui
frontend 7014 3000 Next.js frontend (animediscovery.com)

caddy config for utils

anime.asahoo.dev {
	# ---------REDIRECTS-------------------------------------------------
        @mlGrpcuiNoSlash {
                path_regexp mlNoSlash ^/ml-service/grpcui$
        }
        redir @mlGrpcuiNoSlash /ml-service/grpcui/ 308

        @recGrpcuiNoSlash {
                path_regexp recNoSlash ^/rec-service/grpcui$
        }
        redir @recGrpcuiNoSlash /rec-service/grpcui/ 308

        @alloyNoSlash {
                path_regexp alloyNoSlash ^/alloy$
        }
        redir @alloyNoSlash /alloy/ 308

        @kibanaNoSlash {
                path_regexp kibanaNoSlash ^/kibana$
        }
        redir @kibanaNoSlash /kibana/ 308

	# -----------KIBANA---------------------------------------------------
	handle_path /kibana/* {
                reverse_proxy localhost:7013
        }

	# ---------BACKEND--------------------------------------------

        @graphqlExact {
                path /graphql
        }
        reverse_proxy @graphqlExact localhost:7007

        @apiGraphExact {
                path /api/graph
        }
        reverse_proxy @apiGraphExact localhost:7007

        redir /graphql/ /graphql 308
        redir /api/graph/ /api/graph 308

        # ----------ML_SERVICE------------------------------------------------
        handle_path /ml-service/grpcui* {
                reverse_proxy localhost:7006
        }
        handle_path /ml-service/static* {
                reverse_proxy localhost:7006
        }
        handle_path /ml-service/* {
                reverse_proxy localhost:7005
        }

        # -----------REC_SERVICE------------------------------------------

        handle_path /rec-service/grpcui* {
                reverse_proxy localhost:7009
        }
        handle_path /rec-service/static* {
                reverse_proxy localhost:7009
        }
        handle_path /rec-service/* {
                reverse_proxy localhost:7008
        }

        # ------------UTILS----------------------------------------

        handle_path /alloy/* {
                reverse_proxy localhost:7010
        }

        # -------------SPRING----------------------------------------
	reverse_proxy localhost:7014
}

Troubleshooting steps:

Elastic api key:

curl -s -u "elastic:$ELASTIC_PASSWORD" -X POST "http://localhost:7002/_security/api_key" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "anime-dev-key",
    "role_descriptors": {} }' | jq .

Graph schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Generated schema for Root",
  "type": "object",
  "properties": {
    "metadata": {
      "type": "object",
      "properties": {
        "total_nodes": {
          "type": "number"
        },
        "total_edges": {
          "type": "number"
        },
        "dimensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "edge_dimension": {
          "type": "string"
        },
        "generated_at": {
          "type": "string"
        },
        "clustering_algorithm": {
          "type": "string"
        },
        "export_version": {
          "type": "string"
        }
      },
      "required": [
        "total_nodes",
        "total_edges",
        "dimensions",
        "edge_dimension",
        "generated_at",
        "clustering_algorithm",
        "export_version"
      ]
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "cluster_3d": {
            "type": "number"
          },
          "coordinates_2d": {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "coordinates_3d": {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "title": {
            "type": "string"
          },
          "popularity": {
            "type": "number"
          },
          "rank": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "cluster_3d",
          "coordinates_2d",
          "coordinates_3d",
          "title",
          "popularity",
          "rank"
        ]
      }
    },
    "edges": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "weight": {
            "type": "number"
          }
        },
        "required": [
          "from",
          "to",
          "weight"
        ]
      }
    }
  },
  "required": [
    "metadata",
    "nodes",
    "edges"
  ]
}

todo:

--- clicking on anime to display its neighbors

lazy loading neighbors of an anime
api/graph/cluster?id=123

server side impl:
- redis should be good

client side:
- lru of recently selected clusters
smaller graph, optimized for mobile devices

update api/graph to allow an optional nodes query param. Precompute or cache graphs where it extracts the top X number of nodes from the original big graph based on score
do more research on ux for the explore page
- what do i want the user to be able to do?
- how much data should be displayed?
animation quality?
overrated, underrated, etc. labeling

About

Trying to create the most powerful Anime Recommendation System that exists!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors