Tutorials on Web Applications

Learn about Web Applications from fellow newline community members!

  • React
  • Angular
  • Vue
  • Svelte
  • NextJS
  • Redux
  • Apollo
  • Storybook
  • D3
  • Testing Library
  • JavaScript
  • TypeScript
  • Node.js
  • Deno
  • Rust
  • Python
  • GraphQL
  • React
  • Angular
  • Vue
  • Svelte
  • NextJS
  • Redux
  • Apollo
  • Storybook
  • D3
  • Testing Library
  • JavaScript
  • TypeScript
  • Node.js
  • Deno
  • Rust
  • Python
  • GraphQL

Evaluating Frameworks for Micro-Frontends: React, Angular, Vue, Svelte, Qwik

This article dives deep into the realm of micro-frontends, with a particular emphasis on the Qwik Framework. This article also explores why Qwik may be a superior choice for managing micro-frontends compared to its counterparts like React , Angular , Vue , and Svelte . Micro-frontends represent an innovative design approach where a frontend app is partitioned into small, independent, manageable units that operate cohesively. Each unit, known as a micro-frontend, is managed by a separate team, leading to highly efficient and scalable development processes for complex applications. Key characteristics of micro-frontends include: Before examining the specifics of Qwik , it's worth comparing it to other popular frameworks in the context of micro-frontends. While React boasts a robust ecosystem and a well-established community, it requires additional libraries and configurations for effective micro-frontend management. The hydration process can be resource-intensive, potentially slowing performance. Libraries like Module Federation from Webpack enables different React applications to share components and dependencies dynamically at runtime, facilitating the integration of multiple micro-frontends. Routing can be managed with libraries such as single-spa that allows for the coexistence and independent operation of multiple React apps on a single page, ensuring that each micro-frontend can function and be navigated independently. State management across micro-frontends can be tricky; tools like Redux with additional middleware or the newer Redux Toolkit can be configured to share states selectively or manage local states separately, maintaining data consistency and flow between micro-frontends. This setup often requires careful consideration of loading strategies, dependency sharing, and deployment configurations to ensure seamless integration and operation of micro-frontends in a larger application ecosystem. Despite Angular 's built-in tools for module separation and micro-frontend architecture, it can become complex with larger applications. Performance optimizations require significant effort. Angular is designed to support modularity through its built-in dependency injection system and hierarchical module architecture, which are advantageous for developing micro-frontends. However, as applications scale, managing these modules and ensuring efficient loading and execution can become complex. Angular’s performance in large applications can be bogged down by lengthy build times and slow boot-up times due to the size of the application bundle. To address this, developers often need to implement lazy loading of modules using Angular's Router, which allows parts of the application to be loaded on demand rather than at the initial load. Furthermore, ahead-of-time (AOT) compilation can be employed to pre-compile HTML templates and components into JavaScript at build time rather than at runtime, reducing the workload on the browser and improving performance. Additionally, tree-shaking, enabled through build tools like Webpack, helps eliminate unused code from final bundles, enhancing load times and runtime efficiency. Performance profiling tools such as Angular DevTools can also be used to identify performance bottlenecks, particularly in change detection cycles and rendering processes. These strategies collectively help in managing the complexity and optimizing the performance of large-scale Angular applications employing a micro-frontend architecture. Vue is lightweight and flexible with modular development support via Vue CLI. However, its built-in support for micro-frontends is limited, necessitating additional configurations and third-party libraries. Unlike frameworks specifically designed for micro-frontends, Vue does not inherently handle the isolation of styles, state management, and dependency management between multiple frontends. To address these limitations, developers often turn to third-party libraries like single-spa-vue , which provides the necessary infrastructure to integrate Vue applications into a micro-frontend environment by allowing them to coexist and remain independent within a single-parent application. Configurations involving module federation with Webpack can also be necessary, enabling different Vue projects to share components and libraries dynamically, reducing redundancy and improving load times. Additionally, state management across micro-frontends might require a more unified approach using Vuex or global event buses to ensure data consistency and communication across independently deployed Vue applications. These added layers of integration highlight the need for careful setup and management to leverage Vue effectively in micro-frontend architectures. Although Svelte compiles to minimal JavaScript for faster performance, its ecosystem for micro-frontend architecture is less mature compared to React or Angular . Svelte's ecosystem is less mature for micro-frontend architecture primarily because it is a newer framework compared to React or Angular, which have both been widely adopted and rigorously tested in various architectural setups, including micro-frontends. React and Angular benefit from extensive community support and a plethora of libraries and tools specifically designed to handle the complexities of micro-frontend implementations, such as module federation with Webpack in React and advanced module management in Angular. These frameworks offer robust solutions for isolation, scalable state management, and dynamic module loading, aspects critical to effective micro-frontend architecture. In contrast, Svelte, while offering a compelling approach by compiling down to minimal JavaScript, lacks a comprehensive set of tools and community-backed solutions specifically geared towards micro-frontends. This can make integration, inter-app communication, and the orchestration of multiple Svelte instances within a larger application more challenging, requiring more custom solutions or adaptations of existing tools not initially designed with Svelte in mind. The Qwik Framework shines in the micro-frontend landscape due to its strong emphasis on performance and scalability. There is also no need for an external library to implement MFE with Qwik. Here's why Qwik stands out for managing micro-frontends: In conclusion, Qwik's architecture, with its focus on resumability, fine-grained lazy loading, and minimal JavaScript execution, is exceptionally suited for building micro-frontends. Each micro-frontend created with Qwik is fast, efficient, and easy to integrate into a larger application. For those keen on diving deeper into Qwik , consider the Complete Guide to Qwik Framework available on \newline or Amazon. This comprehensive guide covers all the crucial APIs in Qwik and provides practical examples of creating an e-commerce application with Supabase .

