Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Jump-start your node backend
neoan
neoan

Posted on

     

Jump-start your node backend

For the impatient readers

After setting up backends with JWT authentication middleware and basic structure too many times, I wanted something that is clean enough to be used as a boilerplate, and abstracted enough that I can develop rapidly. Here is the result:

clone & start

What we are aiming for

The first step is looking at dependability and scalability and therefore looking at testing & CI is the basis.
Jest & supertest seem to be good candidates for writing tests whiletravis-ci andcodeclimate have been my go-to for coverage reports and continuous integration. We also want type save development so typescript is the obvious choice.
As most developers are familiar with express, we are not going to make any esoteric choices regarding the server. Other than that, we want to limit boxing us in as far as possible.

The database

I decided on MySQL but wanted to make sure we can migrate easily in case we maintain active projects. Rather than choosing an orm, I decided to write my own SQL wrapper for common CRUD operations that can be easily abstracted in order to save myself (and others) from repeating business logic. The result is a model system that uses an abstracted resolver for creating, finding getting and updating model entities.

Authentication

JWT seems to be the most versatile way of authentication and providing middleware, a user model and signup & login routes seemed a logical step as I would else have to write this in every project. Instead, simple changes to the user model depending on my needs seems reasonable.

The result

I soon noticed that the result was more solid than originally anticipated and adding a license to throw it at the public seemed logical. However, you are the judge of that so I would be happy if you gave it a spin and provided some feedback. Have fun!

repo

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Passionate generalist conquering the web one project at a time. Whether authoring libraries for node, JS, PHP, or Rust, I am always on the lookout for better solutions to common problems.
  • Location
    USA
  • Work
    Lead Developer & Co-founder at corpscrypt, CTO at REtech
  • Joined

More fromneoan

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp