Book Image

Full-Stack React Projects

By : Shama Hoque
Book Image

Full-Stack React Projects

By: Shama Hoque

Overview of this book

The benefits of using a full JavaScript stack for web development are undeniable, especially when robust and widely adopted technologies such as React, Node, and Express and are available. Combining the power of React with industry-tested, server-side technologies, such as Node, Express, and MongoDB, creates a diverse array of possibilities when developing real-world web applications. This book guides you through preparing the development environment for MERN stack-based web development, to creating a basic skeleton application and extending it to build four different web applications. These applications include a social media, an online marketplace, a media streaming, and a web-based game application with virtual reality features. While learning to set up the stack and developing a diverse range of applications with this book, you will grasp the inner workings of the MERN stack, extend its capabilities for complex features, and gain actionable knowledge of how to prepare MERN-based applications to meet the growing demands of real-world web applications.
Table of Contents (19 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Preface

This book explores the potential of developing full-stack JavaScript web applications by combining the power of React with industry tested server-side technologies, such as Node, Express, and MongoDB. The JavaScript landscape has been growing rapidly for some time now. With an abundance of options and resources available on this subject matter, it is easy to get lost when you need to choose from these frequently changing parts, learn about them, and make them work together to build your own web applications. In an attempt to address this pain point, the book adopts a practical approach to help you set up and build a diverse range of working applications using this popular JavaScript stack.

Who this book is for

This book is aimed at JavaScript developers who may have some experience with React, but no previous experience with full-stack development involving Node, Express, and MongoDB, and who want practical guidelines to start building different types of web applications with this stack.

What this book covers

Chapter 1, Unleashing React Applications with MERN, introduces the MERN stack technologies and the applications developed in this book. We will discuss the context and relevance of developing web applications with React, Node, Express, and MongoDB.

Chapter 2, Preparing the Development Environment, helps set up the MERN stack technologies for development. We will explore essential development tools, install Node, MongoDB, Express, React, and other required libraries, and then run code to check the setup.

Chapter 3, Building a Backend with MongoDB, Express, and Node, implements the backend of a skeleton MERN application. We will build a standalone server-side application with MongoDB, Express, and Node, which stores user details and has APIs for user authentication and CRUD operations.

Chapter 4, Adding a React Frontend to Complete MERN, completes the MERN skeleton application by integrating a React frontend. We will implement a working frontend with React views for interacting with the user CRUD and auth APIs on the server.

Chapter 5, Starting with a Simple Social Media Application, builds a social media application by extending the skeleton application. We will explore the capabilities of the MERN stack by implementing social media features, such as post sharing, liking, and commenting; following friends; and an aggregated newsfeed.

Chapter 6, Exercising New MERN Skills with an Online Marketplace, implements basic features in an online marketplace application. We will implement buying- and selling- related features with support for seller accounts, product listings, and product search by category.

Chapter 7, Extending the Marketplace for Orders and Payments, builds the marketplace application further with a shopping cart, order management, and payments processing. We will add a shopping cart feature and allow users to place orders with the items in their carts. We will also integrate Stripe to collect and process payments.

Chapter 8, Building a Media Streaming Application, implements media uploading and streaming using MongoDB GridFS. We will start building a basic media streaming application, allowing registered users to upload video files that will be stored on MongoDB and streamed back so that viewers can play each video in a simple React media player.

Chapter 9, Customizing the Media Player and Improving SEO, upgrades the media viewing capabilities with a custom media player and autoplay media list. We will implement customized controls on the default React media player, add a playlist that can be autoplayed, and improve SEO for the media details by adding selective server-side rendering with data for just the media detail view.

Chapter 10,Developing a Web-Based VR Game, uses React 360 to develop a 3D virtual reality infused game for the web. We will explore the 3D and VR capabilities of React 360 and build a simple web-based VR game.

Chapter 11,Making the VR Game Dynamic using MERN, builds a dynamic VR game application by extending the MERN skeleton application and integrating React 360. We will implement a game data model that allows users to create their own VR games and incorporate the dynamic game data with the game developed using React 360.

Chapter 12,Following Best Practices and Developing MERN Further, reflects on the lessons learned in previous chapters and suggests improvements for further MERN-based application development. We will expand on some of the best practices already applied, such as modularity in the app structure, other practices that should be applied, such as writing test code, and possible improvements, such as optimizing bundle size.

To get the most out of this book

The content in this book is organized with the assumption that you have familiarity with basic web-based technologies, a working knowledge of programming constructs in JavaScript, and a general idea of how React applications work. As you go through the book, you will uncover how these concepts come together when building full-fledged web applications with React, Node, Express, and MongoDB.

In order to maximize your learning experience while reading through the chapters, it is recommended that you run the associated version of the application code in parallel, using the relevant instructions provided in each chapter.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Full-Stack-React-Projects. If there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system."

A block of code is set as follows:

import path from 'path'
const CURRENT_WORKING_DIR = process.cwd()
app.use('/dist', express.static(path.join(CURRENT_WORKING_DIR, 'dist')))

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

{
    "presets": [
      "env",
      "stage-2",
"react"
    ],
"plugins": [
      "react-hot-loader/babel"
    ]
}

Any command-line input or output is written as follows:

npm install babel-preset-react --save-dev

Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select System info from the Administration panel."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.