Unlocking the Potential of Qwik's Non-Hydration Web Architecture

Welcome to an insightful journey into the world of hydration and non-hydration architectures , focusing on the Qwik web development framework. This educational piece aims to clarify the key aspects of these web architectures, their pros and cons, and how the Qwik framework harnesses the power of non-hydration for exceptional performance. Before diving into the details, it is important to understand what hydration architecture actually is. This architecture encompasses two crucial elements: Though commonly used, this architecture comes with a few notable challenges: The Qwik framework adopts a unique approach, utilizing a non-hydration architecture . This architecture has two distinct elements: Qwik's non-hydration architecture brings a lot to the table: Qwik's non-hydration architecture , coupled with features like resumable components , progressive hydration , and automatic pre-rendering , offers much more: Qwik's non-hydration web architecture presents significant advantages over traditional web hydration -based frameworks. By prioritizing resumability , minimal JavaScript execution, and immediate interactivity, it contributes to faster load times, enhanced performance, and an improved user experience. To dive deeper into the Qwik Framework, I created the book, The Complete Guide to Qwik Framework . This comprehensive resource covers everything from the vision of Qwik , to tips and tricks from a core Qwik member (which is me!). It's available at newline.co . The future of web development is about cutting-edge solutions that exploit the resources we already have. And Qwik is a persuasive step in that direction

I got a job offer, thanks in a big part to your teaching. They sent a test as part of the interview process, and this was a huge help to implement my own Node server.

This has been a really good investment!

Advance your career with newline Pro.

Only $30 per month for unlimited access to over 60+ books, guides and courses!

Learn More

An Introduction to the High-Performance Web Development Framework (Qwik)

