A full-stack application to track GitHub repository releases using GraphQL, Apollo Client, React, and PostgreSQL.
- Track multiple GitHub repositories
- View latest release notes with Markdown rendering
- Mark releases as seen
- Sync all repositories for latest releases
- Client-side caching with Apollo Client
- Material-UI design
- Node.js (v18 or higher)
- PostgreSQL (v14 or higher)
- npm or yarn
git clone <repository-url>
cd repository-trackercd backend
npm run db:setupNote: If your psql user is not "postgres", please modify this script in package.json to use your correct username.
"db:setup": "psql -U postgres -f dbsetup.sql"
Backend:
Modify backend/.env with your psql credentials:
DB_USER=postgres
DB_PASSWORD=your_password_herenpm installThis will install concurrently and install both backend and frontend dependencies.
npm run devThis will launch frontend and backend processes concurrently.
Add your GitHub API token to the .env.test file to avoid rate limits.
Make sure to configure your DB_USER and DB_PASSWORD variables as well to match your .env file!
From the project root
Test: npm run test:backend
Test with coverage report: npm run test:backend:coverage
Updates must be fetched by using the Sync Releases button. This makes testing the synchronization logic easier, and it's unlikely a repository will actually trigger a new release during the current usage of the app. If this were made for a production, a goodway to implement this would be webhooks via GitHub API, as suggested.
This feels a little unintuitive, that a user must find the owner / repository name themselves. I used these values for the form because that's what the octokit API needs to fetch a repository. It would probably be more intuitve for the user to just paste the URL instead, and would be fairly straightforward to implement, we would just add URL parsing logic into the getRepo function in octokit.ts.
An even better solution could be to use a search REST API to display a list of repositories that match the search, and the user can add repositories from the list of matched repositories.
I kept it this way for testing purposes, as it makes it easier to test both the repository release fetching, as well as the seenByUser flag. This could be pretty easily implemented using fetchLatestRelease method in octokit.js when adding a repository.
User must manually re-click their currently selected repository to see the latest release. On one hand, it does clearly show that a new release is there, but on the other, it does feel a bit unintuitive.
Repositories are sorted alphabetically, but a new repository always gets added to the bottom of the list. It should insert where appropriate, and syncing releases does reorganize the alphabetical order. Different options for sorting could also be implemented, as well as filtering, as mentioned in the stretch goals.
Some kind of user feedback should be given when an error occurrs on the addRepo mutation.
Persistent caching could be implemented to improve performance on future releoads and visits to the application.
Stretch goal, as suggested. Has not been tested or designed for mobile responsiveness.
There are a number of useful keys from the Github API result that could enhance the user exprience, including:
- Github URL
- Release URL
- Owner
- Repo Stars