All Projects → lujakob → Nestjs Realworld Example App

lujakob / Nestjs Realworld Example App

Exemplary real world backend API built with NestJS + TypeORM / Prisma

Programming Languages

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

Projects that are alternatives of or similar to Nestjs Realworld Example App

Nestjs-Typeorm-Auth
NestJS + Typeorm codebase containing a full authentification system with roles, sessions and email verification.
Stars: ✭ 37 (-97.99%)
Mutual labels:  typeorm, nestjs
nest-prisma-rest-api-boilerplate
Nest + Prisma + TypeScript | REST API Starter repository
Stars: ✭ 24 (-98.69%)
Mutual labels:  nestjs, prisma
teanjs
🔥 TypeORM - Express - Angular 8 - NestJS Server Side Rendering (SSR) 😺
Stars: ✭ 62 (-96.63%)
Mutual labels:  typeorm, nestjs
renestql
React, NestJS & GraphQL monorepo boilerplate managed with nx
Stars: ✭ 25 (-98.64%)
Mutual labels:  typeorm, nestjs
nestjs-auth-starter-kit
NestJS Auth Starter Kit (typescript / typeorm / swagger / passport / bcrypt)
Stars: ✭ 37 (-97.99%)
Mutual labels:  typeorm, nestjs
ng-nest-cnode
Angular 10 Front-End and Nestjs 7 framework Back-End build Fullstack CNode
Stars: ✭ 17 (-99.08%)
Mutual labels:  typeorm, nestjs
mom
Proof of concept for Message-Oriented-Middleware based architecture.
Stars: ✭ 39 (-97.88%)
Mutual labels:  typeorm, nestjs
nest-admin
NestJs CRUD for RESTful API使用 nestjs + mysql + typeorm + redis + jwt + swagger 企业中后台管理系统项目RBAC权限管理(细粒度到按钮)、实现单点登录等。
Stars: ✭ 165 (-91.02%)
Mutual labels:  typeorm, nestjs
nest-typeorm-auth-boilerplate
A NestJS boilerplate with TypeORM and authentication
Stars: ✭ 15 (-99.18%)
Mutual labels:  typeorm, nestjs
node-nestjs-structure
Node.js framework NestJS project structure
Stars: ✭ 258 (-85.96%)
Mutual labels:  typeorm, nestjs
nestjs-rest-cqrs-example
Example for Nest.js, MySQL, Redis, REST api, CQRS, DDD
Stars: ✭ 263 (-85.69%)
Mutual labels:  typeorm, nestjs
Mili
mili 是一个开源的社区系统,界面优雅,功能丰富😛
Stars: ✭ 2,875 (+56.42%)
Mutual labels:  nestjs, typeorm
nest-admin
采用nestjs typeorm vue开发的一套权限管理系统
Stars: ✭ 256 (-86.07%)
Mutual labels:  typeorm, nestjs
nest-todo
🐱 使用 React.js + Nest.js 实现一个简单的 Todo App。
Stars: ✭ 205 (-88.85%)
Mutual labels:  typeorm, nestjs
prisma-nestjs-graphql
Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module
Stars: ✭ 276 (-84.98%)
Mutual labels:  nestjs, prisma
nestjs-prisma-docker
Dockerizing a NestJS app with Prisma and PostgreSQL
Stars: ✭ 42 (-97.71%)
Mutual labels:  nestjs, prisma
gondor
Nestjs Framework, Prisma database layer w/ Angular and Apollo.
Stars: ✭ 14 (-99.24%)
Mutual labels:  nestjs, prisma
fullstack-ts-boilerplate
Full-stack boilerplate in TS using modern technology
Stars: ✭ 25 (-98.64%)
Mutual labels:  nestjs, prisma
nestjs-prisma-starter
Starter template for NestJS 😻 includes GraphQL with Prisma Client, Passport-JWT authentication, Swagger Api and Docker
Stars: ✭ 1,107 (-39.77%)
Mutual labels:  nestjs, prisma
nest-boilerplate
Nest.js boilerplate with CircleCI, Commitizen, Commitlint, Docker-Compose, ESLint, GitHub Actions, Husky, Lint-staged, OpenAPI, Prettier, PostGreSQL, Travis CI, TypeORM
Stars: ✭ 16 (-99.13%)
Mutual labels:  typeorm, nestjs

Node/Express/Mongoose Example App

Build Status

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


Getting started

Installation

Clone the repository

git clone https://github.com/lujakob/nestjs-realworld-example-app.git

Switch to the repo folder

cd nestjs-realworld-example-app

Install dependencies

npm install

Copy config file and set JsonWebToken secret key

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

Database

The codebase contains examples of two different database abstractions, namely TypeORM and Prisma.

The branch master implements TypeORM with a mySQL database.

The branch prisma implements Prisma with a mySQL database.


TypeORM

Create a new mysql database with the name nestjsrealworld
(or the name you specified in the ormconfig.json)

Copy TypeORM config example file for database settings

cp ormconfig.json.example

Set mysql database settings in ormconfig.json

{
  "type": "mysql",
  "host": "localhost",
  "port": 3306,
  "username": "your-mysql-username",
  "password": "your-mysql-password",
  "database": "nestjsrealworld",
  "entities": ["src/**/**.entity{.ts,.js}"],
  "synchronize": true
}

Start local mysql server and create new database 'nestjsrealworld'

On application start, tables for all entities will be created.


Prisma

To run the example with Prisma checkout branch prisma, remove the node_modules and run npm install

Create a new mysql database with the name nestjsrealworld-prisma (or the name you specified in prisma/.env)

Copy prisma config example file for database settings

cp prisma/.env.example prisma/.env

Set mysql database settings in prisma/.env

DATABASE_URL="mysql://USER:PASSWORD@HOST:PORT/DATABASE"

To create all tables in the new database make the database migration from the prisma schema defined in prisma/schema.prisma

npx prisma migrate save --experimental
npx prisma migrate up --experimental

Now generate the prisma client from the migrated database with the following command

npx prisma generate

The database tables are now set up and the prisma client is generated. For more information see the docs:


NPM scripts

  • npm start - Start application
  • npm run start:watch - Start application in watch mode
  • npm run test - run Jest test runner
  • npm run 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

  • npm start
  • Test api with http://localhost:3000/api/articles in your favourite browser

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. Please check the following sources to learn more about JWT.


Swagger API docs

This example repo uses the NestJS swagger module for API documentation. NestJS Swagger - www.swagger.io

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].