Welcome to this introduction of Qwik , an exceptional web development framework tailored to tackle the most significant challenges in traditional web application development. This guide will dive into the pivotal features, merits, and real-world applications of Qwik , providing knowledge acquired from one of the key contributors to the framework, which is me! As application complexity increases, loading times suffer, leading to a sub-optimal user experience. Say hello to Qwik , an innovative framework created to tackle these hurdles and propose a distinctive approach to creating web applications. Qwik 's features concentrate on performance, user-friendliness, and scalability. Let's study these features more in moe detail: In essence, Qwik emphasizes heavily on performance while preserving the developer experience and community involvement. As we forge ahead, it is clear that our approach to web development must adapt. To dive deeper into the Qwik Framework, I created the book, The Complete Guide to Qwik Framework . This comprehensive resource covers everything from the vision of Qwik , to tips and tricks from a core Qwik member (which is me!). It's available at newline.co . The future of web development is about cutting-edge solutions that exploit the resources we already have. And Qwik is a persuasive step in that direction. If you're uncertain whether diving into Qwik is the correct move for you, take the following into consideration. The Complete Guide to Qwik Framework will be particularly beneficial if you: Complete Guide to Qwik Framework encompasses a broad spectrum of subjects, from getting started with Qwik to deploying a Qwik application in a production environment. You'll dive into SEO and Core Web Vitals, learn how to style and render data with Qwik , and even uncover how to create an e-commerce site using Qwik and Supabase. You'll also glean insights into Qwik 's full-text search functionality and explore how to add tests to your Qwik application. Qwik is a dynamic and performance-focused web development framework offering a brand new approach to web application development. With its performance emphasis, community engagement, and developer-friendly features, Qwik is positioned to leave a significant imprint on the future of web application development. To jumpstart your journey with Qwik , consider investing in Complete Guide to Qwik Framework . A meticulously structured, insightful guide can serve as an invaluable compass, spotlighting key concepts, best practices, and practical applications. Remember, the journey of learning is ever going — it's a never-ending process of exploration and discovery.

Boost Web Speed and Efficiency with Qwik Framework: An Innovative Approach to Web Development

In this article, I will uncover the challenges that modern web development practices present and shed light on how the Qwik Framework, could potentially be the answer we've been searching for. One might believe that as technology advances, processing speeds, and network capabilities will naturally enhance, thereby resolving web speed limitations that we currently have. However, the reality is far more complex. We've reached a hard stop in processing speeds, and without breakthroughs like quantum computing, further progress seems unlikely. This is where the Qwik Framework enters the picture, offering a fresh perspective on web development that maximizes the potential of existing processing capabilities. To fully grasp the issue at hand, it's important to first understand why relying solely on faster CPUs for quick loading and highly responsive websites is not a viable option. CPUs primarily speed up in three ways: Nonetheless, we've already hit the physical limit of clock speed, which stands roughly at 3.5GHz. Beyond this point, the signal is unable to travel from one end of a silicon chip to the other within a single cycle, leading to a stagnation of clock speeds. Recognizing the constraints of processing power, it is clear that the answer lies in creating frameworks that can tap into the full potential of what we already have. The Qwik Framework is one such promising tool, employing several innovative principles to enhance web application performance. Traditional frameworks often require a full state rebuild of an application on the client side after initial server-side rendering, a process known as hydration . However, Qwik introduces the ground-breaking concept of resumability , which enables the application's state to be serialized on the server and resumed on the client without complete rehydration. This reduces the amount of JavaScript executed on the client side, significantly boosting performance. Several frameworks bundle large quantities of JavaScript that must be downloaded and executed before a page becomes interactive, resulting in extended load times. Qwik adopts fine-grained lazy loading , loading only the essential JavaScript for the current interaction. This strategy massively reduces initial load time, enhances site responsiveness, and improves key performance indicators like Time to Interactive (TTI) and First Input Delay (FID) . While Static Site Generation (SSG) and Server-Side Rendering (SSR) can enhance performance, they typically require extra configuration and tools. Qwik automatically pre-renders pages, ensuring that even dynamic content is accessible to users and search engines in a static format, thus improving load times and user experience. Qwik supports the development of micro-frontends , enabling developers to build modular and independently deployable components. This modular architecture ensures that only the necessary parts of the application are loaded, resulting in improved performance and scalability. Qwik reduces JavaScript overhead by leveraging resumability, and fine-grained lazy loading. This results in significantly smaller JavaScript bundles and faster load times. As we forge ahead, it is clear that our approach to web development must adapt, frameworks like Qwik are the only answer for now. To dive deeper into the Qwik Framework, I created the book, The Complete Guide to Qwik Framework . This comprehensive resource covers everything from the vision of Qwik , to tips and tricks from a core Qwik member (which is me!). It's available at newline.co . The future of web development isn't just about faster CPUs and networks. It's about utilizing the resources we already have. And Qwik is a persuasive step in that direction.

