All Projects → konfer-be → typeplate

konfer-be / typeplate

Licence: MIT license
REST API boilerplate with Typescript, Express.js, Typeorm and Mocha.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to typeplate

Javascript Testing Best Practices
📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (August 2021)
Stars: ✭ 13,976 (+5114.93%)
Mutual labels:  mocha, e2e-tests
Root Cause
🔍 Root Cause is a tool for troubleshooting Puppeteer and Playwright tests. 🔎
Stars: ✭ 205 (-23.51%)
Mutual labels:  mocha, e2e-tests
nestjs-api-mongoose
Collection example apps with NestJS and Typeorm, Sequelize, Mongodb, PostgreSQL, MySQL, GraphQL, Mercurius, etc. for the NestJS community 😻
Stars: ✭ 153 (-42.91%)
Mutual labels:  api-rest, typeorm
AniAPI
Core behind AniAPI HTTP Rest APIs.
Stars: ✭ 144 (-46.27%)
Mutual labels:  api-rest
nestjs-starter
🚀 Nest framework starter
Stars: ✭ 30 (-88.81%)
Mutual labels:  typeorm
typeorm-factories
Create factories for your TypeORM entities. Useful for NestJS applications
Stars: ✭ 43 (-83.96%)
Mutual labels:  typeorm
DummyJSON
DummyJSON provides different types of REST Endpoints filled with JSON data which you can use in developing the frontend with your favorite framework and library without worrying about writing a backend.
Stars: ✭ 213 (-20.52%)
Mutual labels:  api-rest
TvrboReact
Dream starter project: React, Redux, React Router, Webpack
Stars: ✭ 13 (-95.15%)
Mutual labels:  mocha
mocha-wrap
Fluent pluggable interface for easily wrapping `describe` and `it` blocks in Mocha tests.
Stars: ✭ 54 (-79.85%)
Mutual labels:  mocha
cypress-page-object
Represent the screens of your website as a series of objects in your Cypress test suite
Stars: ✭ 23 (-91.42%)
Mutual labels:  e2e-tests
babel-example
Example how to use TypeORM with JavaScript + Babel.
Stars: ✭ 51 (-80.97%)
Mutual labels:  typeorm
cv4pve-api-php
Proxmox VE Client API for PHP
Stars: ✭ 45 (-83.21%)
Mutual labels:  api-rest
api-server-nodejs
Nodejs API Server - Express / SQLite / TypeORM | AppSeed
Stars: ✭ 171 (-36.19%)
Mutual labels:  typeorm
react-native-unit-tests
Example how to test React Native components
Stars: ✭ 79 (-70.52%)
Mutual labels:  mocha
js-stack-from-scratch
🌺 Russian translation of "JavaScript Stack from Scratch" from the React-Theming developers https://github.com/sm-react/react-theming
Stars: ✭ 394 (+47.01%)
Mutual labels:  mocha
jest-retry
Jest retry pattern for flaky E2E tests
Stars: ✭ 36 (-86.57%)
Mutual labels:  e2e-tests
market place api 6
Code example of API on Rails 6 book https://github.com/madeindjs/api_on_rails
Stars: ✭ 18 (-93.28%)
Mutual labels:  api-rest
Approvals.NodeJS
Approval Tests implementation in NodeJS
Stars: ✭ 79 (-70.52%)
Mutual labels:  mocha
currency-api
A demo project on how to test a node/express app with Mocha, Nock and proxyquire (MNP) and code coverage with nyc/istanbul.
Stars: ✭ 19 (-92.91%)
Mutual labels:  mocha
mocha-allure2-example
Allure 2 Mocha examples
Stars: ✭ 18 (-93.28%)
Mutual labels:  mocha

Typescript / Express / Typeorm REST API boilerplate

Node TypeScript Express Typeorm Mocha

Build Coverage Status CodeFactor Grade Requires.io (branch) Snyk Vulnerabilities for GitHub Repo

MIT Licence

Ready to use RESTful API boilerplate builded with Express.js, Typescript TypeORM and Mocha. 🤘

