NdoleStudio / gist-cleaner

This is a webapp to bulk delete github gists
https://gist-cleaner.ndolestudio.com
MIT License
23 stars 2 forks source link
gist github go serverless va vercel-serverless

Gist Cleaner

Build Go Report Card Vercel

This is a web app to help you delete multiple gists on github at once. Why? Currently github doesn't provide this functionality for you to delete multiple gists at once.

if you have any suggestions/questions, open a PR or issue on github. If you're not inclined to make PRs you can tweet me at @acho_arnold!

Directory Structure

This web app follows the subscribe to the monolithic repo philosophy. So there’s one and only one repo, containing deploy scripts, frontend & backend code. The frontend code is inside the ./frontend directory and the backend code is inside the ./backend directory. There's some github-actions configuration to easily deploy to firebase when a push is one to the master branch. The code for this is found inside the ./.github/workflows directory

Architecture

Frontend

Dependencies

Philosophy

This app was created using the create react app tool since it's written in react.js that's a really handy tool to quickly build a react app with little or no configuration. I ❤️ it.

The React Router package is used to handle the routing in the frontend. There are currently just 3 routes

TailwindCss is used to build the frontend as far as styling is concerned. There are a few style.css files which contains styles which are specific to a particular page.

React-Toastify is to easily notify users when they perform a gist delete action on the app and when there's an error when doing an API request.

Pusher-Js is used to send real time socket notifications from the backend to the frontend app. When a user deletes gists, was soon as each gist is deleted by the backend, it sends a notification to the user informing them of the gist begin deleted. The free pusher-js plan is used so there's a limit to 100 simultaneous connections. To make the app resource efficient, a connection to pusher is created only when the user deletes gists and as soon as all the gists are deleted, the connection is killed.

postcss-purgecss is used to delete unnecessary tailwind css classes which are not being used anywhere. The original size of tailwindcss is 783.5kb but chances are that only a few classes are actually used throughout the project so purgecss is a really handy tool in deleted unused css files

Hosting

This app is hosted for free on firebase which provides SSD storage and a super fast global CDN (content delivery network). There's a github action configuration to deploy to firebase when a push is done on the master branch. The code for this is found in ./.github/workflows/firebase.yml.

Testing

To run tests, do the command yarn test currently there are just tests to ensure that the various components can be rendered without any errors. More tests are appreciated!

Backend

Dependencies

Philosophy

The backend is written completely in Go using serverless functions. It's hosted on Ziet and the serverless functions are written with this platform in mind.

Routing is done by the Handler method in the main.go file. There's a rule in the now.json configuration which routes all requests to this handler and this handler is responsible for calling other functions to handle the request. There are currently 3 routes

Sentry is used for application monitoring, with a focus on error reporting. It makes it really easy to see the errors that occur when running the serverless functions.

Hosting

The backend is hosted for free on Ziet (now.sh) and it's handled completely using serverless functions. The ./now.json file provides the configuration needed for building and deploying the functions. A new deploy is made to production each time there's a push on the master branch.

A point to note here is this line { "source": "(.*)", "destination": "backend/main.go" } which enforces that all requests which are made to the app are sent to the Handler function in the main.go file. So this handler function acts as a router for performing the requests.

Testing

There are no automated tests at the moment. More help will this will be appreciated!

License

MIT licensed. See the LICENSE file for details.