No special messages at the moment. Just have a good day and stay hydrated!
Close

Settting up a Sequelize, TypeScript, Node.js, Jest Project [Boilerplate with Repo] - Sequelize

Jun 24th, 2019 / 1 min read / Share / Edit on GitHub
For building Node.js applications, Sequelize is my personal favourite ORM. I've battle-tested it in production with a handful of real-life projects and it's still my first choice for interacting with a relational database. Here's a walkthrough of my production setup with Node.js, TypeScript and Jest.

I'm currently working on an open-source TypeScript/Node.js application called White Label where users can trade vinyl with each other. I'm building it for the purpose of teaching developers how to organize complex domain-logic using Domain-Driven Design.

In that project, I've gone the traditional route of using a relational database.

And my favourite ORM for interacting with relational databases is Sequelize.

In this quick article, I'll walk you though my project setup.

Want to just see the code? Check it out here, https://github.com/stemmlerjs/white-label.


The Sequelize ORM

Sequelize has been around for a while. When I first started building apps with Node.js in 2014, Sequelize was the most mature ORM around at the time.

There are some other awesome looking ORMs out there today, but because I've personally battle-tested Sequelize over time, it's normally been my first choice. They've even released official v5 TypeScript typings.

white-label
  └ bin 
    └ www.ts    # This is the startup script that boots the webserver
  └ dist        # Builds go here
  └ scripts  
    └ db
      └ create.js
      └ delete.js
  └ sequelize
    └ config
    └ migrations
    └ seeders
    runner.ts   # 
  .env
  .sequelizerc
  .jest.config.js



Sponsor

I hope this article was useful to you! Consider checking out my sponsors. I can continue to write quality articles for free because of them.

Discussion

Thoughts? Share the article if you think it'll be useful to someone + join the discussion about this post on Twitter!


Stay in touch!



About the author

Khalil Stemmler

Khalil Stemmler is a Developer / Designer and co-founder of Univjobs. He frequently publishes articles about Domain-Driven Design and Advanced TypeScript & Node.js best practices for large-scale applications.


View more in Software Design


You may also enjoy...

A few more related articles

Domain Knowledge & Interpretation of the Single Responsibility Principle | SOLID Node.js + TypeScript
Jun 13th, 2019 / 8 min read
The Single Responsibility Principle specifies that a class or function should only have one reason to change. Admittedly, that's n...
SOLID Principles: The Software Developer's Framework to Robust & Maintainable Code [with Examples]
May 18th, 2019 / 15 min read
The SOLID principles are a set of software design principles that teach us how we can structure our functions and classes to be as...
UML Cheatsheet | Resource
Apr 26th, 2019 / 1 min read
Here's a handy-dandy UML cheatsheet.
Name, Construct & Structure | Organizing Readable Code - Part 1
Jun 15th, 2019 / 6 min read
Naming files & folders well, using well-understood technical constructs and strategically organizing files well are three ways to ...

Want to be notified when new content comes out?

Join 2000+ other developers learning about Domain-Driven Design and Enterprise Node.js.

I won't spam ya. 🖖 Unsubscribe anytime.

Get updates