Skip to content

Commit 91ad5d2

Browse files
committed
Add GraphQL overview documentation
Introduces a new GraphQL.md file with history, advantages, disadvantages, and key points about GraphQL. Provides context for developers on when and why to use GraphQL compared to REST.
1 parent 4bc5e9e commit 91ad5d2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

pages/GraphQL.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# History
2+
- **How**: GraphQL was developed internally by **Facebook** in **2012** to improve the way mobile apps interacted with APIs. It was created to solve issues with over-fetching and under-fetching of data in traditional REST APIs.
3+
-
4+
- **Who**: The technology was created by a team at **Facebook**, led by **Lee Byron**, **Dan Schafer**, and **Nick Schrock**. It was later open-sourced in **2015**, and is now maintained by the **GraphQL Foundation**, hosted by the **Linux Foundation**.
5+
-
6+
- **Why**: GraphQL was designed to give clients more control over the data they receive, allowing for more efficient and flexible querying of APIs. It aims to simplify data fetching and improve performance in client-server communication.
7+
-
8+
- # Introduction
9+
- ## Advantages:
10+
- **Precise Data Fetching**: Clients can request exactly the data they need—no more, no less—reducing over-fetching and under-fetching of data.
11+
- **Single Endpoint**: Unlike REST, which uses multiple endpoints for different resources, GraphQL uses a single endpoint to serve all queries.
12+
- **Strongly Typed Schema**: GraphQL APIs are defined by a type system, providing clear structure and enabling powerful developer tools like auto-complete and static validation.
13+
- **Real-Time Data with Subscriptions**: Supports real-time updates using **GraphQL Subscriptions**, making it useful for live data apps like chats or dashboards.
14+
- **Efficient for Mobile and Frontend**: Ideal for frontend and mobile development where bandwidth and performance are critical.
15+
- **Introspective and Self-Documenting**: GraphQL APIs can be queried for their own structure, which makes documentation and onboarding easier.
16+
-
17+
- ## Disadvantages:
18+
- **Complexity for Simple APIs**: For small projects or simple data needs, GraphQL can be overkill compared to REST.
19+
- **Performance Overhead**: Complex queries can lead to performance issues on the server side if not carefully managed.
20+
- **Caching Challenges**: Unlike REST, where URLs can be easily cached, GraphQL responses are harder to cache due to their dynamic nature.
21+
- **Security Concerns**: The flexibility of GraphQL can lead to potential security issues like deeply nested queries or data exposure if not properly secured (e.g. query depth limits, rate limiting).
22+
- **Learning Curve**: Developers may face a learning curve when transitioning from REST to GraphQL, especially with concepts like schemas, resolvers, and query languages.
23+
-
24+
- ## Remember Points:
25+
- **Client-Centric**: GraphQL puts the client in control of the data they receive, improving efficiency and flexibility.
26+
- **Schema-Driven Development**: The API structure is defined by a schema, improving consistency, validation, and tooling.
27+
- **Single Endpoint, Multiple Queries**: All data is accessed through a single endpoint using structured queries.
28+
- **Optimized for Frontend**: Especially powerful in apps where minimizing data and bandwidth is critical.
29+
- **Needs Proper Management**: Caching, security, and performance optimization require additional planning compared to REST.
30+
-
31+
-

0 commit comments

Comments
 (0)