PaulBeaudet / contact-me-gatsby

This is a landing page to leave a message for its host or engage in a voice conversation with them via WebRTC
MIT License
0 stars 0 forks source link

Contact

This statically generated site gives ways to contact its Author.

Setup

Universal prep

Local Development setup

Development updates

run "npm start" in top level directory with valid dev_config.sh available.

Production setup

Planning to eventually automate the set-up steps, but it's far from it right now so plan on some quality time with the aws-cli or their web interface.

Deployment updates

run ./awsDeploy.sh with valid prod_config.sh available.

Notes on client side frameworks and libraries

Gatsby

This static site is generated via the Gatsby-js framework. In retrospect Gatsby is probably not the best tool for this particular application. At the project onset it was more of a learning experiment because a statically generated site is desirable. Gatsby is good for medium sized content heavy sites that are generated from one or many sources of information. Particularly where the developer wants to use React-js to structure components of the site and GraphQL to query content.

The nature of how Gatsby pre-compiles code assumes all DOM manipulation to be managed by the shadow DOM. Making it a bit kludgy to use with things like a third party authentication libraries or WebRTC. Libraries or components that assume the existence of browser based objects like window, document or navigator fail in a pre-compilation step that uses Nodejs. With the Node interpreter lacking those browser globals. This issue requires conditional wrappers to check for those types of objects before using them in an expected way.

It's nice Gatsby's includes AST tools like the typescript compiler, however the default configurations are geared towards Gatsby's use cases or architecture. One example of this is typing in typescript files not being strictly required. Overall Gatsby is a powerful tool that can be applied many use cased outside of statically generated blogs. However, do it again, other options would be considered for this particular application. The heft of the required libraries and compilation times have been undesirable for a short development trial and error loops as it often takes minutes to generate a significantly complex website. Included is a Hot Module Reloading tool, unfortunately this misses compilation bugs with unwrapped browser objects.

Serverless & API Gateway

The production version of the app is built with scale in mind after some trials and errors with a classic 3 tier architecture. Of course scale is not a necessary in single host setup. However the original application the backend was based on was design to have multiple host. Negotiating WebRTC handshakes for one host is a low traffic concept that could be handled by a free heroku server it wasn't for the sleep and slow start-up times. Both of with would interfere with how the original application worked. The development and production need drove a hybrid approach that allows for development to be run in a 3 tier setup and production to be service oriented in the context of serverless functions.

Production operational architecture

Production functional architecture overview

For multiple host and just a sole host this application's infrastructure configuration has a few advantages.

Cons