DEV Community

loading...
Cover image for Introducing glitcheroo: The simple deployment tool for Glitch

Introducing glitcheroo: The simple deployment tool for Glitch

David Kramer
A maker and a leader.
・3 min read

Glitch is a free and simple online platform for creating Node.js-based web apps. The friendly, creative Glitch community has shared millions of projects publicly that you can use, view the source code for, and even remix into your own apps. I think Glitch is the best thing to happen to coding in a long time. If you haven't checked it out yet, you should!

glitcheroo is a new command-line tool that enables you to easily deploy a Node.js app to an existing Glitch project, replacing its previous contents. The app you are deploying could be hosted in another Glitch project, or stored in a Git repository on your local device.

Let's review the two primary workflows supported by glitcheroo.

Workflow 1: Remix on Glitch, deploy to Glitch

The Glitch-based workflow is most useful when you have an app that you've developed and shared with other people but want to continue to edit on Glitch. Depending on the circumstances, your app could end up being unavailable to your users for a period of time while you are editing it. Or even worse, your app might be available but in an inconsistent state, which (in the most extreme cases) could lead to data-loss for some users. Not good.

This is where glitcheroo comes to the rescue. Instead of editing the app's project directly, first you remix project on Glitch, then you make your changes in the new project, and finally you deploy them back to the original project with glitcheroo. You deploy the changes by running the following command in the terminal of the new project:

npx glitcheroo deploy

The first time you run this command you will be asked to provide the Git URL of the original project. (See below for how to find it.) The URL will be saved as a Git remote tracked repository and automatically re-used on subsequent deploys.

(Note: The original project must be configured to receive deployments. See below.)

After this command completes Glitch will automatically detect the project change, reinstall the dependencies, and start the deployed app. Your users won't notice a thing!

Workflow 2: Remix locally, deploy to Glitch

The local-device-based workflow is useful if you prefer to edit your app offline. This might be because you can't access the Internet for a period of time, or simply because you prefer to use a local editor instead of the online Glitch editor. In this case the workflow is to remix the Glitch project to your local device, make changes in the local project, and then deploy them back to Glitch.

To make this easier, glitcheroo includes a remix command. You can remix a Glitch project to your local device by running the following command in the terminal of your local device:

npx glitcheroo remix

You will be asked to provide the Git URL of the project you want to remix. (See below for how to find it.) The URL will be saved in a Git as a remote tracked repository and automatically re-used when you deploy the project. You can run the following command to deploy the local app back to the original project:

npx glitcheroo deploy

(Note: The original project must be configured to receive deployments. See below.)

After this command completes Glitch will automatically detect the project change, reinstall the dependencies, and start the deployed app.

Pre-requisite: configure the target to receive deployments

Before you can deploy to a target project you must first configure it to receive deployments. You can run the following command in the terminal of the Glitch project you want to target:

npx glitcheroo setup-target

This only needs to be done once per target project.

WARNING: This command allows the Glitch project to be completely overwritten via remote Git operations.

How to find the Git URL of the target

Both workflows require you to provide the target project's Git URL. This URL contains an API secret and must be kept safe from prying eyes. You can find a project's Git URL in its online Glitch editor, in the "Tools > Import and Export" panel.

Conclusion

I am the author of the glitcheroo tool. I'd love to hear your feedback about it. The project is hosted on GitHub, and new issues and pull requests are always welcome.

This project was inspired by Melissa McEwen's fascinating article Automating My Deploys From GitHub to Glitch, published on DEV on April 21, 2020.

Huge thanks to Glitch for providing a great service. This project is not affiliated with Glitch in any way.

Discussion (3)

Collapse
melissamcewen profile image
Melissa McEwen

Wow this is awesome and I'm going to try it out on some smaller internal projects. Thanks for making this and writing it up! I love the logo too!

Collapse
rowemore profile image
Rowe Morehouse

Totally awesome. Now I can work in github — with all its familiar features — and deploy to glitch with npx glitcheroo deploy.

Collapse
bacongravy profile image
David Kramer Author

Thanks! I'm glad it is useful for you.