{"id":13598345,"url":"https://github.com/lujakob/nestjs-realworld-example-app","last_synced_at":"2025-04-13T18:30:39.073Z","repository":{"id":37444614,"uuid":"121790729","full_name":"lujakob/nestjs-realworld-example-app","owner":"lujakob","description":"Exemplary real world backend API built with NestJS + TypeORM / Prisma","archived":false,"fork":false,"pushed_at":"2024-03-10T17:51:47.000Z","size":1440,"stargazers_count":3172,"open_issues_count":45,"forks_count":671,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-04-06T15:06:31.005Z","etag":null,"topics":["nestjs","prisma","typeorm"],"latest_commit_sha":null,"homepage":"https://realworld.io/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lujakob.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-02-16T19:18:54.000Z","updated_at":"2025-04-05T23:14:06.000Z","dependencies_parsed_at":"2023-02-09T08:31:37.008Z","dependency_job_id":"f3bd2b0d-8ba0-46f7-9b61-502f8e4c9121","html_url":"https://github.com/lujakob/nestjs-realworld-example-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lujakob%2Fnestjs-realworld-example-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lujakob%2Fnestjs-realworld-example-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lujakob%2Fnestjs-realworld-example-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lujakob%2Fnestjs-realworld-example-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lujakob","download_url":"https://codeload.github.com/lujakob/nestjs-realworld-example-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248760207,"owners_count":21157309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nestjs","prisma","typeorm"],"created_at":"2024-08-01T17:00:51.831Z","updated_at":"2025-04-13T18:30:39.036Z","avatar_url":"https://github.com/lujakob.png","language":"TypeScript","funding_links":[],"categories":["Resources","TypeScript","资源"],"sub_categories":[],"readme":"# ![Node/Express/Mongoose Example App](project-logo.png)\n\n[![Build Status](https://travis-ci.org/anishkny/node-express-realworld-example-app.svg?branch=master)](https://travis-ci.org/anishkny/node-express-realworld-example-app)\n\n\u003e ### NestJS codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld-example-apps) API spec.\n\n\n----------\n\n# Getting started\n\n## Installation\n\nClone the repository\n\n    git clone https://github.com/lujakob/nestjs-realworld-example-app.git\n\nSwitch to the repo folder\n\n    cd nestjs-realworld-example-app\n    \nInstall dependencies\n    \n    npm install\n\nCopy config file and set JsonWebToken secret key\n\n    cp src/config.ts.example src/config.ts\n    \n----------\n\n## Database\n\nThe codebase contains examples of two different database abstractions, namely [TypeORM](http://typeorm.io/) and [Prisma](https://www.prisma.io/). \n    \nThe branch `master` implements TypeORM with a mySQL database.\n\nThe branch `prisma` implements Prisma with a mySQL database.\n\n----------\n\n##### TypeORM\n\n----------\n\nCreate a new mysql database with the name `nestjsrealworld`\\\n(or the name you specified in the ormconfig.json)\n\nCopy TypeORM config example file for database settings\n\n    cp ormconfig.json.example\n    \nSet mysql database settings in ormconfig.json\n\n    {\n      \"type\": \"mysql\",\n      \"host\": \"localhost\",\n      \"port\": 3306,\n      \"username\": \"your-mysql-username\",\n      \"password\": \"your-mysql-password\",\n      \"database\": \"nestjsrealworld\",\n      \"entities\": [\"src/**/**.entity{.ts,.js}\"],\n      \"synchronize\": true\n    }\n    \nStart local mysql server and create new database 'nestjsrealworld'\n\nOn application start, tables for all entities will be created.\n\n----------\n\n##### Prisma\n\n----------\n\nTo run the example with Prisma checkout branch `prisma`, remove the node_modules and run `npm install`\n\nCreate a new mysql database with the name `nestjsrealworld-prisma` (or the name you specified in `prisma/.env`)\n\nCopy prisma config example file for database settings\n\n    cp prisma/.env.example prisma/.env\n\nSet mysql database settings in prisma/.env\n\n    DATABASE_URL=\"mysql://USER:PASSWORD@HOST:PORT/DATABASE\"\n\nTo create all tables in the new database make the database migration from the prisma schema defined in prisma/schema.prisma\n\n    npx prisma migrate save --experimental\n    npx prisma migrate up --experimental\n\nNow generate the prisma client from the migrated database with the following command\n\n    npx prisma generate\n\nThe database tables are now set up and the prisma client is generated. For more information see the docs:\n\n- https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project-typescript-mysql\n\n\n----------\n\n## NPM scripts\n\n- `npm start` - Start application\n- `npm run start:watch` - Start application in watch mode\n- `npm run test` - run Jest test runner \n- `npm run start:prod` - Build application\n\n----------\n\n## API Specification\n\nThis application adheres to the api specifications set by the [Thinkster](https://github.com/gothinkster) team. This helps mix and match any backend with any other frontend without conflicts.\n\n\u003e [Full API Spec](https://github.com/gothinkster/realworld/tree/master/api)\n\nMore information regarding the project can be found here https://github.com/gothinkster/realworld\n\n----------\n\n## Start application\n\n- `npm start`\n- Test api with `http://localhost:3000/api/articles` in your favourite browser\n\n----------\n\n# Authentication\n \nThis 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.\n\n----------\n \n# Swagger API docs\n\nThis example repo uses the NestJS swagger module for API documentation. [NestJS Swagger](https://github.com/nestjs/swagger) - [www.swagger.io](https://swagger.io/)        \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flujakob%2Fnestjs-realworld-example-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flujakob%2Fnestjs-realworld-example-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flujakob%2Fnestjs-realworld-example-app/lists"}