Qwik SEO Performance: Why It May Outshine React, Angular, Vue, and Svelte

SEO is a critical element for any online platform's success. As SEO gained momentum, web development technologies like React , Angular , Vue , and Svelte had to integrate SEO into their core structure. However, there is a technology designed from scratch to incorporate SEO principles into its core structure — Qwik . This article will explore how Qwik promises superior SEO performance compared to other popular web development technologies. React enjoys widespread use, but it requires additional libraries and configurations like Next.js for Server-Side Rendering (SSR) and Static Site Generation (SSG) to achieve optimal SEO performance. Moreover, its hydration process can be resource-intensive, affecting load times. Angular without a doubt has impressive SEO capabilities with Angular Universal for SSR. However, managing performance optimizations for SEO can become complex due to the intricacy of Angular applications. Angular primarily renders content client-side, which means that when search engines crawl these applications, they often encounter minimal pre-rendered content, leading to potential indexing issues. This is because search engine crawlers typically expect content to be immediately available in the HTML when they fetch a page, but Angular's reliance on JavaScript to build and render its components can delay the content visibility to crawlers until scripts are fully executed. Additionally, managing navigation and URLs in Angular SPAs can be tricky as they use the # symbol by default for routing, which isn't SEO-friendly at all. Although Angular Universal offers server-side rendering (SSR) to address these issues by pre-rendering pages on the server itself, setting it up involves additional complexity and requires careful configuration in order to make sure that dynamic content is rendered correctly for search engines. Utilizing Nuxt.js , Vue offers robust SEO support through SSR and SSG. However, similar to React , it requires additional tools and configurations for peak SEO performance. Configuring Nuxt.js to automatically generate meta tags and link elements using its head method in Vue components is crucial for enhancing SEO by providing search engines with relevant metadata. Additionally, the use of nuxt-sitemap module to automatically generate sitemaps and nuxt-robots module to manage robots.txt files further optimizes the visibility to search engine crawlers. For content-heavy sites, implementing the nuxt-lazy-load plugin can improve page load times by delaying the loading of images and other heavy assets until they are in or near the viewport. This results in an enhanced Core Web Vitals score — a key metric in Google's SEO rankings. Lastly, setting up proper redirects and configuring canonical URLs directly within Nuxt.js ensures that search engines index the pages correctly, avoiding duplicate content issues that could negatively impact SEO performance. Svelte and its companion Sapper (or SvelteKit ) provide excellent SEO capabilities with SSR and SSG. Yet, Qwik's unique lazy loading and resumability approach offers even more room for performance optimization. Qwik introduces resumability, allowing the framework to serialize the application state on the server and resume it on the client. This decreases the need for re-rendering, improving performance, and faster load times — vital for SEO. Qwik uses fine-grained lazy loading, loading only the minimal JavaScript required for initial page rendering and interaction. This significantly reduces Time to Interactive (TTI) and First Input Delay (FID)—key metrics for SEO. Qwik supports both SSG and SSR, ensuring web pages are fully rendered server-side, and providing search engines with fully formed HTML content. This boosts SEO by enhancing crawlability and indexing. Qwik pre-renders pages automatically, ensuring even dynamic pages are available to search engines in a static format. This results in quicker load times and improved SEO. Qwik optimizes hydration by hydrating only the parts of the page that need to be interactive, reducing overall load time and enhancing user experience. The architecture of Qwik supports the development of micro-frontends, enabling developers to build modular, independently deployable components. This modularity ensures only necessary components are loaded, leading to better performance and SEO. Qwik provides a robust routing system that supports dynamic and static routes easily. It ensures URLs are SEO-friendly and the site's structure is easily crawlable by search engines. Qwik is a potent web development technology with a strong focus on SEO. Its unique features like resumability, fine-grained lazy loading, and automatic pre-rendering make it a promising tool for developers aiming to optimize their site's search engine performance. There's much to understand about Qwik and its SEO advantages. To help you better grasp this technology, I have developed a comprehensive guide as a core Qwik team member. The Complete Guide to Qwik Framework will walk you through the major and minor technical aspects of Qwik , offer insights from seasoned developers, and demonstrate how to deploy a real-world application using Qwik .

