{"id":14976079,"url":"https://github.com/ramzitannous/medium-graphql-nestjs","last_synced_at":"2025-10-27T17:32:12.869Z","repository":{"id":44403116,"uuid":"372034991","full_name":"ramzitannous/medium-graphql-nestjs","owner":"ramzitannous","description":"A medium like graphql server using nestjs + graphql","archived":false,"fork":false,"pushed_at":"2021-12-18T21:37:14.000Z","size":756,"stargazers_count":56,"open_issues_count":1,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T07:31:38.961Z","etag":null,"topics":["codebase","crud","dataloader","graphql","graphql-schema","mongodb","nestjs-graphql","nodejs","pagination","subscription"],"latest_commit_sha":null,"homepage":"","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/ramzitannous.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}},"created_at":"2021-05-29T17:37:54.000Z","updated_at":"2025-01-27T08:37:35.000Z","dependencies_parsed_at":"2022-07-15T05:46:01.208Z","dependency_job_id":null,"html_url":"https://github.com/ramzitannous/medium-graphql-nestjs","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/ramzitannous%2Fmedium-graphql-nestjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramzitannous%2Fmedium-graphql-nestjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramzitannous%2Fmedium-graphql-nestjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramzitannous%2Fmedium-graphql-nestjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ramzitannous","download_url":"https://codeload.github.com/ramzitannous/medium-graphql-nestjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238536012,"owners_count":19488639,"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":["codebase","crud","dataloader","graphql","graphql-schema","mongodb","nestjs-graphql","nodejs","pagination","subscription"],"created_at":"2024-09-24T13:53:16.122Z","updated_at":"2025-10-27T17:32:12.537Z","avatar_url":"https://github.com/ramzitannous.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# [Nestjs + Mongodb + Graphql]  \n![enter image description here](https://res.cloudinary.com/practicaldev/image/fetch/s--AEXRsCQG--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/i/5ysrutus0pu7ux580d5s.png)  \n  \n\u003e ### [Nestjs + Graphql] codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld) spec and API.  \n  \nThis codebase was created to demonstrate a fully fledged fullstack application built with **Nestjs + Graphql** including CRUD operations, authentication, routing, pagination, and more.  \n  \n  \n# Screenshots  \n  \n**create user**  \n  \n\u003cimg src=\"https://raw.githubusercontent.com/ramzitannous/medium-graphql-nestjs/master/images/1.png\" width=\"800\" height=\"400\"/\u003e  \n  \n**JWT login**  \n  \n\u003cimg src=\"https://raw.githubusercontent.com/ramzitannous/medium-graphql-nestjs/master/images/7.png\" width=\"800\" height=\"400\"/\u003e  \n  \n**add article to favorite**  \n  \n\u003cimg src=\"https://raw.githubusercontent.com/ramzitannous/medium-graphql-nestjs/master/images/8.png\" width=\"800\" height=\"400\"/\u003e  \n  \n**create article**  \n  \n\u003cimg src=\"https://raw.githubusercontent.com/ramzitannous/medium-graphql-nestjs/master/images/2.png\" width=\"800\" height=\"400\"/\u003e  \n  \n**get all articles and comments with pagination**  \n  \n\u003cimg src=\"https://raw.githubusercontent.com/ramzitannous/medium-graphql-nestjs/master/images/3.png\" width=\"800\" height=\"400\"/\u003e  \n  \n**add comment to article**  \n  \n\u003cimg src=\"https://raw.githubusercontent.com/ramzitannous/medium-graphql-nestjs/master/images/4.png\" width=\"800\" height=\"400\"/\u003e  \n  \n  \n# How it works  \n  \nA medium like backend server using nestjs with Graphql and mongodb as presitance layer.  \n  \n**Packages**  \n  \n 1. `@nestjs/config`: Configuration module with .env support for nestjs  \n 2. `@nestjs/jwt`: Support JWT authentication for nestjs  \n 3. `@nestjs/mongoose`: support [mongoose](https://mongoosejs.com/) (Mongodb ORM) for nestjs  \n 4. `@nestjs/passport`: Nodejs authentication module that supports multiple strategies  \n 5. `@nestjs/graphql`: Add Graphql support for nestjs  \n 6. `graphql-subscriptions`; Add subscription with websockets for graphql  \n 7. `dataloader`: support graphql batch loading  \n 8. `graphql-upload`: add file upload to graphql\n  \n**Why Dataloader ?**  \n  \n[Dataloader](https://github.com/graphql/dataloader) is used to solve the popular **N+1** problem, by batching requests and making one rquest to the database to fetch multiple objects, instead of **N** queries, this will optimize the graphql queries significantly, more about the problem can be found [here](https://medium.com/the-marcy-lab-school/what-is-the-n-1-problem-in-graphql-dd4921cb3c1a)  \n\n**Graphql Upload**\n\ngraphql file upload was done by `graphql-upload` node package\n\n**Graphql Schema**\n\nfull graphql schema can be found at [schema.gql](https://github.com/ramzitannous/medium-graphql-nestjs/blob/master/src/schema.gql)\n   \n**Graphql Subscription**  \n\nsubscription is done using `graphql-subscriptions`, 2 events can be subscribed:  \n  \n**1. when article created**  \n\u003cimg src=\"https://raw.githubusercontent.com/ramzitannous/medium-graphql-nestjs/master/images/5.png\" width=\"800\" height=\"400\"/\u003e  \n  \n**2. when a new comment added**  \n\u003cimg src=\"https://raw.githubusercontent.com/ramzitannous/medium-graphql-nestjs/master/images/6.png\" width=\"800\" height=\"400\"/\u003e  \n  \n# Getting started  \n  \n 1. add `.env` file with fallowing values:   \n    `SERVER_PORT=3000`             \n    `MONGODB_URI=mongodb://localhost:27017/medium`   \n    `DEBUG=true`  \n    `SECRET_KEY=secret-key`\n    `UPLOAD_PATH=./static`\n\n  2. `yarn install`  \n 3. `yarn start`  \n 4. Head to `http://localhost:3000/graphql` to check graphql playground.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framzitannous%2Fmedium-graphql-nestjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framzitannous%2Fmedium-graphql-nestjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framzitannous%2Fmedium-graphql-nestjs/lists"}