{"id":14976016,"url":"https://github.com/basemax/restaurantgraphqlapi","last_synced_at":"2026-02-18T11:02:08.812Z","repository":{"id":167307056,"uuid":"640250410","full_name":"BaseMax/RestaurantGraphQLAPI","owner":"BaseMax","description":"A GraphQL-based API designed to handle multiple restaurants in a shop store. It provides various features such as searching for restaurants in a city, finding the nearest restaurant, retrieving a list of foods offered by a restaurant, and more.","archived":false,"fork":false,"pushed_at":"2025-12-10T14:38:56.000Z","size":1686,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-10T23:18:22.890Z","etag":null,"topics":["graphql","graphql-api","graphql-schema","graphql-server","graphql-ts","graphql-typescript","javascript","js","ts","typescript","typescript-graphql"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-05-13T13:24:58.000Z","updated_at":"2025-12-10T14:37:37.000Z","dependencies_parsed_at":"2024-02-21T00:57:41.663Z","dependency_job_id":"5e9ff762-0a19-4f79-a95e-a51b2db2a481","html_url":"https://github.com/BaseMax/RestaurantGraphQLAPI","commit_stats":null,"previous_names":["basemax/restaurantgraphqlapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BaseMax/RestaurantGraphQLAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FRestaurantGraphQLAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FRestaurantGraphQLAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FRestaurantGraphQLAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FRestaurantGraphQLAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/RestaurantGraphQLAPI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FRestaurantGraphQLAPI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29576861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: 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":["graphql","graphql-api","graphql-schema","graphql-server","graphql-ts","graphql-typescript","javascript","js","ts","typescript","typescript-graphql"],"created_at":"2024-09-24T13:53:08.559Z","updated_at":"2026-02-18T11:02:08.794Z","avatar_url":"https://github.com/BaseMax.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RestaurantGraphQL API\n\nThe RestaurantGraphQL API is a GraphQL-based API designed to handle multiple restaurants in a shop store. It provides various features such as searching for restaurants in a city, finding the nearest restaurant, retrieving a list of foods offered by a restaurant, and more.\n\n## Features\n\nThe RestaurantGraphQL API offers the following features:\n\n- Search in a city: Users can search for restaurants in a specific city by providing the city name as a parameter.\n- Distance calculation: The API can calculate the distance between a given location and all the restaurants, enabling users to find the nearest restaurant.\n- Retrieve restaurant details: Users can retrieve detailed information about a specific restaurant, including its name, address, contact details, opening hours, and more.\n- Get a list of foods: The API allows users to fetch a list of foods offered by a restaurant, including their names, descriptions, prices, and any other relevant details.\n- Filtering: Users can apply various filters while searching for restaurants, such as cuisine type, price range, ratings, and more.\n\n## GraphQL Demo\n\n![image](https://github.com/BaseMax/RestaurantGraphQLAPI/assets/2658040/a5d4abd8-0149-4b9e-9c8f-8e3085fcd713)\n\n![image](https://github.com/BaseMax/RestaurantGraphQLAPI/assets/2658040/f14479f4-5374-4429-9900-62dc04a0b5f0)\n\n![image](https://github.com/BaseMax/RestaurantGraphQLAPI/assets/2658040/d603670d-6bd8-4e17-a0f9-57c0adf43593)\n\n## Available Queries\n\nThe following queries are available in the API:\n\n- `restaurants(query: SearchRestaurantsInput!)`: Returns a list of restaurants based on the provided search query.\n- `restaurant(id: ID!)`: Returns detailed information about a specific restaurant.\n- `food(id: ID!)`: Returns detailed information about a specific food item.\n- `foods(restaurantId: ID!, pagination: Pagination!)`: Returns a list of food items offered by a specific restaurant.\n- `reviews(restaurantId: ID!, pagination: Pagination!)`: Returns a list of reviews for a specific restaurant.\n- `user`: Returns information about the currently authenticated user.\n- `getAllUsers`: Returns a list of all users (requires superadmin role).\n\n## Available Mutations\n\nThe following mutations are available in the API:\n\n- `register(input: RegisterUserInput!)`: Registers a new user with the provided information.\n- `login(input: LoginUserInput!)`: Logs in an existing user with the provided information.\n- `createRestaurant(input: CreateRestaurantInput!)`: Creates a new restaurant (requires admin or superadmin role).\n- `updateRestaurant(input: UpdateRestaurantInput!)`: Updates an existing restaurant (requires admin or superadmin role).\n- `deleteRestaurant(id: String!)`: Deletes an existing restaurant (requires admin or superadmin role).\n- `createFood(input: CreateFoodInput!)`: Creates a new food item for a specific restaurant (requires admin or superadmin role).\n- `updateFood(input: UpdateFoodInput!)`: Updates an existing food item (requires admin or superadmin role).\n- `deleteFood(id: String!)`: Deletes an existing food item (requires admin or superadmin role).\n- `createReview(input: CreateReviewInput!)`: Creates a new review for a specific restaurant.\n\n## Usage\n\n### Clone the repo\nClone this repositoryto get the source code:\n\n```\ngit clone https://github.com/basemax/RestaurantGraphqlApi\n```\n\n### Install dependencies\nRun `npm install` to install Node dependencies:\n\n```\nnpm install\n```\n\n### Create admin account  \nRun the following command to create a superuser account:\n\n```\nnpx nest start --entryFile create-admin.js\n```\n\nIt will prompt you for an email, password, and name to create the superuser account.\n\n### Run in development\nRun the app using Docker Compose:\n\n```\nsudo docker-compose -f docker-compose.dev.yml up\n``` \n\nThis will start the app in development mode, with hot reloading enabled.\n\nThe GraphQL playground will be available at `http://localhost:3000/graphql`\n\n\n# Examples\n\nHere are some examples of queries and mutations that can be executed using the RestaurantGraphQL API:\n\n### Query for restaurants in a specific city\n\n```graphql\nquery {\n  restaurants(query: {city: \"New York\"}) {\n    id\n    name\n    location {\n      latitude\n      longitude\n    }\n    address\n    rating\n    cuisine\n  }\n}\n```\n\n### Query for a specific restaurant and its details\n\n```graphql\nquery {\n  restaurant(id: \"12345\") {\n    id\n    name\n    location {\n      latitude\n      longitude\n    }\n    address\n    rating\n    cuisine\n    contact {\n      email\n      phone\n    }\n    openingHours {\n      day\n      hours\n    }\n  }\n}\n```\n\n### Query for a list of foods offered by a restaurant\n\n```graphql\nquery {\n  foods(restaurantId: \"12345\", pagination: {limit: 10, skip: 0}) {\n    id\n    name\n    description\n    price\n  }\n}\n```\n\n### Mutation to create a new restaurant\n\n```graphql\nmutation {\n  createRestaurant(input: {\n    name: \"New Restaurant\",\n    location: {latitude: 51.5074, longitude: 0.1278},\n    address: \"123 Main Street\",\n    rating: 4.5,\n    cuisine: \"Italian\",\n    contact: {email: \"info@newrestaurant.com\", phone: \"123-456-7890    \"},\n    openingHours: [\n      {day: Monday, hours: \"10:00-22:00\"},\n      {day: Tuesday, hours: \"10:00-22:00\"},\n      {day: Wednesday, hours: \"10:00-22:00\"},\n      {day: Thursday, hours: \"10:00-22:00\"},\n      {day: Friday, hours: \"10:00-23:00\"},\n      {day: Saturday, hours: \"11:00-23:00\"},\n      {day: Sunday, hours: \"11:00-22:00\"}\n    ]\n  }) {\n    id\n    name\n    location {\n      latitude\n      longitude\n    }\n    address\n    rating\n    cuisine\n  }\n}\n```\n\n### Mutation to update an existing restaurant\n\n```graphql\nmutation {\n  updateRestaurant(input: {\n    id: \"12345\",\n    name: \"Updated Restaurant Name\",\n    rating: 4.8\n  }) {\n    id\n    name\n    rating\n  }\n}\n```\n\n### Mutation to delete a food item\n\n```graphql\nmutation {\n  deleteFood(id: \"12345\")\n}\n```\n\n# API Documentation\n\nThis API uses GraphQL to provide data about restaurants and their menus.\n\n## Queries\n\n### Restaurant queries\n\n- `restaurants(query: SearchRestaurantsInput)` - Returns all restaurants matching the search parameters. You can search by:\n  - `name`\n  - `city`\n  - `cuisine`\n  - `minPrice` \n  - `maxPrice`\n  - `nearBy { radius, latitude, longitude }`\n\n- `restaurant(id: ID!)` - Returns a single restaurant object by ID.\n\n- `distance(location: LocationInput!)` - Returns the distance between a given location and the restaurant.\n\n### Food menu queries\n\n- `food(id: ID!)` - Returns a single food item by ID.\n\n- `foods(restaurantId: ID!, pagination: Pagination)` - Returns all food items for a restaurant, with pagination. Pagination parameters are:\n  - `limit` \n  - `skip`\n\n### Review queries\n\n- `reviews(restaurantId: ID!, pagination: Pagination)` - Returns all reviews for a restaurant, paginated.\n\n- `user` - Returns the current authenticated user object.\n\n## Mutations\n\n### Restaurant mutations\n\n- `createRestaurant(input: CreateRestaurantInput!)` - Creates a new restaurant. Input fields are:\n  - `name`\n  - `location { latitude, longitude }`\n  - `address`\n  - `rating`  \n  - `cuisine`   \n  - `contact { email, phone }`\n  - `openingHours [ { day, hours } ]`\n\n- `updateRestaurant(input: UpdateRestaurantInput!)` - Updates an existing restaurant. Requires the `id` field.\n\n- `deleteRestaurant(id: String!)` - Requires admin role.\n\n### Food menu mutations\n\n- `createFood(input: CreateFoodInput!)` - Requires admin role. Input fields are:\n  - `name`\n  - `description`\n  - `price`  \n  - `restaurantId`\n\n- `updateFood(input: UpdateFoodInput!)` - Requires admin role. \n\n- `deleteFood(id: String!)` - Requires admin role.\n\n### Review mutations\n\n- `createReview(input: CreateReviewInput!)` - Requires authentication. Input fields are:\n  - `restaurantId`  \n  - `rating`\n  - `comment`\n\n### User mutations\n\n- `changeRole(newRole: Role!, userId: String!)` - Requires superadmin role. Changes a user's role.\n\nLet me know if you have any other questions about the API! I can expand on any part in more detail.\n## Security\nRoles:  \n\n- `user` - Basic access  \n- `admin` - Manage restaurants and menu    \n- `superadmin` - Manage all users and roles\n\nAuthentication uses JWT tokens.\n\n## Contributing\n\nIf you encounter any issues or have suggestions for improvements, please submit an issue or a pull request to the GitHub repository.\n\n## License\n\nThe RestaurantGraphQL API is open-source and released under the GPL-V3.0 License. Feel free to use, modify, and distribute the code as per the terms of the license.\n\nCopyright 2023, Max Base\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Frestaurantgraphqlapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Frestaurantgraphqlapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Frestaurantgraphqlapi/lists"}