Thanks to Daniel F. Sousa for inspiration with her Express ES2017 REST API boilerplate 🍺 🍺 🍺

> Features

  • Basics
    • Clear & clean code architecture with classic layers such controllers, services, repositories, models, ...
    • Object Relational Mapping with typeorm.
    • Entity generation with rsgen.
    • Business validation with self designed business members.
    • Logs management with morgan and winston.
    • Changelog completion with auto-changelog.
    • Testing with included unit and e2e test sets builded with mocha, chai, sinon and supertest.
    • Documentation with api-doc.
  • Security
  • Authentication
  • Performances
  • Assets management
    • Customizable file upload with multer.
    • Customizable image resizing with jimp.

> Table of contents

> Getting started

Prerequisites

  • Git
  • Node.js >= 14.16.0
  • NPM >= 6.14.0
  • A database engine with a dedicated database

When you're with that, starting your project is a matter of minutes. 🕛

Step 1: install

$ git clone https://github.com/konfer-be/typeplate.git path-to/your-project-name/

Step 2: go to

$ cd path-to/your-project-name/

Step 3: build

$ npm run kickstart:dev

Step 4: setup package.json

Open the ./package.json file and edit it with your own values.

Step 5: setup environment

Open ./dist/env/development.env and fill the required env variables (uncommented in the file). See env variables list for more informations.

# Access token Secret passphrase
ACCESS_TOKEN_SECRET = "your-secret"

# CORS authorized domains
AUTHORIZED = "http://localhost:4200"

# API domain
DOMAIN = "localhost"

# Application port.
PORT = 8101

# Refresh token Secret passphrase
REFRESH_TOKEN_SECRET = "your-secret"

# Database engine
TYPEORM_TYPE = "mysql"

# Database server host
TYPEORM_HOST = "localhost"

# Database name. Keep it different from your developement database.
TYPEORM_DB = "your-database"

# Database user
TYPEORM_USER = "root"

# Database password
TYPEORM_PWD = ""

# Database port
TYPEORM_PORT = "3306"

Step 6: setup cliamrc.json

Transactional emails are send with cliam behind the scene. Open the .cliamrc.json and fill the required configuration according your sending mode. See Cliam official documentation for more information.

Sandbox is set to true by default and emails are not send. Pass this value to false when you're ready.

Step 7: run

$ nodemon

> Entity generation

Some repetitive tasks such as creating resources can be done easily with rsgen.

See entity generation wiki section to learn more about generated elements and how to use.

> Documentation

$ npm run doc

Generate API documentation website into ./docs/apidoc/.

See apidoc for more informations about customization.

> Tests

$ npm run test --env test

HTML coverage report is generated by Istanbul in ./reports/nyc-coverage.

Bonus with ./insomnia.workspace.json if you wish run manual e2e tests without create the config.

> Continuous integration

Basic Travis-CI configuration is provided in ./.travis.yml file.

> Deployment

Project implements a basic PM2 configuration to allow deployment.

Install PM2 globaly :

$ npm i pm2 -g

Configuration

Configure the ./ecosystem.config.js file with your env informations.

{
  deploy : {
    staging : {
        user : 'node',
        host : '212.83.163.1',
        ref  : 'origin/master',
        repo : '[email protected]:repo.git',
        ssh_options: ['StrictHostKeyChecking=no', 'PasswordAuthentication=yes', 'ForwardAgent=yes'],
        path : '/var/www/staging',
          'post-setup' : 'npm run kickstart:staging && pm2 reload ecosystem.config.js --env staging',
          'post-deploy' : 'npm i && tsc && pm2 reload ecosystem.config.js --env staging'
      }
  }
}

More info about PM2 ecosystem.config.js file.

Deploy

Pm 2 must be installed on the target server and your SSH public key granted.

# Setup deployment at remote location
$ pm2 deploy production setup

# Update remote version
$ pm2 deploy production update

More info about PM2 and PM2 deploy.

> License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].