API Bakery can now generate Node projects using Express web framework!
One of the most popular frameworks on the planet, Express, is a minimalistic framework for Node that you can plug other components into. As such, developers usually want to tweak it a lot and pull plenty of other packages to get a complete backend. It's easy to spend hours setting up Express project to your liking.
API Bakery simplifies all that. When you create a project, out of the box you'll get the database model layer, API routes for CRUD (create, read, update, delete) operations on your data, authentication, as well as tests for all this functionality.
We know many Node developers choose MongoDB for simplicity and ease of scale, while others prefer a relational database such as MySQL or PostgreSQL. That's why we support both: for MongoDB, we use Mongoose, while for relational (SQL) databases we use the up-and-coming developer favorite, Prisma.
You can switch between ORMs at any time - just regenerate your project and the code will be updated according to your ORM selection.
If you enable authentication, API Bakery will create a User model for you, with email, (securely hashed) password and a few other fields. No authentication framework is used, the code is small, clean and thoroughly tested. Logged-in users get a random bearer token used to authenticate every request.
We thought long and hard about which method to use, as JWTs are really popular in Node land. In the end, we decided against using them, as we believe JWTs are often more trouble than they're worth.
We also haven't used Passport.js for the similar reason. For the local auth strategy, a solution using Passport is more code, and more convoluted code, than a straight-forward implementation, with no obvious benefits. If you do want to use Passport (for example for single-sign-on with an provider such as Google or Facebook), it's easy to add, but we didn't want to force this complexity on everyone.
In modern development, tests are an invaluable tool for making sure your code actually works and stays in working condition over time. API Bakery generates tests for all custom (that is, non-framework/library) code and runs the tests before you can download the code. That's our way of ensuring the code we give you works.
During development, often it is helpful to have direct access to the database or other app functionality from the command line. Inspired by Django's
manage.py shell functionality, we provide you with an interactive Node shell with app, configuration and database models already preloaded.
If you're deploying the project as a container, you can enable optional Docker support and API Bakery will prepare a Dockerfile and instructions on how to build your container image.
To use API Bakery to generate a Node project, simply select Node/Express from the "platform" choices when starting a new project.
We've prepared detailed tutorials on how to create a new Node project and how to test and run it once it's created:
If you're not already an API Bakery user, sign up today and get a 14-day free trial where you can test all of this and see for yourself how much time API Bakery can save you on each project.
API Bakery generates boilerplate code for your backend service in seconds. Out of the box you get routes, data models, authentication, validation, tests, and integrations - customized for you and ready for production.
Try for free No credit card required