Giter VIP home page Giter VIP logo

nextfiressr's Introduction

SSR with Next.js and Firebase Hosting/Cloud Functions

Important!

This example uses firebase-tools as a devDependency which is run from the node_modules/.bin/ folder via yarn. Yarn will run scripts from either the package.json or binary scripts from node_modules/.bin/. npm run does not check the .bin folder for executables, so if you use npm you will either have to change the scripts to explicitly run the firebase binary from node_modules/.bin/ or install firebase-tools globally and remove it from the devDeps list.

Installation

yarn install

Login to Firebase CLI

This is used as a dev-dependency instead of a global install. I've found this to be a much nicer dev experience.

yarn fblogin

Next.js Development

Standard Next.js development with Hot-module Reloading etc

yarn dev

Local Testing

Unfortunately I have been unable to get any combination of

firebase serve --only functions,hosting

to work as expected. This issue is where solutions are being explored and they will be shared here and on the Next.js repo's similar issue when discovered.

In the meantime you'll just have to do a full deployment and test online. The new project structure of v2.0.0 and partial deployments reduces the deployment time significantly so this is not too bad. I'm continually looking into a solution to this.

Deploy to Firebase

You will need to connect the project to your Firebase project. Edit the name in .firebaserc or run firebase init and choose not to override any files.

Deploy Hosting resources and the rewrite Cloud Function

yarn deploy-app

Deploy functions not used for the SSR

Deploy all functions specified in the function group. Edit this script to add more function groups. - see Partial deploys docs for how to use function groups.

yarn deploy-funcs

Deploy everything to Firebase

yarn deploy-all

Clean dist Folder

yarn clean

nextfiressr's People

Contributors

webeli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.