{"id":27774296,"url":"https://github.com/athrocks/graphql-springboot","last_synced_at":"2026-04-18T17:02:16.138Z","repository":{"id":290400834,"uuid":"974296960","full_name":"athrocks/GraphQL-SpringBoot","owner":"athrocks","description":"This project is a simple Spring Boot application demonstrating a GraphQL API for managing books. It supports creating new books and querying books from an in-memory H2 database.","archived":false,"fork":false,"pushed_at":"2025-04-28T17:32:37.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T02:05:40.864Z","etag":null,"topics":["api","graphql","graphql-api","graphql-java","h2-database","memory-database","spring","spring-boot","spring-data-jpa"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/athrocks.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,"zenodo":null}},"created_at":"2025-04-28T14:57:12.000Z","updated_at":"2025-04-28T17:32:40.000Z","dependencies_parsed_at":"2025-04-30T02:05:41.180Z","dependency_job_id":null,"html_url":"https://github.com/athrocks/GraphQL-SpringBoot","commit_stats":null,"previous_names":["athrocks/graphql-springboot-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/athrocks/GraphQL-SpringBoot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athrocks%2FGraphQL-SpringBoot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athrocks%2FGraphQL-SpringBoot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athrocks%2FGraphQL-SpringBoot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athrocks%2FGraphQL-SpringBoot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/athrocks","download_url":"https://codeload.github.com/athrocks/GraphQL-SpringBoot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athrocks%2FGraphQL-SpringBoot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31976805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T16:27:12.723Z","status":"ssl_error","status_checked_at":"2026-04-18T16:27:11.140Z","response_time":103,"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":["api","graphql","graphql-api","graphql-java","h2-database","memory-database","spring","spring-boot","spring-data-jpa"],"created_at":"2025-04-30T02:05:38.980Z","updated_at":"2026-04-18T17:02:16.133Z","avatar_url":"https://github.com/athrocks.png","language":"Java","readme":"# 📚 GraphQL Book Management API\n\nThis project is a simple **Spring Boot** application demonstrating a **GraphQL** API for managing books.  \nIt supports creating new books and querying books from an in-memory **H2 database**.\n\n---\n\n## ✨ Features\n\n- Create a new Book using GraphQL mutation\n- Fetch all Books\n- Fetch a single Book by ID\n- Uses Spring Boot, GraphQL, JPA, and H2 database\n\n---\n\n## 📦 Project Structure\n\n- **Entity:** `Book.java` — Defines the Book object model.\n- **Repository:** `BookRepo.java` — Extends JPA repository for database operations.\n- **Service:** `BookServiceImpl.java` — Contains business logic for book operations.\n- **Controller:** `BookController.java` — GraphQL queries and mutations mapped here.\n- **GraphQL Schema:** Defined using `Book`, `BookInput`, Query, and Mutation types.\n\n---\n\n## 🔧 Technologies Used\n\n- Java 21+\n- Spring Boot 3.x\n- Spring for GraphQL\n- Spring Data JPA\n- H2 Database (in-memory)\n- GraphQL Query Language\n\n---\n\n## 🚀 Running the Project\n\n### Prerequisites\n\n- Java 21 or higher installed\n- Maven installed\n\n### Steps\n\n1. **Clone the Repository**\n\n```bash\ngit clone https://github.com/athrocks/GraphQL-SpringBoot.git\ncd GraphQL-SpringBoot\n```\n\n2. **Run the Application**\n\n```bash\n./mvnw spring-boot:run\n```\n\nOr if you use Maven installed globally:\n\n```bash\nmvn spring-boot:run\n```\n\n3. **Access GraphQL Playground**\n\nVisit:\n\n```\nhttp://localhost:8009/graphql\n```\n*(Or your configured GraphQL client.)*\n\n---\n\n## 📖 Sample Queries \u0026 Mutations\n\n### Create a Book (Mutation)\n\n```graphql\nmutation {\n  createBook(book: {\n    title: \"Java Techie\",\n    desc: \"Java Learn\",\n    price: 453,\n    pages: 1245,\n    author: \"Atharva\"\n  }) {\n    id\n  }\n}\n```\n\n### Fetch All Books (Query)\n\n```graphql\nquery {\n  allBooks {\n    id\n    title\n    price\n  }\n}\n```\n\n### Fetch Book by ID (Query)\n\n```graphql\nquery {\n  getBook(bookId: 2) {\n    title\n    desc\n  }\n}\n```\n\n---\n\n## 🛠️ Application Configuration (`application.properties`)\n\n```properties\nspring.application.name=\nserver.port=8009\n\nspring.h2.console.enabled=true\nspring.datasource.url=jdbc:h2:mem:testdb\nspring.datasource.driverClassName=org.h2.Driver\nspring.datasource.username=\nspring.datasource.password=\n\nspring.jpa.database-platform=org.hibernate.dialect.H2Dialect\nspring.jpa.hibernate.ddl-auto=update\nspring.jpa.show-sql=true\n```\n\n- Access H2 console at `http://localhost:8009/h2-console`\n- JDBC URL: `jdbc:h2:mem:testdb`\n\n---\n\n## 📄 GraphQL Schema\n\n```graphql\ntype Mutation {\n  createBook(book: BookInput): Book\n}\n\ntype Query {\n  allBooks: [Book]\n  getBook(bookId: Int): Book\n}\n\ntype Book {\n  id: ID!\n  title: String\n  desc: String\n  author: String\n  price: Float\n  pages: Int\n}\n\ninput BookInput {\n  title: String\n  desc: String\n  author: String\n  price: Float\n  pages: Int\n}\n```\n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathrocks%2Fgraphql-springboot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fathrocks%2Fgraphql-springboot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathrocks%2Fgraphql-springboot/lists"}