Movatterモバイル変換


[0]ホーム

URL:


Packt
Search iconClose icon
Search icon CANCEL
Subscription
0
Cart icon
Your Cart(0 item)
Close icon
You have no products in your basket yet
Save more on your purchases!discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Profile icon
Account
Close icon

Change country

Modal Close icon
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timerSALE ENDS IN
0Days
:
00Hours
:
00Minutes
:
00Seconds
Home> Web Development> Full Stack Web Development> Modern Full-Stack React Projects
Modern Full-Stack React Projects
Modern Full-Stack React Projects

Modern Full-Stack React Projects: Build, maintain, and deploy modern web apps using MongoDB, Express, React, and Node.js

Arrow left icon
Profile Icon Bugl
Arrow right icon
€23.99€26.99
Full star iconFull star iconFull star iconFull star iconHalf star icon4.8(9 Ratings)
eBookJun 2024506 pages1st Edition
eBook
€23.99 €26.99
Paperback
€33.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€23.99 €26.99
Paperback
€33.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want
Product feature iconAI Assistant (beta) to help accelerate your learning
OR

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Table of content iconView table of contentsPreview book icon Preview Book

Modern Full-Stack React Projects

Preparing for Full-Stack Development

In this chapter, I am first going to give a brief overview of the contents of the book and explain why the skills taught in this book are important in a modern development environment. Then, we will jump into action and set up a project that will be used as a basis for the development of our full-stack projects. At the end of this chapter, you will haveanintegrated development environment (IDE) and project set up and ready for full-stack development and will understand which tools can be used for setting upsuch projects.

In this chapter, we are going to cover the followingmain topics:

  • Motivation to become afull-stack developer
  • What is new in thethird edition?
  • Getting the most out ofthis book
  • Setting up thedevelopment environment

Technical requirements

This chapter will guide you through setting up all the necessary technologies needed for developing full-stack web applications throughout this book. Before we start, please install the following, if you do not already havethem installed:

  • Node.js v20.10.0
  • Git v2.43.0
  • Visual StudioCode v1.84.2

Those versions are the ones used in the book. While installing a newer version should not be an issue, please note that certain steps might work differently on a newer version. If you are having an issue with the code and steps provided in this book, please try using thementioned versions.

You can find the code for this chapter onGitHub:https://github.com/PacktPublishing/Modern-Full-Stack-React-Projects/tree/main/ch1.

The CiA video for this chapter can be foundat:https://youtu.be/dyf3nECvKAE.

Important

If you cloned the full repository for the book, Husky may not find the.git directory when runningnpm install. In that case, just rungit init in the root of the correspondingchapter folder.

Motivation to become a full-stack developer

Understanding full-stack development is becoming increasingly important, as companies seek to increase the cooperation – and reduce the gap – between the frontend and the backend. The frontend is becoming more deeply integrated with the backend, using technologies such as server-side rendering. Throughout this book, we are going to learn about the development, integration, testing, and deployment offull-stack projects.

What is new in this release of Full-Stack React Projects?

Unlike previous releases of Full-Stack React Projects, this new release focuses more on the integration of the frontend with the backend than the previous two editions, and thus intentionally does not focus so much on creating auser interface (UI) or using UI libraries, such asMaterial UI (MUI), on the frontend. This edition gives the essential knowledge for integrating and deploying full-stack web applications. The deployment of apps was missing completely from previous editions, and testing was only briefly introduced. This edition focuses more on these essential parts of full-stack development such that, after reading this book, you will be able to develop, integrate, test, and deploy a full-stackweb application.

Getting the most out of this book

To keep the book short and to the point, we are going to use specific technologies and tools. The concepts, however, apply to other technologies as well. We will attempt to briefly introduce alternatives so that if something is not a good fit for your project, you can pick and choose different tools. I recommend first trying out the technologies introduced in this book to be able to follow the instructions, but do not hesitate to try out the alternatives on yourown later.

It is highly recommended that you write the code on your own. Do not simply run the code examples that are provided. It is important to write the code yourself in order to learn and understand it properly. However, if you run into any issues, you can always refer to thecode examples.

With that said, let’s start with setting up our development environment in thenext section.

Setting up the development environment

In this book, we are going touseVisual Studio Code (VS Code) as our code editor. Feel free to use whichever editor you prefer, but keep in mind that the extensions used and settings configured may be slightly different in the editor ofyour choice.

Let’s now install VS Code and useful extensions, and then continue setting up all the tools needed for ourdevelopment environment.

Installing VS Code and extensions

