NestJS boilerplate is a project that contains all necessary libraries and solutions like auth, mailing, etc. for fast-starting your project using a classic REST API approach.
Created in August 2020 it now has more than 700 stars on Github, and quite a big community around helping to develop it feature.
Motivation
I'm working for outsourcing company Brocoders, where we start new project from scratch quite often. NestJS is a popular framework for Node.js and we use it widely. However, setting up the project from scratch every time can be time-consuming, involving stuff such as configuring the database, migrations, seeding, mailing, sign-in, sign-up, translations, file uploading, etc.
To solve this problem, we created NestJS REST API Boilerplate with preconfigured basic features, for reducing app setup time from 1 month to just a few hours.
At the time we started our own boilerplate, there wasn't great production-ready alternative, so we decided to develop our own solution, that eventually became quite popular in other companies too.
Modules and features
We put the most popular modules always requested by our clients and put them together into a Boilerplate. So we finally have such a list of features included from the box:
- Database (PostgreSQL, TypeORM).
- Seeds (test data)
- Config Service (@nestjs/config).
- Mailing (nodemailer, u/nestjs-modules/mailer).
- Sign in and sign up via email
- Forgot password
- Social sign in (Apple, Facebook, Google, Twitter)
- Admin and User roles
- Serialization
- Translations I18N (nestjs-i18n)
- File uploads. Support local and Amazon S3 drivers
- Swagger for API documentation
- E2E and units tests
- Docker
- CI (Github Actions)
The main advantage of the NestJS Boilerplate by Brocoders is complementary frontend React Boilerplate that works greatly with this backend: Extensive React Boilerplate.
Quick start
In order to start a new project you just need to follow the basic instructions:
1. Clone repository
git clone --depth 1 https://github.com/brocoders/nestjs-boilerplate.git my-app
2. Go to folder, and copy env-example as .env
cd my-app/
cp env-example .env
3. Change DATABASE_HOST=postgres
to DATABASE_HOST=localhost
. Change MAIL_HOST=maildev
to MAIL_HOST=localhost
4. Run additional container:
docker compose up -d postgres adminer maildev redis
5. Install dependency
npm install
6. Run migrations
npm run migration:run
7. Run seeds
npm run seed:run
8. Run app in dev mode
npm run start:dev
9. Open http://localhost:3000
Summary
If you want start a project faster - you can try NestJS REST API boilerplate. It's quite simple, supported by our company, and well-written (I hope :-) )
The main in our plans currently is to improve documentation and keep all the dependencies up-to date. And if somebody have any other ideas or want to become a contributor - we always happy to meet new friends and accept pull requests.
Full Credits to the main developer: Vlad Shchepotin 🇺🇦
Top comments (0)