Skip to content

mikro-orm/nestjs-realworld-example-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

54bea4e · Feb 17, 2025
Oct 14, 2024
Nov 13, 2019
Jan 28, 2025
Jan 23, 2022
Jul 16, 2023
Sep 30, 2020
Mar 21, 2024
Jan 17, 2022
Oct 9, 2022
Jan 22, 2025
Nov 13, 2019
Jul 3, 2021
Sep 30, 2020
Nov 13, 2019
Jan 28, 2025
Nov 13, 2019
Sep 30, 2020
Apr 22, 2024
Jan 23, 2022
Feb 17, 2025

Repository files navigation

NestJS

NestJS + MikroORM codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld API spec.

Rewrite of https://github.com/lujakob/nestjs-realworld-example-app to MikroORM.


Getting started

Installation

Install dependencies

yarn

Copy config file and set JsonWebToken secret key

cp src/config.ts.example src/config.ts

Database

The example codebase uses MikroORM with a MySQL database.

Copy MikroORM config example file for database settings and adjust the connection settings.

cp src/mikro-orm.config.ts.example src/mikro-orm.config.ts

Now you can start the application with yarn start. It will automatically create the database and run initial migration that sets up the database schema.


NPM scripts

  • yarn start - Start application
  • yarn start:dev - Start application in watch mode
  • yarn test - run Jest test runner
  • yarn start:prod - Build application

API Specification

This application adheres to the api specifications set by the Thinkster team. This helps mix and match any backend with any other frontend without conflicts.

Full API Spec

More information regarding the project can be found here https://github.com/gothinkster/realworld


Start application

  • yarn start
  • Test api by browsing to http://localhost:3000/api/articles
  • View automatically generated swagger api docs by browsing to http://localhost:3000/docs
  • Run e2e tests from the gothinkster/realworld repository with yarn test:e2e

Authentication

This applications uses JSON Web Token (JWT) to handle authentication. The token is passed with each request using the Authorization header with Token scheme. The JWT authentication middleware handles the validation and authentication of the token.