Skip to content

penx/remix-google-cloud-functions

Repository files navigation

remix-google-cloud-functions

Remix Adapter for Google Cloud Functions and Firebase Functions.

Usage

Firebase

See the functions directory in the example project.

npm i remix-google-cloud-functions @remix-run/node @google-cloud/functions-framework firebase-functions

Create a Firebase function as follows - build should point to the output from remix build or remix dev.

const { onRequest } = require("firebase-functions/v2/https");
const { createRequestHandler } = require("remix-google-cloud-functions");

const remix = onRequest(
  createRequestHandler({
    build: require("../build"),
  })
);
module.exports = { remix };

Google Cloud Functions

See the gcf in the example project.

npm i remix-google-cloud-functions @remix-run/node @google-cloud/functions-framework

gcf/index.js

const { createRequestHandler } = require("remix-google-cloud-functions");

exports.remix = createRequestHandler({
  build: require("../build"),
});

To run locally, add a script such as:

package.json

    "start": "functions-framework --source gcf --target=remix --port 5003",

Note this does not serve the static assets.

Further details can be found on the official guide.

About Remix

Remix is a web framework that helps you build better websites with React.

To get started, open a new shell and run:

npx create-remix@latest

Then follow the prompts you see in your terminal.

For more information about Remix, visit remix.run!