Before wecan get started developing and setting up the other tools, we need to set up our code editor by followingthese steps:

  1. DownloadVS Code for your operating system from the official website (at the time of writing, theURL ishttps://code.visualstudio.com/). We are going to use version1.84.2 inthis book.
  2. After downloading and installing the application, open it, and you should see thefollowing window:
Figure 1.1 – A fresh installation of VS Code (on macOS)

Figure 1.1 – A fresh installation of VS Code (on macOS)

  1. To make things easier later, we are going to install some extensions, so click on theExtensions icon, which is the fifth icon from the top on the left in the screenshot. A sidebar should open, where you will seeSearch Extensions in Marketplace at the top. Enter an extension name here and click onInstall to install it. Let’s start by installing theDocker extension:
Figure 1.2 – Installing the Docker extension in VS Code

Figure 1.2 – Installing the Docker extension in VS Code

  1. Install thefollowing extensions:
    • Docker (by Microsoft)
    • ESLint (by Microsoft)
    • Prettier – Code formatter (by Prettier)
    • MongoDB for VS Code (by MongoDB)

    Support for JavaScript and Node.js already comes built-in withVS Code.

  2. Create a folder for the projects made in this book (for example, you can call itFull-Stack-React-Projects). Inside this folder, create a new foldercalledch1.
  3. Go to theFiles tab (first icon from top) andclick theOpen Folder button to open the emptych1 folder.
  4. If you get a dialog askingDo you trust the authors of the files in this folder?, checkTrust the authors of all files in the parent folder ‘Full-Stack-React-Projects’ and then click on theYes, I trust theauthors button.
Figure 1.3 – Allowing VS Code to execute files in our project folder

Figure 1.3 – Allowing VS Code to execute files in our project folder

Tip

You can safely ignore this warning in your own projects, as you can be sure that those do not contain malicious code. When opening folders from untrusted sources, you can pressNo, I don’t trust the authors, and still browse the code. However, when doing so, some features of VS Code willbe disabled.

We have now successfully set up VS Code and are ready to start setting up our project! If you have cloned the folder from the GitHub code examples provided, a notification telling you that a Git repository was found will also pop up. You can simply close this one, as we only want to open thech1 folder.

Now that VS Code is ready, let’s continue by setting up a new projectwith Vite.

Setting up a project with Vite

For this book, we are going to useVite to set up our project, as it is the most popular and liked according toThe State of JS 2022 survey (https://2022.stateofjs.com/). Vite also makes it easy to set up a modern frontend project, while still making it possible to extend the configuration later if needed. Follow these steps to set upyourprojectwith Vite:

  1. In the VS Code menu bar, go toTerminal |New Terminal to open anew Terminal.
  2. Inside the Terminal, run thefollowing command:
    $ npm create vite@5.0.0 .

    Make sure there is a period at the end of the command to create the project in the current folder instead of creating anew folder.

Note

To keep the instructions in this book working even when new versions are released, we pin all packages to a fixed version. Please follow the instructions with the given versions. After finishing this book, when starting new projects on your own, you should always try using the latest versions but keep in mind that changes might be needed to get them working. Consult the documentation of the respective packages and follow the migration path from the book version to thelatest version.

  1. When asked ifcreate-vite should be installed, simply typey and press theReturn/Enter keyto proceed.
  2. When asked about the framework, use the arrow keys to selectReact and pressReturn. If you are being asked for a project name, pressCtrl +C to cancel, then run the command again, making sure there is a period at the end to select thecurrent folder.
  3. When asked about the variant,selectJavaScript.
  4. Now, our project is set up and we can runnpm install to installthe dependencies.
  5. Afterward, runnpm run dev to start the dev server, as shown in thefollowing screenshot:
Figure 1.4 – The Terminal after setting up a project with Vite and before starting the dev server

Figure 1.4 – The Terminal after setting up a project with Vite and before starting the dev server

Note

For simplicity in setting up, we just usednpm directly. If you preferyarn orpnpm, you can instead runyarn create vite orpnpm createvite, respectively.

  1. In theTerminal, you will see a URL telling you where your app is running. You can either holdCtrl (Cmd on macOS) and click on the link to open it in your browser, or manually enter the URL ina browser.
  2. To test whether your app is interactive, click the button with thetextcount is 0, and it should increase the count every time itis pressed.
Figure 1.5 – Our first React app running with Vite

Figure 1.5 – Our first React app running with Vite

Alternatives to Vite

Alternatives toVite are bundlers, such as webpack, Rollup, and Parcel. These are highly configurable but often do not offer a great experience for dev servers. They first must bundle all our code together before serving it to the browser. Instead, Vite natively supportstheECMAScript module (ESM) standard. Furthermore, Vite requires very little configuration to get started. A downside of Vite is that it can be hard to configure certain more complex scenarios with it. An upcoming bundler that is promising is Turbopack; however, it is still very new at the time of writing. For full-stack development with server-side rendering, we will later get to know Next.js, which is a React framework that also provides a dev server out ofthe box.

Now that our boilerplate project is up and running, let’s spend some time setting up tools that will enforce best practices and a consistentcode style.

Setting up ESLint and Prettier to enforce best practices and code style

Now that our React app is set up, we are going to set upESLint to enforce coding best practices with JavaScript and React. We are also going to set upPrettier to enforce acode style and automatically formatour code.

Installing the necessary dependencies

First, we are going to install all thenecessary dependencies:

  1. In the Terminal, click on theSplit Terminal icon at the top right of theTerminal pane to create a newTerminal pane. This will keep our app running while we runother commands.
  2. Click on this newly opened pane to focus it. Then, enter the following command to install ESLint, Prettier, and therelevant plugins:
    $ npm install --save-dev prettier@3.1.0 \  eslint@8.54.0 \  eslint-plugin-react@7.33.2 \  eslint-config-prettier@9.0.0 \  eslint-plugin-jsx-a11y@6.8.0

    The packages installed arethe following:

    • prettier: Formats our code automatically according to a definedcode style
    • eslint: Analyzes our code and enforcesbest practices
    • eslint-config-react: Enables rules in ESLint relevant toReact projects
    • eslint-config-prettier: Disables rules relating to code style in ESLint so that Prettier can handlethem instead
    • eslint-plugin-jsx-a11y: Allows ESLint to check for accessibility (a11y) issues in ourJSX code

Note

The--save-dev flag innpm saves those dependencies asdev dependencies, which means that they will only be installed for development. They will not be installed and included in a deployed app. This is important in order to keep the size of our containers as small aspossible later.

After the dependencies are installed, we need to configure Prettier and ESLint. We will start withconfiguring Prettier.

Configuring Prettier

Prettier willformat the code for us and replace the default code formatter for JavaScript in VS Code. It will allow us to spend more time writing code, automatically formatting it for us properly when we save the file. Follow these steps toconfigure Prettier:

  1. Right-click below the files list in the left sidebar of VS Code (if it is not opened, click theFiles icon) and pressNew file... to create a new file. Call it.prettierrc.json (do not forget the period at the beginning of thefile name!).
  2. The newly created file should open automatically, so we can start writing the following configuration into it. We first create a new object and set thetrailingComma option toall to make sure objects and arrays that span over multiple lines always have a comma at the end, even for the last element. This reduces the number of touched lines when committing a changevia Git:
    {  "trailingComma": "all",
  3. Then, we set thetabWidth option to2 spaces:
      "tabWidth": 2,
  4. Set theprintWidth to80 characters per line to avoid long lines inour code:
      "printWidth": 80,
  5. Set thesemi option tofalse to avoid semicolons wherenot necessary:
      "semi": false,
  6. Finally, we enforce the use of single quotes instead ofdouble quotes:
      "jsxSingleQuote": true,  "singleQuote": true}

Note

These settings for Prettier are just an example of a coding style convention. Of course, you are free to adjust these to your own preferences. There are many more options, all of which can be found in thePrettierdocs (https://prettier.io/docs/en/options.html).

Configuring the Prettier extension

Now that wehave a configuration file for Prettier, we need to make sure the VS Code extension is properly configured to format the codefor us:

  1. Open the VS Code settings by going toFile |Preferences... |Settings on Windows/Linux, orCode |Settings... |Settingson macOS.
  2. In the newly opened settings editor, click on theWorkspace tab. This ensures that we save all our settings in a.vscode/settings.json file in our project folder. When other developers open our project, they will automatically be using those settingsas well.
  3. Search foreditor format on save and check the checkbox to enable formatting codeon save.
  4. Search foreditor default formatter and selectPrettier - Code formatter fromthe list.
  5. To verify that Prettier works, open the.prettierrc.json file, add some extra spaces to the beginning of a line, and save the file. You should notice that Prettier reformatted the code to adhere to the defined code style. It will reduce the number of spaces for indentationto two.

Now that Prettier is set up properly, we do not need to worry about formatting our code manually anymore. Feel free to just type in code as you go and save the file to get it formattedforyou!

Creating a Prettier ignore file

To improveperformance and avoid running Prettier on files that should not be automatically formatted, we can ignore certain files and folders by creating a Prettier ignore file. Followthese steps:

  1. Create a new file called.prettierignore in the root of our project, similar to how we created the.prettierrc.json file.
  2. Add the following contents to it to ignore the transpiledsource code:
    dist/

    Thenode_modules/ folder is automatically ignoredby Prettier.

Now that we have successfully set up Prettier, we are going to configure ESLint to enforce codingbest practices.

Configuring ESLint

While Prettier focuses on the style and formatting of our code, ESLint focuses on the actual code, avoiding common mistakes or unnecessary code. Let’s configureit now:

  1. Delete the automatically created.eslintrc.cjs file.
  2. Create a new.eslintrc.json file and start writing the following configuration into it. First, we setroot totrue to make sure ESLint does not look at parent folders formore configuration:
    {  "root": true,
  3. Define anenv object, in which we set the browser environment totrue so that ESLint understands browser-specific globals such asdocumentandwindow:
      "env": {    "browser": true  },
  4. Define aparserOptions object, where we specify that we are using the latest ECMAScript versionand ESM:
      "parserOptions": {    "ecmaVersion": "latest",    "sourceType": "module"  },
  5. Define anextends array to extend from recommended configurations. Specifically, we extend from ESLint’s recommended rules and the recommended rules for the pluginswe installed:
      "extends": [    "eslint:recommended",    "plugin:react/recommended",    "plugin:react/jsx-runtime",    "plugin:jsx-a11y/recommended",
  6. As the last element of the array, we useprettier to disable all code style-related rules in ESLint and let Prettierhandle it:
        "prettier"  ],
  7. Now, we definesettings for the plugins. First, we tell thereact plugin to detect our installed Reactversion automatically:
      "settings": {    "react": {      "version": "detect"    }  },
  8. Finally, outsideof thesettings section, we define anoverrides array, in which we specify that ESLint should only lint.js and.jsx files:
      "overrides": [    {      "files": ["*.js", "*.jsx"]    }  ]}
  9. Create a new.eslintignore file, with thefollowing contents:
    dist/vite.config.js

    Thenode_modules/ folder is automatically ignoredby ESLint.

  10. Save the files and runnpx eslint src in the Terminal to run the linter. You will see that there are some errors already due to our configured rules not matching the source provided by the default projectin Vite:
Figure 1.6 – When running ESLint for the first time, we get some errors about rule violations

Figure 1.6 – When running ESLint for the first time, we get some errors about rule violations

  1. Fortunately, all these issues are automatically fixable by ESLint. Runnpx eslint src --fix to fix the issues automatically. Now, when you runnpx eslint src again, you will not get any output. This means that there were nolinter errors!

Tip

Thenpx command allows us to execute commands provided bynpm packages, in a similar context as running them inpackage.json scripts would do. It can also run remote packages without installing them permanently. If the package is not installed yet, it will ask you whether it shoulddo this.

Adding a new script to run our linter

In the previous section, we have been calling the linter by runningnpx eslint src manually. We are now going to add alint scripttopackage.json:

  1. In the Terminal, run the following command to define alint script in thepackage.json file:
    $ npm pkg set scripts.lint="eslint src"
  2. Now, runnpm run lint in the Terminal. This should executeeslint src successfully, just likenpx eslintsrc did:
Figure 1.7 – The linter running successfully, with no errors

Figure 1.7 – The linter running successfully, with no errors

After setting up ESLint and Prettier, we still need to make sure that they run before we commit code. Let’s set up Husky to make sure we commit propercode now.

Setting up Husky to make sure we commit proper code

After setting up Prettier and ESLint, we will now get our code automatically formatted on save by Prettier and see errors from ESLint in VS Code when we make mistakes or ignore best practices. However, we might miss some of these errors and accidentally commit code that is invalid. To avoid this, we can set upHusky andlint-staged, which run before we commit our code to Git and ensure that Prettier and ESLint are executed successfully on the source code before itis committed.

Important

If you cloned the full repository for the book, Husky may not find the.git directory when runningnpm install. In that case, just rungit init in the root of the correspondingchapter folder.

Let’s set Husky and lint-stagedup by followingthese steps:

  1. Run the following command to install Husky and lint-staged asdev dependencies:
    $ npm install --save-dev husky@8.0.3 \  lint-staged@15.1.0
  2. Open thepackage.json file and add the followinglint-staged configuration to it in a new object afterdevDependencies, then save the file. This will run Prettier and ESlint on all committed.js and.jsx files and attempt to automatically fix code style and linter errors,if possible:
      "lint-staged": {    "**/*.{js,jsx}": [      "npx prettier --write",      "npx eslint --fix"    ]  }
  3. Initialize a Git repository in thech1 folder and make an initial commit with just thepackage.json file, as lint-staged does not get executed on theinitial commit:
    $ git init$ git add package.json$ git commit -m "chore: initial commit"
  4. Add thehusky install script to aprepare script inpackage.json, so that Husky getsinstalled automatically when the project is cloned andnpm installis executed:
    $ npm pkg set scripts.prepare="husky install"
  5. Since we do not need to runnpm install again right now, we need to manually run theprepare scriptthis time:
    $ npm run prepare
  6. Add apre-commit hook for lint-staged, so that ESLint and Prettier run every time we dogit commit:
    $ npx husky add .husky/pre-commit "npx lint-staged"
  7. Now, add all files to Git and attempt to makea commit:
    $ git add .$ git commit -m "chore: basic project setup"

If everything worked successfully, you should seehusky runninglint-staged, which, in turn, runsprettier andeslint, after you rungit commit. If you are getting aconfiguration error, ensure that all files are saved properly andthen rungitcommit again.

Figure 1.8 – Husky and lint-staged successfully enforcing code style and best practices before we commit

Figure 1.8 – Husky and lint-staged successfully enforcing code style and best practices before we commit

Setting up commitlint to enforce a standard for our commit messages

In addition to linting our code, we can also lint our commit messages. You may have noticed that we were prefixing our commit messages with a type already (thechore type). Types make it easier to follow what was changed in a commit. To enforce the use of types, we can set upcommitlint. Follow these steps to setit up:

  1. Install commitlint and a conventional configfor commitlint:
    $ npm install --save-dev @commitlint/cli@18.4.3 \  @commitlint/config-conventional@18.4.3
  2. Create a new.commitlintrc.json file in the root of our project and add thefollowing contents:
    {  "extends": ["@commitlint/config-conventional"]}
  3. Add acommit-msg hookto Husky:
    $ npx husky add .husky/commit-msg \  'npx commitlint --edit ${1}'
  4. Now, if we try adding our changed files and committing without a type or a wrong type, we will get an error from commitlint and will not be able to make such a commit. If we add the correct type, itwill succeed:
    $ git add .$ git commit -m "no type"$ git commit -m "wrong: type"$ git commit -m "chore: configure commitlint"

The following figure showsHusky in action. If we write an incorrect commit message, it will reject it and not let us commit the code. Only if we enter a properly formatted commit message will the commitgo through:

Figure 1.9 – commitlint working successfully and preventing commits without a type and with wrong types

Figure 1.9 – commitlint working successfully and preventing commits without a type and with wrong types

Commit messages in thecommitlint conventional config (https://www.conventionalcommits.org/) are structured in a way where a type must be listed first, then an optional scope follows, and then the description follows, suchastype(scope): description. Possible types areas follows:

  • fix: Forbug fixes
  • feat: Fornew features
  • refactor: For restructuring the code without adding features orfixing bugs
  • build: For changes in the build systemor dependencies
  • ci: For changes in theCI/CD configuration
  • docs: For changes in thedocumentation only
  • perf: Forperformance optimizations
  • style: For fixingcode formatting
  • test: Foradding oradjusting tests

The scope is optional and best used in a monorepo to specify that changes were made to a certain app or librarywithin it.

Summary

Now that we have successfully set up our project and started enforcing standards, we can continue working on our project without worrying about a consistent code style, consistent commit messages, or making small mistakes. ESLint, Prettier, Husky, and commitlint have gotus covered.

In the next chapter,Chapter 2,Getting to Know Node.js and MongoDB, we are going to learn how to write and run small Node.js scripts and how MongoDB, a databasesystem, works.

Left arrow icon

Page1 of 7

Right arrow icon
Download code iconDownload Code

Key benefits

  • Understand how the different aspects of a MERN application come together through a series of practical projects
  • Set up frontend and backend projects that can be integrated and maintained together
  • Enhance your proficiency in building scalable and sustainable React projects
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Understanding full-stack development is vital as companies aim to bridge the gap between frontend and backend development. Recent trends show deeper integration between the two, opening numerous possibilities for building real-world web applications, through server-side technologies like Node.js, Express, and MongoDB. Written by the author of Learning Redux and Learn React Hooks, and CEO of TouchLay, Modern Full-Stack React Projects will guide you through the entire process of advancing from a frontend developer to a full-stack developer. Starting with how to set up robust projects that can be maintained for a long time, you’ll then progress toward developing a backend system and integrating it with the frontend. Throughout the book, you’ll learn how to build, test, and deploy a blog application and a chat application. You’ll also explore MongoDB, Express, React, Node.js (MERN) stack, best practices for frontend and backend development, different full-stack architectures, unit and end-to-end testing, and deployment of full-stack web applications. Once you get to grips with the essential concepts, you’ll progress to learn how to use Next.js, an enterprise-grade full-stack web framework for React. By the end, you’ll be well-versed in the MERN stack and all set to create performant and scalable full-stack web applications.

Who is this book for?

This book is for frontend developers, JavaScript engineers, and React developers who possess a solid understanding of JavaScript and React concepts. Specifically designed for those with limited experience in the development, creation, integration, and deployment of backend and full-stack systems, this book will equip you with the necessary skills to create high-quality web applications.

What you will learn

  • Implement a backend using Express and MongoDB, and unit-test it with Jest
  • Deploy full-stack web apps using Docker, set up CI/CD and end-to-end tests using Playwright
  • Add authentication using JSON Web Tokens (JWT)
  • Create a GraphQL backend and integrate it with a frontend using Apollo Client
  • Build a chat app based on event-driven architecture using Socket.IO
  • Facilitate Search Engine Optimization (SEO) and implement server-side rendering
  • Use Next.js, an enterprise-ready full-stack framework, with React Server Components and Server Actions

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date :Jun 07, 2024
Length:506 pages
Edition :1st
Language :English
ISBN-13 :9781837632756
Languages :
Tools :

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want
Product feature iconAI Assistant (beta) to help accelerate your learning
OR

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Product Details

Publication date :Jun 07, 2024
Length:506 pages
Edition :1st
Language :English
ISBN-13 :9781837632756
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99billed monthly
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconSimple pricing, no contract
€189.99billed annually
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick iconExclusive print discounts
€264.99billed in 18 months
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick iconExclusive print discounts

Frequently bought together


React and React Native
React and React Native
Read more
Apr 2024518 pages
Full star icon4.3 (10)
eBook
eBook
€23.99€26.99
€32.99
Mastering Node.js Web Development
Mastering Node.js Web Development
Read more
Jun 2024778 pages
Full star icon4.9 (8)
eBook
eBook
€26.98€29.99
€37.99
Modern Full-Stack React Projects
Modern Full-Stack React Projects
Read more
Jun 2024506 pages
Full star icon4.8 (9)
eBook
eBook
€23.99€26.99
€33.99
Stars icon
Total104.97
React and React Native
€32.99
Mastering Node.js Web Development
€37.99
Modern Full-Stack React Projects
€33.99
Total104.97Stars icon

Table of Contents

27 Chapters
Part 1:Getting Started with Full-Stack DevelopmentChevron down iconChevron up icon
Part 1:Getting Started with Full-Stack Development
Chapter 1: Preparing for Full-Stack DevelopmentChevron down iconChevron up icon
Chapter 1: Preparing for Full-Stack Development
Technical requirements
Motivation to become a full-stack developer
What is new in this release of Full-Stack React Projects?
Getting the most out of this book
Setting up the development environment
Summary
Chapter 2: Getting to Know Node.js and MongoDBChevron down iconChevron up icon
Chapter 2: Getting to Know Node.js and MongoDB
Technical requirements
Writing and running scripts with Node.js
Introducing Docker, a platform for containers
Introducing MongoDB, a document database
Accessing the MongoDB database via Node.js
Summary
Part 2:Building and Deploying Our First Full-Stack Application with a REST APIChevron down iconChevron up icon
Part 2:Building and Deploying Our First Full-Stack Application with a REST API
Chapter 3: Implementing a Backend Using Express, Mongoose ODM, and JestChevron down iconChevron up icon
Chapter 3: Implementing a Backend Using Express, Mongoose ODM, and Jest
Technical requirements
Designing a backend service
Creating database schemas using Mongoose
Developing and testing service functions
Providing a REST API using Express
Summary
Chapter 4: Integrating a Frontend Using React and TanStack QueryChevron down iconChevron up icon
Chapter 4: Integrating a Frontend Using React and TanStack Query
Technical requirements
Principles of React
Setting up a full-stack React project
Creating the user interface for our application
Integrating the backend service using TanStack Query
Summary
Chapter 5: Deploying the Application with Docker and CI/CDChevron down iconChevron up icon
Chapter 5: Deploying the Application with Docker and CI/CD
Technical requirements
Creating Docker images
Deploying our full-stack application to the cloud
Configuring CI to automate testing
Configuring CD to automate the deployment
Summary
Part 3:Practicing Development of Full-Stack Web ApplicationsChevron down iconChevron up icon
Part 3:Practicing Development of Full-Stack Web Applications
Chapter 6: Adding Authentication with JWTChevron down iconChevron up icon
Chapter 6: Adding Authentication with JWT
Technical requirements
What is JWT?
Implementing login, signup, and authenticated routes in the backend using JWTs
Integrating login and signup in the frontend using React Router and JWT
Advanced token handling
Summary
Chapter 7: Improving the Load Time Using Server-Side RenderingChevron down iconChevron up icon
Chapter 7: Improving the Load Time Using Server-Side Rendering
Technical requirements
Benchmarking the load time of our application
Rendering React components on the server
Server-side data fetching
Advanced server-side rendering
Summary
Chapter 8: Making Sure Customers Find You with Search Engine OptimizationChevron down iconChevron up icon
Chapter 8: Making Sure Customers Find You with Search Engine Optimization
Technical requirements
Optimizing an application for search engines
Improving social media embeds
Summary
Chapter 9: Implementing End-to-End Tests Using PlaywrightChevron down iconChevron up icon
Chapter 9: Implementing End-to-End Tests Using Playwright
Technical requirements
Setting up Playwright for end-to-end testing
Writing and running end-to-end tests
Reusable test setups using fixtures
Viewing test reports and running in CI
Summary
Chapter 10: Aggregating and Visualizing Statistics Using MongoDB and VictoryChevron down iconChevron up icon
Chapter 10: Aggregating and Visualizing Statistics Using MongoDB and Victory
Technical requirements
Collecting and simulating events
Aggregating data with MongoDB
Implementing data aggregation in the backend
Integrating and visualizing data on the frontend using Victory
Summary
Chapter 11: Building a Backend with a GraphQL APIChevron down iconChevron up icon
Chapter 11: Building a Backend with a GraphQL API
Technical requirements
What is GraphQL?
Implementing a GraphQL API in a backend
Implementing GraphQL authentication and mutations
Overview of advanced GraphQL concepts
Summary
Chapter 12: Interfacing with GraphQL on the Frontend Using Apollo ClientChevron down iconChevron up icon
Chapter 12: Interfacing with GraphQL on the Frontend Using Apollo Client
Technical requirements
Setting up Apollo Client and making our first query
Using variables in GraphQL queries
Using mutations on the frontend
Summary
Part 4:Exploring an Event-Based Full-Stack ArchitectureChevron down iconChevron up icon
Part 4:Exploring an Event-Based Full-Stack Architecture
Chapter 13: Building an Event-Based Backend Using Express and Socket.IOChevron down iconChevron up icon
Chapter 13: Building an Event-Based Backend Using Express and Socket.IO
Technical requirements
What are event-based applications?
Setting up Socket.IO
Creating a backend for a chat app using Socket.IO
Adding authentication by integrating JWT with Socket.IO
Summary
Chapter 14: Creating a Frontend to Consume and Send EventsChevron down iconChevron up icon
Chapter 14: Creating a Frontend to Consume and Send Events
Technical requirements
Integrating the Socket.IO client with React
Implementing chat functionality
Implementing chat commands with acknowledgments
Summary
Chapter 15: Adding Persistence to Socket.IO Using MongoDBChevron down iconChevron up icon
Chapter 15: Adding Persistence to Socket.IO Using MongoDB
Technical requirements
Storing and replaying messages using MongoDB
Refactoring the app to be more extensible
Implementing commands to join and switch rooms
Summary
Part 5:Advancing to Enterprise-Ready Full-Stack ApplicationsChevron down iconChevron up icon
Part 5:Advancing to Enterprise-Ready Full-Stack Applications
Chapter 16: Getting Started with Next.jsChevron down iconChevron up icon
Chapter 16: Getting Started with Next.js
Technical requirements
What is Next.js?
Setting up Next.js
Introducing the App Router
Creating static components and pages
Summary
Chapter 17: Introducing React Server ComponentsChevron down iconChevron up icon
Chapter 17: Introducing React Server Components
Technical requirements
What are RSCs?
Adding a data layer to our Next.js app
Using RSCs to fetch data from the database
Using Server Actions to sign up, log in, and create new posts
Summary
Chapter 18: Advanced Next.js Concepts and OptimizationsChevron down iconChevron up icon
Chapter 18: Advanced Next.js Concepts and Optimizations
Technical requirements
Defining API routes in Next.js
Caching in Next.js
SEO with Next.js
Optimized image and font loading in Next.js
Summary
Chapter 19: Deploying a Next.js AppChevron down iconChevron up icon
Chapter 19: Deploying a Next.js App
Technical requirements
Deploying a Next.js app with Vercel
Creating a custom deployment setup for Next.js apps
Summary
Chapter 20: Diving Deeper into Full-Stack DevelopmentChevron down iconChevron up icon
Chapter 20: Diving Deeper into Full-Stack Development
Overview of other full-stack frameworks
Overview of UI libraries
Overview of advanced state management solutions
Pointers on maintaining large-scale projects
Summary
IndexChevron down iconChevron up icon
Index
Why subscribe?
Other Books You May EnjoyChevron down iconChevron up icon
Other Books You May Enjoy
Packt is searching for authors like you
Share Your Thoughts
Download a free PDF copy of this book

Recommendations for you

Left arrow icon
Full-Stack Flask and React
Full-Stack Flask and React
Read more
Oct 2023408 pages
Full star icon3.8 (5)
eBook
eBook
€20.99€23.99
€29.99
C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals
C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals
Read more
Nov 2024828 pages
Full star icon4.4 (5)
eBook
eBook
€26.98€29.99
€37.99
Real-World Web Development with .NET 9
Real-World Web Development with .NET 9
Read more
Dec 2024578 pages
Full star icon3.5 (4)
eBook
eBook
€26.98€29.99
€37.99
Django 5 By Example
Django 5 By Example
Read more
Apr 2024820 pages
Full star icon4.6 (40)
eBook
eBook
€26.98€29.99
€37.99
React and React Native
React and React Native
Read more
Apr 2024518 pages
Full star icon4.3 (10)
eBook
eBook
€23.99€26.99
€32.99
Scalable Application Development with NestJS
Scalable Application Development with NestJS
Read more
Jan 2025612 pages
Full star icon4.5 (6)
eBook
eBook
€20.99€23.99
€29.99
C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals
C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals
Read more
Nov 2023828 pages
Full star icon4.4 (74)
eBook
eBook
€31.99€35.99
€44.99
Responsive Web Design with HTML5 and CSS
Responsive Web Design with HTML5 and CSS
Read more
Sep 2022504 pages
Full star icon4.5 (57)
eBook
eBook
€23.99€26.99
€33.99
Modern Full-Stack React Projects
Modern Full-Stack React Projects
Read more
Jun 2024506 pages
Full star icon4.8 (9)
eBook
eBook
€23.99€26.99
€33.99
Learning Angular
Learning Angular
Read more
Jan 2025494 pages
Full star icon4 (6)
eBook
eBook
€23.99€26.99
€33.99
Right arrow icon

Customer reviews

Top Reviews
Rating distribution
Full star iconFull star iconFull star iconFull star iconHalf star icon4.8
(9 Ratings)
5 star88.9%
4 star0%
3 star11.1%
2 star0%
1 star0%
Filter icon Filter
Top Reviews

Filter reviews by




SebastianJun 16, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
I come from backend development with only a bit of experience in the frontend world, I've found this book and it was really worth it. It explains everything very in depth, you can easily follow with little experience in React but it also doesnt get boring if you already understand a concept well. There is very nice graphics to explain things and its good to follow along. Would recommend for anyone trying to get more in depth into web development and wanting to understand the big picture rather than just pure javascript or such.
Amazon Verified reviewAmazon
M.Jul 19, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
I recommend this book to any React developer as a user's manual, especially to all junior devs. This book takes all the confusing, random aspects of full-stack React development and creates harmony and clarity from the chaos:REST APIsMERN StackReact Router v6DockerAuthenticationServer-Side RenderingSEOTestingData VisualizationGraphQLSocket.IONext.jsServer ComponentsAll these concepts and more are covered in detail, starting with npm create vite and guiding the reader iteratively through thousands of examples and code samples until they have created their own full-stack production React application as the finished product.
Amazon Verified reviewAmazon
Salman FarsiJun 26, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
The book focuses on building and maintaining modern web apps using MongoDB, Express, React, and Node.js. It covers setting up development environments, working with Node.js and MongoDB, implementing backend services, integrating frontends with React, and deploying applications using Docker and CI/CD practices. Discusses advanced concepts like authentication with JWT, server-side rendering, and optimizing applications for search engines.Aimed at developers with React experience who whish to learn full-stack development, including backend integration and app deployment.In short this is great resource for beginners and advance React developers, to get full-stack development experience.
Amazon Verified reviewAmazon
FuadJul 06, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
One of the book's standout features is its emphasis on practical application. Each concept is illustrated with clear, real-world examples that progressively build in complexity. Whether you're learning how to model data effectively using MongoDB's flexible schema or integrating MongoDB with popular web frameworks like Node.js, Express, and Angular, the book ensures you not only understand the theory but also gain hands-on experience through well-crafted exercises and projects.
Amazon Verified reviewAmazon
teoJul 28, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
If you're a React developer and want to expand your knowledge this is book is for you. It provides great examples for an end to end project from development to production. High recommended.
Amazon Verified reviewAmazon
  • Arrow left icon Previous
  • 1
  • 2
  • Arrow right icon Next

People who bought this also bought

Left arrow icon
C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals
C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals
Read more
Nov 2022818 pages
Full star icon4.1 (54)
eBook
eBook
€26.98€29.99
€37.99
C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals
C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals
Read more
Nov 2023828 pages
Full star icon4.4 (74)
eBook
eBook
€31.99€35.99
€44.99
Responsive Web Design with HTML5 and CSS
Responsive Web Design with HTML5 and CSS
Read more
Sep 2022504 pages
Full star icon4.5 (57)
eBook
eBook
€23.99€26.99
€33.99
React and React Native
React and React Native
Read more
May 2022606 pages
Full star icon4.6 (17)
eBook
eBook
€26.98€29.99
€37.99
Building Python Microservices with FastAPI
Building Python Microservices with FastAPI
Read more
Aug 2022420 pages
Full star icon3.9 (9)
eBook
eBook
€25.99€28.99
€35.99
Right arrow icon

About the author

Profile icon Bugl
Bugl
LinkedIn iconGithub icon
Daniel Bugl is a CEO, Software Architect and Full Stack Developer for his company TouchLay, developing a platform for interactive presentations. He also consults large multinational enterprises on the development and integration of React frontends with various backend systems, including the integration of legacy systems, and helps out with the setup and development of such projects. He has a bachelor's degree in business informatics and a master's degree in data science.
Read more
See other products by Bugl
Getfree access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook?Chevron down iconChevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website?Chevron down iconChevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook?Chevron down iconChevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support?Chevron down iconChevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks?Chevron down iconChevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook?Chevron down iconChevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.


[8]ページ先頭

©2009-2025 Movatter.jp