aws / aws/graph-explorer

Better integration of client and server

Open
#504 4 comments 0 reactions 0 assignees View on GitHub
fundamental infrastructure performance
Dominant language
TypeScript
Stars
481
Forks
108
Avg merge
6d 8h
Merged PRs (30d)
5

Description

The client React code is hosted by the proxy server by default. This means they are already linked together. We can more tightly integrate these two sides making configuration simpler, client side logic simpler, and the user experience better.

## React Router Framework Mode

Enabling framework mode on React Router will allow use of server side rendering. We can use this capability to provide the client with environment values that are read at runtime.

This will allow the client to know the proper base URL for the server, eliminating the need to set the proxy server URL in the connection.

It also opens the door to better performance if we start to move the database query logic to the server. Having the mapping logic on the server allows the response size to be much smaller. It also reduces the amount of time between cascading requests since a round trip to the client is no longer necessary.

## Default Connection Configuration

Currently, the default connection is configured in a myriad of ways.

- Environment values set at docker run time
- Environment values set in `.env` file
- A `config.json` file that sets environment values

Then a Bash script interprets all of these options and generates a `defaultConnection.json` file. That file is then served as a static file by the `/defaultConnection` endpoint in Express.

Instead, I propose simplifying the approach a bit. The `/defaultConnection` endpoint can read the environment values, validate them, and generate the proper JSON object to send to the client. This removes complex and brittle Bash code to parse and manipulate JSON files and provides an easier path to testing the logic.

## tRPC

Use tRPC for the client to server connection will add a layer of type safety and a consistent way to deal with parameter validation and errors.

It is also a chance to reconfigure how the client connects to the server.

## Tasks

- [x] #538
- [x] #623
- [ ] #507
- [ ] #537
- [ ] #539
- [ ] [Task] Fix shared library configuration
- [ ] [Task] Combine client and server
- [ ] [Task] Test tRPC setup in Neptune Notebook
- [ ] [Task] Convert logging endpoint to tRPC
- [ ] [Task] Convert default connection endpoint to tRPC
- [ ] [Task] Convert summary endpoint to tRPC
- [ ] [Task] Convert gremlin endpoint to tRPC
- [ ] [Task] Convert cypher endpoint to tRPC
- [ ] [Task] Convert sparql endpoint to tRPC

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.