now: realtime node.js deployments

bash
ā–² ~/my-proj $ 
0%

What's now?

šš« now allows you to take your JavaScript (Node.js) powered websites, applications and services to the cloud with ease, speed and reliability.

In practical terms, any directory that contains a package.json file can be transported to the cloud with one command: now.

Every time you deploy a project, šš« now gives you a unique URL to it (even before build processes are complete!). These URLs look like this: my-app-sknncqwaoc.now.sh.

When it's time to take your deployment to production, you simply pick an appropriate alias.

You can think of šš« now as a CDN for dynamic code (microservices and backends).

Get started

Installation

To get started using now, install it from npm:

$ npm install -g now

When the installation is finished, it'll ask for your email to identify you.
Click the email you receive, and you'll be automatically logged-in.

If you need to change your login or re-authenticate, run

$ now --login

Your first project

On a terminal, run:

$ mkdir /my-project
$ cd /my-project

It's important that your project has a package.json file.
Within it, you have to define a start script:

{
    "name": "my-project",
    "version": "0.0.1",
    "dependencies": {
        "express": "4.13.4"
    },
    "scripts": {
        "start": "node index.js"
    }
}

Your index.js for this example could look as follows:

const app = require('express')();
app.get('/', (req, res) => {
    res.send('Welcome');
});
app.listen();

NOTE: npm start has to listen on a port. It can be any port!

To deploy with now, run:

$ now

You'll get a link (copied to your clipboard by default) that you can share
immediately with your peers, even before upload and startup completes.

Features

Easy

šš« now only requires Node.JS to be installed in your computer.

  • No need to install git or source control
  • No need to setup keys
  • No complicated cloud provider setup or registration

Unlimited

Every time your run now, you get a fresh URL that represents the current state of your application.

  • No need to remove old ones
  • No setup of applications or projects
  • URLs stay around forever

Realtime

As soon as you type now, we give you a URL that you can go to or share with co-workers and collaborators.

This URL will show the progress of your deployment. You might see files uploading, and then we show you the progress of the commands executed to deploy your program.

As a matter of fact, now is so fast that you might not even get to see this in many cases!

Future-proof

šš« now exposes servers that speak the HTTP protocol. We don't impose any new propritary Cloud APIs. You can run your apps -with our without šš« now- with OSS software.

In addition:

  • All your traffic is served over HTTP/2.
  • Traffic is only served over secure connections.

Cloud View Source

If you add /_src to any now URL (example), you'll see the code behind it. You and your team will be able to quickly understand what's behind your production systems.

/_src?f=package.json&h=8;10

my-project

my-project-fchpzewmak.now.sh

What's more, every character and line of code is hyperlinkable. This makes collaborative issue triaging and debugging a breeze!

Pricing

OSS PLAN
20 FREE deploys per month
1GB FREE monthly bandwidth
1GB FREE storage
FREE BACKUPS
1MB size limit per file
Dynamic Realtime Scalingā„¢

Perfect for open-source demos, classrooms, tutorials & testing.

The /_src URL is always public.

FREE FOREVER!
PREMIUM PLAN
1000 deploys per month
50GB monthly bandwidth
100GB storage
FREE BACKUPS
No filesize limit
Dynamic Realtime Scalingā„¢

Perfect for the developer that works on commercial apps or APIs.

Project are private by default.

$14.99 / mo
ENTERPRISE PLAN
  • Pay as you go
  • No limits
  • Multi-region
  • SLA
Contact team@zeit.co

FAQ

Does this scale?

šš« now's approach to scalability is unique. Here's what makes it special:

Dynamic

We don't under-allocate or over-allocate resources.
You don't have to ever adjust any nobs, configure instances or set up processes.

Multi-cloud.

We don't depend on a single specific cloud provider, but abstract them instead.

This means that we can always find the best combination of cost, performance, reliability and resistence to failure or censorship.

Why not AWS Lambda / Azure Functions / Google Cloud Functions ?

Exposing just a function is not enough

In real-world applications the metadata of the request is of particular importance.

The response might vary, for example, according to the capabilities of the client. If the User-Agent is so, or the Accept header is such. These won't be automatically present in your payloads, so you'll have to manually supply them in each function call.

The other missing feature is the response code. Instead of returning 404 when something is not found, 403 when the permissions are not met or 500 when something goes wrong, you'll end up creating a new ad-hoc codec for errors that only your own system understands.

It leads to lock-in

The way most cloud providers address the problems described above is by introducing a context object that has access to information from the environment.

The problem is that this context object varies ever so slightly from provider to provider. Were this to be standarized, it would look like HTTP.

We serve all your apps over HTTP/2

HTTP/2 has two critical features that make your requests effectively as lean as "micro functions", from a bandwidth and efficiency perspective:

  • Multiplexing. HTTP/2 exhibits great latency characteristics and bandwidth use by re-utilizing the same TCP connection for all communications. This provides a great advantage for mobile users specially.
  • Header compression. Headers that are the same over the lifetime of a connection are not sent multiple times.

What version of Node.js do you run?

We run Node.JS 5.10.1 by default. We plan to support customizing it with the engines field.

How do I run my build process?

To define a script that has to be run everytime before install, specify a build script in package.json:

{
  "name": "my-project",
  "dependencies": {
    "gulp": "3.9.1",
    "serve": "3.8.3"
  },
  "scripts": {
    "build": "gulp",
    "start": "serve ."
  }
}

How does my app detect šš« now?

If you want to define a specific task for now that overrides build, you can define a task called now-build. If now-build is set, build is ignored.

If you want to have a specific task for startup, you can specify now-start, and the regular start task will be ignored.

In addition, the NOW env variable is exposed to the tasks and scripts.

Can I host static websites?

Absolutely! Just use a Node program to serve your files, such as serve:
Your package.json can look like this:

{
  "name": "my-project",
  "dependencies": {
    "serve": "3.8.3"
  },
  "scripts": {
    "start": "serve ."
  }
}

Who's behind šš« now?

The team that built now has experience deploying and running the largest Node.JS deployments.

Our first Node.JS version in production was 0.1.100, and since then we've built some of the most popular and enduring open-source modules and frameworks, such as:

  • socket.io the most popular realtime framework (35M downloads)
  • mongoose the most popular MongoDB JavaScript ODM (7M downloads)