This project is a learning-first implementation of a GraphQL-like query system using plain JavaScript.
No external libraries, no GraphQL packages — just raw recursion and logic to understand how GraphQL really works under the hood.
- Supports nested queries like:
{ user { name posts { title } } }- Returns clean, structured responses:
{
"user": {
"name": "John Doe",
"posts": [
{ "title": "My First Post" },
{ "title": "Second Post" }
]
}
}-
No overfetching — returns only what's requested
-
Built with Express.js for easy testing via a /graphql POST endpoint
-
Node.js
-
Express
-
Pure JavaScript (no GraphQL libraries)
-
utils.js: Contains the core parser and resolver logic
-
server.js: Express server with /graphql endpoint
git clone https://github.com/yourusername/graphql-from-scratch
cd graphql-from-scratch
npm install
node server.jsMake a POST request:
POST /graphql
{
"query": "{ user { name posts { title } } }"
}-
✅ Nested querying
-
🔜 Multiple root queries
-
🔜 Schema validation
-
🔜 Variable & fragment support
Inspired by curiosity. GraphQL is powerful — but even more so when you understand how it works internally.
Aman Tyagi — LinkedIn