Skip to content
No description, website, or topics provided.
JavaScript
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
components
pages
utils
.babelrc
.gitignore
README.md
demo.js
fab-server.js
next.config.js
now-entry.js
now-run.js
now.json
package.json
server.js
yarn.lock

README.md

NextJS on FABs

This is a proof of concept getting Frontend Application Bundles (FABs, see more at https://fab.dev).

FABs are designed to compile any frontend project and deploy them anywhere that can run JS:

FAB diagram

It lives!

Cloudflare Workers

http://nextjs-fab-cloudflare-workers.bitg.io/

Cloudflare workers console screenshot

Amazon Lambda@Edge

https://nextjs.linc-demo.sh/

Now.sh

https://nextjs8-demo.glenmaddern.now.sh/

Heroku

https://fab-nextjs.herokuapp.com/

Docker on AWS EC2

https://nextjs8-demo.linc.sh/

Some background

NextJS is a tricky target for FABs, as it, like a lot of NodeJS server-side JS projects, assumes a fair bit about the environment it runs on. Since version 8, Next has offered two build targets: NodeJS & Serverless. The serverless build has stripped out a lot of the old assumptions and generates a single file per "route" for NextJS. Each of these files shares a lot with each other, and @fab/nextjs isn't very smart about things at the moment, but it's possible to create a FAB with all of these files inlined and generate a router from the filesystem.

Definitely a proof-of-concept at this stage, but look, it works, and for a while I didn't think it would be able to, so I'm calling that a win!

Some caveats

The Cloudflare Workers and Amazon Lambda@Edge deployers aren't fully open-sourced yet. They're in the process of being extracted from the Linc codebase.

An aside, FAB development is sponsored by (and makes possible) the Linc product, so if you like the idea of FABs, come and sign up! You can see this repo's recent builds on Linc here.

The Now.sh and Heroku deployments haven't been generalised—they're hard-coded into this repo's npm scripts. But they both use the fab.zip generated by npm run build:fab, rather than doing anything with the sourcecode.

You can’t perform that action at this time.