Code Monkey home page Code Monkey logo

photo-gallery's Introduction

photo-gallery

Get Started

Yarn is not required. Anywhere it says yarn <command> you can sub in npm run <command>.

Upon install:

  1. Run yarn or npm install
  2. Put your Flickr credentials in flickr_crendentials.json in the format: {"api_key": "<your key here>", "secret": "<your secret here>"}.

For development

  1. Run yarn dev:api in one terminal
  2. Run yarn dev in another terminal
  3. Open http://localhost:8080 in a browser

For production

  1. Run yarn build
  2. Run yarn start
  3. Open http://localhost:3000 in a browser.

Commands

  • build: Runs Webpack to build a production build of your CSS and JS
  • dev: Runs the webpack-dev-server which runs a local server on 8080, builds and serves dev builds of your JS and CSS as well as proxies requests to your API server
  • dev:api: Runs a local API server that proxies the Flickr API
  • format: Runs the code through Prettier, a JavaScript code formatter
  • lint: Runs the code through ESLint. This code adheres to the Airbnb rules (inasmuch they don't conflict with Prettier)
  • size-css: Prints out the size of the CSS after minification and gzip
  • size-js: Prints out the size of the JS after minification and gzip
  • start: Runs a production-ready Express server that proxies the Flickr API as well as serves your already built CSS and JS on http://localhost:3000
  • test: Runs the Jest test suite
  • test:update: Updates the Jest snapshots
  • types: Runs the Flow static type checker
  • validate: Runs the full suite: format, lint, types, test, size-css and size-js

Built With

  • Node
  • Webpack
  • Babel w/ preset-env and static class properties
  • Preact
  • Preact-Router
  • Postcss, cssnano, and cssnext
  • Flow
  • ESLint
  • Prettier
  • Jest
  • Express

Final results

  • gzip and minified JS: 7.11KB
  • gzip and minified CSS: 1.43KB
  • Tested with 18 unit tests, linted, and statically typed
  • Google Lighthouse
    • Performance: 97
    • Accessibility: 94
    • Best Practices: 83 (not using HTTP2 or manifest)

Directions to Go

  • Service worker: was planned and architected to use, just ran out of time
  • Server-side rendering: had it finished but greatly increased complexity of code, little gain
  • Code-splitting: app is already tiny; the savings would be too small to justify complexity
  • More gestures: swiping between images
  • Pagination on search images

photo-gallery's People

Contributors

btholt avatar vinnya3 avatar

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.