# vercel-dev-server

> A Node.js server that is emulating Vercel cloud functions. It does support monorepos

Latest version **0.2.0** (published 2023-03-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install vercel-dev-server
pnpm add vercel-dev-server
yarn add vercel-dev-server
bun add vercel-dev-server
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2023-03-02 |
| First published | 2023-02-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Maxime Blanc |
| Maintainers | jean-smaug |

## Links

- npm: https://www.npmjs.com/package/vercel-dev-server
- Repository: https://github.com/jean-smaug/vercel-dev-server
- Homepage: https://github.com/jean-smaug/vercel-dev-server#readme
- Issues: https://github.com/jean-smaug/vercel-dev-server/issues
- npm.io page: https://npm.io/package/vercel-dev-server

## Dependencies (2)

- [glob](https://npm.io/package/glob.md) 8.1.0
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) 6.2.1

## Recent versions

- 0.2.0 (latest) — 2023-03-02
- 0.1.3 — 2023-02-28
- 0.1.2 — 2023-02-28
- 0.1.1 — 2023-02-28
- 0.1.0 — 2023-02-28

## README

# Vercel dev server

Based on discussions on Vercel repository, there is no way to use `vercel dev` [command inside a monorepo](https://github.com/vercel/vercel/discussions/5294#discussioncomment-269338).

This package aims to emulate the dev server of vercel in order to make it usable with multiple vercel project inside the same repository.

## Setup

You know the song, install the dependency with your favourite package manager.

```bash
pnpm add -D vercel-dev-server
yarn add -D vercel-dev-server
npm install -D vercel-dev-server
```

```ts
// dev.js

const { createVercelServer } = require("vercel-dev-server");

createVercelServer().then((server) => {
  const PORT = 8080;
  const HOST = "127.0.0.1";

  // `server` is a basic http server.
  // It can takes all params mentionned in Node.js documentation
  // https://nodejs.org/api/http.html#serverlisten
  // https://nodejs.org/api/net.html#serverlistenoptions-callback
  server.listen({
    host: HOST,
    port: PORT,
  });

  console.log(`🏃‍♂️ Server started on http://${HOST}:${PORT}`);
});
```

After that you can create a script in your package.json in order to launch it with a short command line

```bash
pnpm add -D nodemon
```

```json
{
  "scripts": {
    "dev": "nodemon dev.js"
  }
}
```

The last is the creation of a Vercel project. You must have an `api` folder with your cloud functions inside.

```text
/
├─ node_modules/
├─ api/
│  ├─ [id].js
│  ├─ index.js
│  ├─ info.js
├─ dev.js
├─ package.json
```

This package doesn't transpile your code. Check [examples](https://github.com/jean-smaug/vercel-dev-server/tree/master/examples) folder to see how to use it with custom config.

---
_Source: https://npm.io/package/vercel-dev-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
