{"id":23789861,"url":"https://github.com/kushalkhadka7/graphql-blog","last_synced_at":"2026-04-07T16:31:49.931Z","repository":{"id":38425600,"uuid":"380010655","full_name":"Kushalkhadka7/graphql-blog","owner":"Kushalkhadka7","description":"TypeScript-Graphql-mongo-blog-app","archived":false,"fork":false,"pushed_at":"2023-03-06T12:30:49.000Z","size":1684,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-21T12:43:23.283Z","etag":null,"topics":["apollo-server","apollographql","docker","docker-compose","eslint","github-actions","graphql","joi","nodejs","prettier","typescript"],"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/Kushalkhadka7.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,"publiccode":null,"codemeta":null}},"created_at":"2021-06-24T17:59:32.000Z","updated_at":"2021-10-06T17:46:15.000Z","dependencies_parsed_at":"2025-02-21T12:42:55.774Z","dependency_job_id":"7ae7cd37-16d2-477f-b335-6a223e9df851","html_url":"https://github.com/Kushalkhadka7/graphql-blog","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/Kushalkhadka7/graphql-blog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kushalkhadka7%2Fgraphql-blog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kushalkhadka7%2Fgraphql-blog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kushalkhadka7%2Fgraphql-blog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kushalkhadka7%2Fgraphql-blog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kushalkhadka7","download_url":"https://codeload.github.com/Kushalkhadka7/graphql-blog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kushalkhadka7%2Fgraphql-blog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31520447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["apollo-server","apollographql","docker","docker-compose","eslint","github-actions","graphql","joi","nodejs","prettier","typescript"],"created_at":"2025-01-01T17:17:03.239Z","updated_at":"2026-04-07T16:31:49.913Z","avatar_url":"https://github.com/Kushalkhadka7.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeScript-Graphql-mongo-blog-app\n\n## **Overview**\n\nThis is a simple app created using typescript and graphql (Apollo Server). It uses mongodb as database. User can register and login to the app and the create posts, comment on other user post or on their own post. The authentication is done using `Jwt`. One the user login `accessToken` and `refreshToken` is provides. So to access the protected routes like creating post or commenting on post, accessToken should be provided in auth headers for verification.\n\n### **Prerequisites**\n\n- [Git](https://git-scm.com/downloads)\n- [Docker](https://docs.docker.com/install/)\n- [Node.js](https://yarnpkg.com/en/docs/install)\n- [Yarn](https://yarnpkg.com/en/docs/install)\n- [NPM](https://docs.npmjs.com/getting-started/installing-node)\n- [ApolloServer](https://www.apollographql.com/docs/apollo-server/)\n- [TypeScript](https://www.typescriptlang.org/)\n\n## **Getting Started**\n\n- Git clone the repository\n\n  ```\n  git clone git@github.com:Kushalkhadka7/ts-node-graphql.git \u003capp_name\u003e\n  ```\n\n- Cd to `\u003capp_name\u003e` and then:\n  ```\n  yarn or npm install\n  ```\n- Copy `.env.example` to `.env` file and update the credentials.\n  ```\n  cp .env.example .env\n  ```\n- App is ready to be started, Now need to setup database.\n\n### **Setup mongo database using mongo atlas**\n\n- Go to `https://www.mongodb.com/` and create account.\n- Create a project and a database in mongo atlas (It will take a while, depending on the region.)\n- It will create a `mongodb` cluster with the selected provider in selected region.\n- Once the cluster gets created, now create the database.\n- Click connect button which will give the connection string to the database.\n\n  ```\n  mongodb+srv://\u003cname\u003e:\u003cpassword\u003e@cluster0.ztyf9.mongodb.net/ \u003cdatabase_name\u003e?retryWrites=true\u0026w=majority\n  ```\n\n- Copy the connection string and replace `MONGO_URI` value in .env file with the connection string, also update the db credentials in the connection string.\n\n### **Setup mongo database using docker-compose**\n\n[TODO]\n\n### **Starting the app**\n\n- Once the db is setup, the app can be started.\n\n  ```\n  yarn start or npm start\n  ```\n\n- Navigate to the browser and `localhost:3000/graphql`, graphql playground is ready.\n\n## **Using the app.**\n\n- Register and Login\n\n  ```\n    mutation {\n      register(name: \"test\", email: \"tst@gmail.com\", password: \"test123\"){\n        name,email\n      },\n\n      login(email: \"test@gmail.com\", password: \"test123\") {\n        accessToken\n        refreshToken\n        user {\n          name\n          email\n        }\n      }\n    }\n  ```\n\n- It will give `accessToken` and `refreshToken` along with logged in user details.\n- Use the `accessToken` in auth header to access other routes.\n  ```\n  {\n    authorization: \"Bearer \u003caccess_token\u003e\"\n  }\n  ```\n- Now protected routes can be accessed.\n\n- Create Post\n\n  ```\n  mutation {\n    createPost(description: \"\u003cpost text here\u003e\") {\n      description\n    }\n  }\n  ```\n\n- Query posts\n\n  ```\n  query {\n    # Get all posts created by logged in user, along with the comments associated with them.\n    getPosts {\n      description,\n      comments {\n        description\n      }\n    }\n\n\n    # Get single post.\n    getPost(postId:\"post_id\") {\n      description,\n      comments{\n        description\n      }\n    }\n  }\n  ```\n\n\u003e Note: For more details about available schemas, they can be found under files directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkushalkhadka7%2Fgraphql-blog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkushalkhadka7%2Fgraphql-blog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkushalkhadka7%2Fgraphql-blog/lists"}