This is a demo app to show my expertise with React, React Router, Redux, Redux Saga, Styled Components and the rest.
It took:
- TypeScript
- React
- React Router
- React Redux
- Redux Saga,
- Styled Components
- Webpack
- Yarn
- Some fresh beer
As it's a client app, you will need Node (latest version or something that is not too ancient should work). I prefer to use Yarn as my package manager these days but NPM should work just fine.
When you have Node installed here are next steps:
- Run
yarn install
ornpm install
inside the folder. It will install all deps. - Run
yarn start
ornpm start
which will compile the code and run the app on some port of localhost. By default it's 9001, but if busy, it will be different, copied automatically to clipboard on compilation, you will see the message. In the simplest case, if you don't copy anything to clipboard during compilation, then just past in the browser address bar and it should be the right url. - When it compiles and you run the app, it redirects you to default organisation page, now it's facebook.
Look at some gifs in this repo inside
gifs
folder to see how it works on my macbook and don't claim it doesn't work on yours ;).
Organisations have their own urls like /org/facebook
. This url shows some info about the organisation and a list of its repos sorted by watchers count and showing them.
By clicking a repo you make the app load information about the repo that shows on the top right of the page and contributors list on the bottom right with links to their profiles and avatars.
Repo route looks like /org/facebook/react
.
Selected repo in the list is highlighted.
When you choose another organisation from the dropdown selector on the top right, the route changes and respective organisation data loads.
As we suppose that repos and organisation data doesn't change often, we can use caching technique so that when we change the organisation and it's already in cache, dont' run an extra request, but rather load it from local data storage. So, if a request to some endpoint happened before, and is addressed now, it runs quicker.
Requests to these endpoints are cache-enabled:
- Organisation details
- Organisation repos list
- Repo details
- Repos contributors list
If you don't use an access token (described below), you might face issues with running out of requests limit. To help you with understanding of how many requests you have remaining during the current time period, you can have a a look at the header of the app to see some details about it.
Github allows you to run unauthorized API requests but it's just about 60 requests per hour which is quite a low number. It wasn't enough for me to build the app so I dug deeper with the tokens they mention and found the solution.
- Go to https://github.com/settings/tokens, click
Generate new token
, copy to clipboard. - Copy
.env.example
to.env
in the root of the folder and copy your token which should look likee3308b593e828ab4b1f6a1e61cce6c8b779877c2
nearGITHUB_ACCESS_TOKEN=
so the file contents becomes something like this:GITHUB_ACCESS_TOKEN=e3308b593e828ab4b1f6a1e61cce6c8b779877c2
. Save it. - Start the app with
yarn start
ornpm start
. - Now you have 5000 requests per hour. Is it enough?
If you don't run through this token-schmoken playgame, you still have your 60 requests which might be enough to estimate the app.