Coder Social home page Coder Social logo

gitmap's Introduction

A location based job board powered only by GitHub.

This demo explores the possibility of building a "serverless" location based app by using only GitHub's cool ability to render GeoJSON files as interactive maps, and the powerful GitHub API (Nicely wrapped by Github.js).

The map view is rendered by GitHub from a GeoJSON file stored on GitHub pages and new entries are added to it by forking and creating a pull request on behalf of the submitting user. This GitHub "serverless" architecture is powered by using GitHub itself as the app's database and writing to it by using GitHub's API directly from the user's browser.

gitmap

How GitMap Works?

  • The static site is served by GitHub pages.
  • The main page loads a render.githubusercontent iframe which renders the map.geojson as a full screen map.
  • When publishing a new entry, your browser will execute the calls to GitHub API by using Github.js
  • A request will be sent by you to fork this repository.
  • The map.geojson file in the forked repository will be edited to contain the new published data.
  • A pull request will be created on your behalf, to merge the new data to the main repository.
  • Your pull request will be manually approved and merged, and the new data will show up on the map after a few moments.

GitHub Authentication

GitHub OAuth requires that a secret client key will be used to convert the GitHub user login code to the authorization token. Since it is considered unsafe to expose this key, instead of storing it in the webapp I had set up a small hook.io hook to do the conversion using the secret key. Because this architecture is very irregular I am not sure that the impact of exposing the client secret fully apply to it, so I will reconsider this in the future.

Why is map.geojson filed with empty entries?

This was a very simple trick to avoid merge conflicts issues. Every user adds his new entry in a random line in the file, which makes the chances of two users editing the same line simultaneously very slim. (The probability might still be higher than what you would expect as in the similar case of the Birthday problem)

My first project with react

Me working with react

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.