Git Product home page Git Product logo

escapable-amp's Introduction

Escapable

Escapable is a resource site for escape rooms powered by Firebase and Accelerated Mobile Pages (AMP). It was used as a demonstration in the 2018 Google I/O session "Blazing fast web content with Firebase and AMP".

This is a hasty demo code dump, bugs to be expected ๐Ÿ˜„

License

Copyright 2018 Michael Bleigh.

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.

escapable-amp's People

Contributors

mbleigh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

escapable-amp's Issues

Help with Implementation

Hello Michael. I have watched this video no less than ten times. Cudos to you for presenting such a compelling and exciting strategy for performance. I am having difficulty implementing this approach into my current project(s) particularly implementing the bucket proxy and storage.

I am getting the following error (I added 'err' to Not Found in app.ts in rs.on("error"):
Not Found: ApiError: No such object: xxxxx.appspot.com/some-folder/some-file.html

Questions:

  1. Do I have to load storage with static files of each possible request, i.e. one per document in Firestore?
  2. Or should I build in a test to see if the file exists in storage, and if not, render the page and deliver a copy to storage afterwards, and if so, how is this accomplished?
  3. Is there more information besides the video, e.g. blog article or tutorial?

Thank you so much @mbleigh !!

Possibility for Stale Content

I really like the idea you describe about Evented Rendering here: https://youtu.be/7_2CJs_VZk4?t=1720

Maybe I'm missing something, but wouldn't it be possible to end up with stale contend for a whole year (worst case) in your example? I see the following scenario:

  1. A region gets updated.
  2. updateRegionPage() is called. This prerenders the page.
  3. writeAndPurge() is called. This writes the prerendered page to Cloud Storage and purges the page on Firebase Hosting.
  4. The next time the page is requested, Firebase Hosting serves it from Cloud Storage via Cloud Functions (with a CDN cache s-maxage of one year).

Imagine that while the Cloud Function in step 4 is running, the region gets updated a second time which starts the process again. The following could be possible:

(Process 1): Is not finished with step 4. It already has the stale page from Cloud Storage but hasn't served it yet.
(Process 2): Goes through step 3. It prerenders and purges the page.
(Process 1): Finishes with step 4. This means that Firebase Hosting serves the stale page and caches it for a year.

I don't know how likely this is but it would be quite bad if it happens since it is really hard to find the bug and the client has no possibility to get the correctly rendered page for potentially a whole year.

I hope that I'm wrong. Or is there anything you could do about that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.