Performance evaluation of REST and GraphQL API aproaches in data retrieval scenarios using NestJS

Main Article Content

DOI

Kacper Stępień

s95574@pollub.edu.pl

https://orcid.org/0009-0008-6210-6034
Maria Skublewska-Paszkowska

maria.paszkowska@pollub.pl

https://orcid.org/0000-0002-0760-7126

Abstract

The main aim of the study is to compare the performance of two API approaches, REST and GraphQL, in the context of data retrieval. Two applications with identical functionality have been developed in NestJS using a PostgreSQL database. Performance tests have been carried out using Grafana k6, simulating loads from 1,000 to 24,000 users. REST achieves better response times and throughput in simple queries from a single table. GraphQL shows better performance in scenarios involving complex queries from four related tables. In scenarios involving partial field selection, GraphQL returns significantly smaller responses – up to 94% smaller than REST. The results indicate that REST is more efficient in simple and high-load scenarios, while GraphQL performs better in complex data structures.

Keywords:

REST, GraphQL, NestJS, API performance

References

Article Details

Stępień, K., & Skublewska-Paszkowska, M. (2025). Performance evaluation of REST and GraphQL API aproaches in data retrieval scenarios using NestJS. Journal of Computer Sciences Institute, 36, 350–356. https://doi.org/10.35784/jcsi.7794