Kickstart Your Next Project with Deno and PostgreSQL

Most modern web applications rely on a relational database management system (RDBMS) to store and retrieve troves of related data. When you bring together two modern, open-source technologies, Deno and PostgreSQL , you can build production-grade web applications that... Since Deno was built as an improved, alternative V8 runtime to Node.js, Deno projects can use both the third-party modules developed specifically to work with Deno and the many third-party packages that exist in the npm ecosystem. A popular PostgreSQL client for Node.js projects is node-postgres . If you visit the deno.land/x website and search postgres , then you will come across deno-postgres , a lightweight PostgreSQL driver that was developed specifically for Deno. The API and underlying implementation of deno-postgres is based on two popular PostgreSQL drivers: node-postgres (coincidentally) and pq , a Go PostgreSQL driver. deno-postgres provides abstractions for features and operations that allow you to unleash the full potential of PostgreSQL: connection pools, prepared statements, transactions and typed queries. Below, I'm going to show you how to... To get started, let's use Docker to spin up a new PostgreSQL database on the local machine. Running this command creates a new Docker container based on the official postgres Docker image. The docker run command accepts several options and flags that override image and Docker runtime defaults. For this tutorial, the database's schema design is based on a bank. The schema consists of three tables: To create tables in the database, let's run a SQL file directly against the pg_db_container container. With this approach, we never have to copy the SQL file from the host machine to the container. First, create a SQL file named create-db.sql that creates the customers , accounts and transactions tables: ( create-db.sql ) Then, run the following command, which pipes the contents of the create-db.sql SQL file (as a command string) to the psql command that's ran within the pg_db_container container: Alternatively, you can create a Dockerfile that extends the postgres image and copies the create-db.sql file from the host machine to the container's /docker-entrypoint-initdb.d directory. All scripts within this directory are ran at the time the container starts up (and the container's data directory is also empty). Note : Do not adopt this schema for production. The database does not fully reflect what actually happens in the real world. For example, it does not account for the differences in the number of digits a checking account number has (commonly ) and a savings account number has (commonly ). Also, for simplicity's sake, balance calculations only involve integer values. Remember, the main focus of this tutorial is to demonstrate the capabilities of deno-postgres . Now, create a SQL file named seed-customers.sql that inserts three customer records into the customers table. ( seed-customers.sql ) Then, run the following command to populate the database with these three customers: To verify that the database has been successfully seeded with this data, let's query the database with the psql interactive shell: You will be prompted to enter the superuser's password. Once entered, the terminal launches the psql interactive shell, which runs inside the PostgreSQL database server. Enter the following SQL SELECT statement to query the customers table for the seeded data: Create a new project folder named deno-postgres . Within this folder, create a server.ts file. Within server.ts , write a simple HTTP server that responds to every request with a "Hello World!" message. ( deno-postgres/server.ts ) To run the server, execute the following command: The --allow-net option grants network access to the Deno script. When you visit http://localhost:8000/ (or any URL beginning with http://localhost:8000/ ) in your browser, you will find the "Hello World!" message printed on the page. Oak is an HTTP middleware framework for Deno that includes a router middleware. Both the framework and router are inspired by Koa , so if you have any prior experience working with Koa, then many aspects of the code should look quite familiar. Let's modify the server to only respond to requests sent to a GET / endpoint by enabling routing. ( deno-postgres/server.ts ) Re-run the server. The browser only prints the "Hello World!" message for http://localhost:8000/ . As we progress in this tutorial, each new route (and route handler) we add to this router will demonstrate the features and operations that deno-postgres comes with. To connect to the PostgreSQL database, let's import the PostgreSQL client from deno-postgres . Then, create and initialize a new instance of the PostgreSQL client, like so: Each PostgreSQL client instance manages a connection to a single PostgreSQL database. The configuration options we pass to Client tell the driver everything it needs to know to connect to the PostgreSQL database, such as the database's hostname and the credentials of the superuser. You can find more options here . For encrypted connections to the database via SSL/TLS, click here . Call the client's connect method to connect to the database. Call the client's end method to terminate the connection to the database. To ensure the script starts the server only when the client has successfully connected to the PostgreSQL database, perform both client.connect and app.listen in a try block. Any errors that prevent the server from running will terminate the connection to the database. When you run the server, Deno prompts you to grant access to several PostgreSQL environment variables: Press y to grant access for each requested environment variable. To skip this series of prompts, run the Deno script with the --allow-env flag, like so: If the terminal shows no error messages, and the server returns a "Hello World!" message for a GET / request, then the server has successfully connected to the dockerized PostgreSQL database. The recommended way to execute queries is with prepared statements, especially if your application accepts user input. Prepared statements protect your PostgreSQL database from SQL injection attacks. Since the SQL code (statement template) is pre-compiled, prepared statements are also efficient. The statement template consists of a base SQL statement with placeholders for bind variables. Let's write our first prepared statement for querying the customers table based on the customer's first name. Within the deno-postgres/server.ts file, define a new route on the router for the GET /customers endpoint. This endpoint will return customers from the customers table based on a query parameter, firstName . Using this query parameter, we can tell the query to only find customers whose first name matches the value of firstName . For example, firstName=alice would filter the table for any customer who has a first name of "Alice." To extract query parameters from the URL, import the getQuery method from Oak's helpers module, like so: helpers provides APIs for managing router contexts. Then, using the client.queryArray method, write a route handler for the GET /customers endpoint that... The client.queryArray method executes the query and returns the results of the query as an array. It can accept, at most, two arguments: Note : client.queryArray also accepts named arguments . In the WHERE clause, ILIKE is used for case-insensitive string matching. A % sign in the pattern matches for any sequence of characters. So if the URL does not contain a firstName query parameter (or it's set explicitly to an empty string), then the ILIKE will match for any first_name . Note : Don't use % as a default value for ILIKE conditions in production. This is just a quick and easy implementation that ensures all customers are returned if the user decides not to provide any query parameters. Re-run the server. When you visit http://localhost:8000/customers?firstName=alice in a browser, you will see the results of the query. Note : You can use cURL or an application like Postman to send the request. The above is shown in a Chrome browser using the JSONView extension. In this case, because the customers table had a customer whose first name is "Alice," that record ( id , firstName and lastName ) was returned as an array of values. The first value corresponds to the first column id , the second value corresponds to the second column firstName , and the third value corresponds to the third column lastName . Now, let's check that the prepared statement guards against SQL injection attacks. Within the browser, visit http://localhost:8000/customers?firstName=alice%20OR%201%3D1 . If the value of the firstName query parameter was directly placed within the SQL statement, then the SQL statement would be SELECT id, first_name, last_name FROM customers WHERE first_name ILIKE 'alice' OR 1=1 . With the OR operator and 1=1 condition, the WHERE clause always evaluates to true . You would expect all the rows in the customers table to be leaked. However, that's not what happens: Yet, if use psql to execute this same SQL statement, then all the rows in the customers table are leaked. The client correctly executes the query as SELECT id, first_name, last_name FROM customers WHERE first_name ILIKE 'alice OR 1=1' , not SELECT id, first_name, last_name FROM customers WHERE first_name ILIKE 'alice' OR 1=1 . Let's add another query parameter, lastName , to find customers whose last name matches the value of lastName . Re-run the server. When you visit http://localhost:8000/customers?firstName=alice&lastName=king in a browser, you will see the results of the query. Note : There's also a queryObject method, which accepts the same arguments as the queryArray method, but returns the response as an object with the column names as keys. Altogether, the deno-postgres/server.ts file should look like this: ( deno-postgres/server.ts ) Try using PostgreSQL and Deno for your next project! To learn how to create and deploy a production-ready, REST API with Deno from scratch, check out Halvard Mørstad's course here . Halvard is a software engineer and is the author of Nessie , a modular database migration tool for Deno.

Thumbnail Image of Tutorial Kickstart Your Next Project with Deno and PostgreSQL