O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Next.js Quick Start Guide

Book Description

Create, build and deploy universal JavaScript applications using Next.js

Key Features

  • Work with the entire tool-chain for developing universal Javascript applications with Next.js
  • A straightforward guide to implementing server-side rendering
  • Use Next.js to build SEO-friendly and super fast websites

Book Description

Next.js is a powerful addition to the ever-growing and dynamic JavaScript world. Built on top of React, Webpack, and Babel, it is a minimalistic framework for server-rendered universal JavaScript applications. This book will show you the best practices for building sites using Next. js, enabling you to build SEO-friendly and superfast websites.

This book will guide you from building a simple single page app to a scalable and reliable client-server infrastructure. You will explore code sharing between client and server, universal modules, and server-side rendering.

The book will take you through the core Next.js concepts that everyone is talking about – hot reloading, code splitting, routing, server rendering, transpilation, CSS isolation, and more. You will learn ways of implementing them in order to create your own universal JavaScript application. You will walk through the building and deployment stages of your applications with the JSON API,customizing the confguration, error handling,data fetching, deploying to production, and authentication.

What you will learn

  • Explore the benefts of server-side rendering with Next.js
  • Create and link JavaScript modules together by understanding code splitting and bundling
  • Create website pages and wire them together through website navigation
  • Extend your application with additional Webpack loaders and features, as well as custom Babel plugins and presets
  • Use GraphQL and Apollo frameworks with Next.js to fetch data and receive push notifcations
  • Design and implement core modules, such as logging and authentication, and then more complex solutions for access control and business rule management
  • Write tests and use online CI tools such as Travis, GitLab, and more
  • Build a Docker-based container for your app and deploy it to online services such as Heroku and Now.sh

Who this book is for

This book is for JavaScript developers who want to learn how to generate server-rendered applications.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Next.js Quick Start Guide
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  7. Introduction to Server-Side Rendering and Next.js
    1. What is a single-page app?
      1. Creating JS Modules, code sharing, code splitting, and bundling 
    2. Introduction to React 
    3. Why single-page apps suffer performance issues
    4. Server side rendering 
    5. How to do server-side rendering with React 
      1. React-based server-side rendering frameworks, why Next.js 
    6. Summary
  8. Next.js fundamentals
    1. Installation of Next.js
    2. Running Next.js in developer mode
    3. Creating your first Next.js page
    4. Running a Next.js production build
    5. Making Next.js routing
    6. Dynamic routing
    7. Making Next.js routing masks – SEO-friendly URLs
    8. Dynamic Component Loading (aka Lazy Components)
    9. Adding styles to an application – CSS in JS
    10. Adding media content – images, video, and audio
    11. Adding interactive graphs and charts
    12. Summary
  9. Next.js Configuration
    1. Special pages
    2. How to make custom configurations
    3. Configuring Webpack
    4. Configuring Babel
    5. Summary
  10. Next.js Data Flow
    1. Nuances of fetching data on the client and on the server
    2. Loading data from a remote server using vanilla Next.js
    3. Using Redux with Next.js
    4. Using GraphQL with Next.js to fetch data
    5. Using the Apollo framework with Next.js to fetch data
    6. Summary
  11. Application Life Cycle Handlers and Business Logic
    1. Authentication
    2. Access Control List, Roles, and Permissions
    3. Business Rules Engine
    4. Internationalization and Localization
    5. Error handling
    6. Caching
    7. Analytics
    8. Summary
  12. Continuous Integration
    1. What is automated deployment?
    2. Writing unit tests for Next.js apps
    3. Writing end-to-end tests for Next.js apps
    4. Setting up CI for Next.js: Travis, Gitlab, and so on
    5. Setting up cloud coverage statistics
    6. Commit hooks
    7. Summary 
  13. Containers
    1. What is a container for a Next.js app?
    2. Creating a Docker container for Next.js
    3. Deploying to Heroku
    4. Deploying to Now.sh
    5. Summary
  14. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think