Graphql Vs Rest Api
Graphql Vs Rest Api
216
.ARTICLE.
DOI 10.36074/grail-of-science.15.03.2024.031
Oleh Zanevych
Post-graduate student of the Department of Applied Mathematics
Ivan Franko National University of Lviv, Ukraine
Summary . This article conducts a detailed comparison of leading REST and GraphQL web
development frameworks, including Node.js with Express, Spring Boot, Django, Flask, Ruby on Rails,
Apollo Server, GraphQL-Ruby, and Graphene. It assesses each framework's performance,
scalability, usability, and community support to highlight their strengths and application suitability.
The discussion extends to the challenges of framework selection, such as learning curves and
security, and anticipates future technological influences like cloud computing and AI. The analysis
aims to guide developers and organizations in choosing frameworks that best meet their project
needs and strategic objectives, providing a concise yet comprehensive resource in the evolving field
of web development.
Keywords: backend, Node.js, Spring Boot, Django, Flask, Ruby on Rails, Apollo Server, Graphene,
REST, GraphQL, framework.
Introduction
The landscape of back-end development has undergone significant
transformation over the past decades, transitioning from monolithic architectures to
the adoption of microservices and serverless computing paradigms. The evolution
of back-end frameworks has been pivotal in addressing the growing demands for
scalability, performance, and maintainability in web applications.
Initially, back-end development was synonymous with the use of CGI (Common
Gateway Interface) scripts in the early days of the web, facilitating dynamic content
generation on web servers. However, this approach quickly reached its limitations in
terms of scalability and performance [1]. The introduction of frameworks such as
Ruby on Rails in 2005 marked a paradigm shift, emphasizing convention over
configuration and the DRY (Don't Repeat Yourself) principle, significantly speeding up
the development process and reducing errors [2].
In parallel, the rise of Node.js in 2009 revolutionized back-end development by
introducing non-blocking, event-driven architecture, enabling the development of
highly scalable applications [3]. This period also saw the emergence of the Express.js
framework, which became synonymous with Node.js back-end development due to
its minimalism and flexibility.
The advent of microservices architecture further diversified the landscape of
back-end frameworks. Microservices allowed the decomposition of applications into
All rights reserved | Creative Commons Attribution-ShareAlike 4.0 International License 2024
Міжнародний науковий журнал «Грааль науки» | № 37 (березень, 2024)
217
smaller, independently deployable services, each running a unique process and
communicating through lightweight mechanisms [4]. This architecture promoted the
development of highly scalable and maintainable systems, leading to the popularity
of frameworks like Spring Boot for Java, which offers comprehensive infrastructure
support for developing microservices [5].
Moreover, GraphQL, developed by Facebook in 2012 and open-sourced in
2015 presented a novel approach to API development, allowing clients to request
exactly the data they need, reducing over-fetching and under-fetching issues
prevalent in REST APIs [6]. This led to the development of GraphQL-specific
frameworks, such as Apollo Server, enhancing the efficiency of data retrieval in
2024 Авторські права захищені | Creative Commons Attribution-ShareAlike 4.0 International License
International scientific journal «Grail of Science» | № 37 (March, 2024)
218
1. Survey of Modern Frameworks
The evaluation of modern back-end development frameworks involves
assessing their community, ecosystem, performance, scalability, ease of use, security
measures, and compatibility. The methodology aims to guide developers and
organizations in making informed decisions that align with their specific project
requirements and strategic goals. It assesses the framework's ability to process
requests efficiently, manage high loads, maintain low latency, and ensure
responsiveness to web applications. The framework's compatibility with other
systems and technologies also plays a crucial role in facilitating a flexible
development environment.
SECTION XV. INFORMATION TECHNOLOGIES AND SYSTEMS
All rights reserved | Creative Commons Attribution-ShareAlike 4.0 International License 2024
Міжнародний науковий журнал «Грааль науки» | № 37 (березень, 2024)
219
to minimize the amount of configuration and setup required to get a Spring
application up and running, thus significantly reducing development time and effort
[13].
At its core, Spring Boot automates much of the process involved in setting up
a Spring application, relying on sensible defaults and auto-configuration to free
developers from the tedious task of boilerplate code writing and infrastructure
setup. This automation is achieved through an array of features, including embedded
servers, which eliminate the need for external server configuration, and a
comprehensive set of starter dependencies that automatically configure Spring and
third-party libraries within the application context [12].
2024 Авторські права захищені | Creative Commons Attribution-ShareAlike 4.0 International License
International scientific journal «Grail of Science» | № 37 (March, 2024)
220
to facilitate rapid development of secure and maintainable websites, abstracting
much of the hassle involved in web development to allow developers to focus on
writing their app without needing to reinvent the wheel. Central to Django's appeal
is its embrace of the "Don't Repeat Yourself" (DRY) principle, encouraging reusability
of components and efficiency in code. Django comes equipped with an ORM (Object-
Relational Mapping) that supports a wide range of database operations, an
automatically generated admin interface for managing application content, and a
robust templating engine. Moreover, Django's security features are comprehensive,
offering built-in protection against many vulnerabilities, including SQL injection,
cross-site scripting, and cross-site request forgery, among others.
SECTION XV. INFORMATION TECHNOLOGIES AND SYSTEMS
On the other end of the spectrum, Flask provides a lightweight and modular
approach, offering developers the simplicity and flexibility to start small and scale up
as needed. Dubbed as a microframework, Flask does not require particular tools or
libraries, allowing for the development of web applications with minimal upfront
setup. This simplicity, however, belies its capability to support complex applications
through extensions that integrate additional functionalities, such as user
authentication, form validation, and database integration. Flask's design is
particularly suited for projects where a minimalist framework that can be easily
customized and extended is desirable. It thrives in environments where the
overhead and convention-driven development approach of more extensive
frameworks like Django are seen as restrictive.
The scientific discourse surrounding Django and Flask often revolves around
their suitability for various project scales, their performance benchmarks, and their
impact on developer productivity. While Django is frequently highlighted for its "all-
in-one" convenience and security robustness, making it ideal for enterprise-level
applications and rapid prototyping, Flask is lauded for its simplicity, flexibility, and
suitability for microservices architectures and smaller projects where granular
control over components is a priority. The choice between Django and Flask thus
becomes a matter of project requirements, developer preference, and the specific
trade-offs one is willing to make between convention and control.
Django and Flask represent two comprehensive yet distinctly different
approaches to web development within the Python community. Their continued
evolution reflects the dynamic nature of web development, pushing the boundaries
of what can be achieved with Python. Whether through Django’s extensive feature
set and its convention-over-configuration paradigm or Flask’s simplicity and
extensibility, both frameworks offer valuable tools for developers looking to leverage
Python's power in web application development. Their respective strengths and
philosophies cater to a wide array of development scenarios, underscoring Python's
versatility and its standing as a premier language for web development.
1.4 Ruby on Rails
Ruby on Rails, a full-stack framework, has revolutionized web application
development by promoting Convention over Configuration (CoC) and the Don't
Repeat Yourself (DRY) principle. It provides a structured environment for developers,
allowing them to build applications quickly and with fewer lines of code [16].
Rails' features include an ORM system called Active Record, Action Pack for
routing and controllers, Action View for view templates, and Active Job for
All rights reserved | Creative Commons Attribution-ShareAlike 4.0 International License 2024
Міжнародний науковий журнал «Грааль науки» | № 37 (березень, 2024)
221
background jobs. It also promotes a development culture that emphasizes quick
iterations, test-driven development, and pragmatic design. Rails has played a
significant role in the evolution of web standards and technologies, advocating for
RESTful architecture and the widespread adoption of MVC patterns. Its
comprehensive ecosystem and focus on developer experience and productivity
make it a compelling choice for startups and enterprises.
1.5 Apollo Server
Apollo Server stands as a pivotal architecture in the modern development
ecosystem, particularly for implementing GraphQL APIs. It is a community-driven,
open-source project that provides a seamless way to construct high-performance,
2024 Авторські права захищені | Creative Commons Attribution-ShareAlike 4.0 International License
International scientific journal «Grail of Science» | № 37 (March, 2024)
222
aligns with the requirements of modern application development, providing
developers with a powerful toolset for building efficient and scalable web services.
Through its comprehensive ecosystem and commitment to community-driven
development, Apollo Server continues to shape the future of web application
development, enabling the creation of data-rich, highly interactive web applications.
1.6 GraphQL-Ruby for Ruby
GraphQL-Ruby is a significant advancement in integrating GraphQL technology
into the Ruby ecosystem, offering a powerful tool for building and serving GraphQL
APIs. It allows Ruby developers to create GraphQL schemas in Ruby, allowing them
to define types, queries, mutations, and subscriptions directly [18].
SECTION XV. INFORMATION TECHNOLOGIES AND SYSTEMS
All rights reserved | Creative Commons Attribution-ShareAlike 4.0 International License 2024
Міжнародний науковий журнал «Грааль науки» | № 37 (березень, 2024)
223
development of enterprise-grade Java applications, providing an array of out-of-the-
box functionalities for microservices architecture. Django and Flask represent the
Python community's offerings, with Django's "batteries-included" approach
contrasting Flask's minimalist, extensible nature, both frameworks providing robust
solutions tailored to different complexity levels of web applications. Ruby on Rails,
embracing the principles of convention over configuration and DRY, streamlines the
development of database-backed web applications, promoting rapid development
and clean, maintainable code.
Transitioning to GraphQL-based frameworks, Apollo Server emerges as a
comprehensive solution that integrates seamlessly with various JavaScript
2024 Авторські права захищені | Creative Commons Attribution-ShareAlike 4.0 International License
International scientific journal «Grail of Science» | № 37 (March, 2024)
224
minimal configuration. Django and Flask cater to the Python community, with Django
providing a full-fledged framework for developers seeking an all-in-one solution,
while Flask appeals to those desiring modularity and the flexibility to choose only the
components they need. Ruby on Rails stands out for its opinionated framework,
promoting convention over configuration, and speeding up development with its rich
ecosystem and DRY principles.
Transitioning to the GraphQL frameworks, Apollo Server, GraphQL-Ruby, and
Graphene each demonstrate distinct advantages in facilitating the development of
GraphQL APIs. Apollo Server excels in creating a unified GraphQL layer that can
connect to multiple data sources, offering advanced features like caching,
SECTION XV. INFORMATION TECHNOLOGIES AND SYSTEMS
All rights reserved | Creative Commons Attribution-ShareAlike 4.0 International License 2024
Міжнародний науковий журнал «Грааль науки» | № 37 (березень, 2024)
225
success story is LinkedIn, which migrated its mobile backend to Node.js for improved
performance and scalability, demonstrating the framework's capability to support
high-traffic applications.
Spring Boot has empowered developers to rapidly develop and deploy
microservices, thanks to its convention-over-configuration approach and its suite of
integrated technologies. Netflix, a pioneer in the microservices architectural style,
leverages Spring Boot for its robust, distributed systems, which are capable of
handling over a billion calls daily to its API, serving millions of users worldwide. This
showcases Spring Boot's ability to facilitate complex, cloud-native application
architectures at scale.
2024 Авторські права захищені | Creative Commons Attribution-ShareAlike 4.0 International License
International scientific journal «Grail of Science» | № 37 (March, 2024)
226
Spring Boot excel in scalability and performance tuning, though they require
understanding of their underlying systems. GraphQL frameworks like Apollo Server
and Graphene necessitate sophisticated schema design due to complexities in query
optimization. Spring Boot and Django provide extensive support for integration with
databases and external APIs, while GraphQL frameworks may need extra effort to
align with existing infrastructures. Security considerations also vary, with frameworks
like Rails offering built-in protections against common vulnerabilities, unlike Flask
and Express which require a more proactive security approach. Finally, the choice
between REST and GraphQL is strategic, with REST suited for traditional web services
and GraphQL for applications needing complex data retrieval, despite the added
SECTION XV. INFORMATION TECHNOLOGIES AND SYSTEMS
All rights reserved | Creative Commons Attribution-ShareAlike 4.0 International License 2024
Міжнародний науковий журнал «Грааль науки» | № 37 (березень, 2024)
227
and a minimalist, extensible framework, respectively. Ruby on Rails remains a
cornerstone for developers seeking rapid development cycles, emphasizing
convention and cleanliness in code.
On the other hand, GraphQL frameworks like Apollo Server, GraphQL-Ruby,
and Graphene signify the evolving needs of web applications in handling more
complex, data-driven interactions. These frameworks offer more granular and
efficient data fetching capabilities, reflecting a shift towards providing clients with
precisely the data they request, reducing over-fetching and under-fetching issues
inherent in RESTful services. Apollo Server provides a comprehensive set of tools for
building feature-rich GraphQL servers, while GraphQL-Ruby integrates GraphQL's
References:
[1] Fielding, R. T., & Taylor, R. N. (2002). Principled design of the modern web architecture.
ACM Transactions on Internet Technology, 2(2), 115–150.
https://doi.org/10.1145/514183.514185.
[2] Ruby, S., Thomas, D., & Dave, (2023). Agile Web Development with Rails 7. Pragmatic
Bookshelf. ISBN 1680509292.
[3] Tilkov, S., & Vinoski, S. (2010). Node.js: Using JavaScript to Build High-Performance
Network Programs. IEEE Internet Computing, 14(6), 80-83.
https://doi.org/10.1109/MIC.2010.145.
[4] Newman, S. (2015). Building Microservices. O'Reilly Media.
[5] Carnell, J., & Huaylupo Sánchez, I. (2021). Spring Microservices in Action, Second Edition.
Manning Publications Co. ISBN: 978-1617296956.
[6] Hartig, O., & Pérez, J. (2018). Semantics and Complexity of GraphQL. In
Proceedings of the 2018 World Wide Web Conference (WWW '18).
International World Wide Web Conferences Steering Committee, 1155–1164.
https://doi.org/10.1145/3178876.3186014.
[7] Baldini, I., Cheng, P., Fink, S. J., Mitchell, N., Muthusamy, V., Rabbah, R., Suter, P., & Tardieu,
O. (2017). The serverless trilemma: function composition for serverless computing. In
Proceedings of the 2017 ACM SIGPLAN International Symposium on New Ideas, New
Paradigms, and Reflections on Programming and Software (Onward! 2017). Association
for Computing Machinery, 89–103. https://doi.org/10.1145/3133850.3133855.
2024 Авторські права захищені | Creative Commons Attribution-ShareAlike 4.0 International License
International scientific journal «Grail of Science» | № 37 (March, 2024)
228
[8] Sud, K. (2020). Beginning Node.JS. In: Practical hapi. Apress, Berkeley, CA.
https://doi.org/10.1007/978-1-4842-5805-7_2.
[9] Kabamba, H. M., Khouzam, M., & Dagenais, M. R. (2024). Vnode: Low-Overhead
Transparent Tracing of Node.js-Based Microservice Architectures. Future Internet, 16(1),
13. https://doi.org/10.3390/fi16010013.
[10] Mardan, A. (2014). Starting with Express.js. In: Pro Express.js. Apress, Berkeley, CA.
https://doi.org/10.1007/978-1-4842-0037-7_1.
[11] Du, X. (2022). Design of Asynchronous Non-blocking Network Crawler
Based on Node.js. In 2022 International Conference on Intelligent Transportation,
Big Data & Smart City (ICITBS) (pp. 924-926). Hengyang, China.
https://doi.org/10.1109/ICITBS55627.2022.00202.
SECTION XV. INFORMATION TECHNOLOGIES AND SYSTEMS
[12] Turnquist, G. L., Syer, D., Heckler, M., & Long, J. (2022). Learning Spring Boot 3.0: Simplify
the development of production-grade applications using Java and Spring. Packt
Publishing.
[13] Reddy, K. S. P., & Upadhyayula, S. (2022). Beginning Spring Boot 3: Build Dynamic Cloud-
Native Java Applications and Microservices (2nd ed.). Apress.
https://doi.org/10.1007/978-1-4842-8792-7.
[14] Lopatin, B. (2020). Django Standalone Apps: Learn to Develop Reusable Django Libraries.
Apress. https://doi.org/10.1007/978-1-4842-5632-9.
[15] Coburn, J. (2020). Getting Started with Flask. In: Build Your Own Car Dashboard with a
Raspberry Pi. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-6080-7_6.
[16] Donald, G. (2024). Getting Started with Ruby on Rails. In: Hands-on Test-Driven
Development. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-9748-3_4.
[17] Biswas, N. (2023). Practical GraphQL: Learning Full-Stack GraphQL Development with
Projects. Apress. https://doi.org/10.1007/978-1-4842-9621-9.
[18] CloudDevs (2023). Building GraphQL APIs with Ruby. Retrieved March 10, 2024, from
https://clouddevs.com/ruby/building-graphql-apis.
[19] Graphene-Python Project. Quickstart. Retrieved March 10, 2024, from
https://docs.graphene-python.org/en/latest/quickstart.
All rights reserved | Creative Commons Attribution-ShareAlike 4.0 International License 2024