DEV Community

Cover image for Backend Generator
Leshawn Rice
Leshawn Rice

Posted on

Backend Generator

Every time I make a backend in express, there’s always a small period of time at the start where I’m writing the same code just to get the backend setup.

Error methods, authentication middleware, a user model, the database, basic login/register routes. All of these are essentially the same across my express backends save for the database schema.

As I started up on configuring the backend for my latest project, I thought to myself, “Why don’t I just automate this?”

Now, there are already tools available to generate an express backend for you, but as I’ve been working with ansible a lot lately at work, I figured I’d write a playbook to quickly generate an express backend with some basic user input.

The result is express-generator.

express-generator is essentially an ansible playbook run by a bash script that just takes some input to pass as variables to ansible. It’s lightweight, quick, and super easy to use: just download the source code, run bash setup.sh, then the next time you wanna create a backend in express, simply run express-generator from the command line and voila!

Discussion (0)