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.
Install dependencies
yarn
Copy config file and set JsonWebToken secret key
cp src/config.ts.example src/config.ts
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
Start local MySQL server and create a new database called nestjsrealworld
(or the name you specified in the config file).
Create database schema:
npx mikro-orm schema:create --run
Now you can start the application witt yarn start
yarn start
- Start applicationyarn start:watch
- Start application in watch modeyarn test
- run Jest test runneryarn start:prod
- Build application
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.
More information regarding the project can be found here https://github.com/gothinkster/realworld
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 withyarn test:e2e
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.