npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@darylcecile/next-controls

v0.1.4

Published

Deploy to Vercel Programmatically

Readme


Overview

Next-Controls is a wrapper library for Next.js APIs. Currently under early development, only a limited selection of endpoints are supported, but PRs are welcome.

The methods provided make use of properties defined in the Vercel docs; see those for more info on what each required property is.

Progress:

  • Deployments - [partial]
  • Auth - [partial]
  • Secrets - [complete]
  • Projects - [partial]
  • Log Drain - [todo]
  • Domains - [todo]
  • Aliases - [todo]
  • Artifact - [todo - beta]

Local Development

To get going after pulling the repo locally:

  1. Create a copy of the .env.sample file called .env, and set your VERCEL_TOKEN value.
  2. Make your changes
  3. Run yarn build or npm run build to create the esm and cjs variants.

That's all there is to it; I've left this project simple in structure, and un-opinionated for now. Tests are my next priority (Read my blog post to find out how I ended up with this repo to begin with).

Using in your project

To begin using this in your project, first install it into your project:

yarn add @darylcecile/next-controls
# or 
npm i @darylcecile/next-controls --save.

then import it into your work:

import {CreateProject} from "@darylcecile/next-controls";

// ...

The methods all return a Promise of AxiosRequest, with each request data being typed (see ./src/types/ folder for type definitions).

🚨NOTE This library only contains a small subset of what the Vercel API supports. I've only added what I found I needed for my use-case, but plan on expanding to cover all APIs in the future. In the meantime, PRs are welcome to add more wrapper methods.

Create Deployment

Create a deployment on the specified project; provided files will be uploaded for deployment.

CreateDeployment({
	bearer: '...',
	projectId: '...',
	files: [
		{
			file: '<fileName>',
			data: '...', // optional
			sha: '...', // optional
			size: 0, // optional
			encoding: 'base64' // optional
        },
        // {...}
    ],
	forceNew: false, // optional - see Vercel docs
	target: "staging", // optional - "staging" (default) or "production"
	meta: {
		key: 'value',
        // ...
    }
})

// returns -> Promise<AxiosResponse>

Get Deployment By ID or URL

Finds a deployment by deploymentId or URL. Bearer optional (see vercel docs).

GetDeploymentByIdOrUrl({
	bearer: '...', // optional
	idOrUrl: '...'
});

// returns -> Promise<AxiosResponse>

Delete a Deployment

Delete a deployment by ID or URL.

DeleteDeployment({
	bearer: '...',
	id: '...', //deployment ID
	teamId: '...', //optional - for team-project deployment
	url: '...' //optional - if provided will ignore id
});

// returns -> Promise<AxiosResponse>

View Deployment Details

Get deployment details for a specific project

ViewDeployments({
	bearer: '...',
	projectId: '...'
});

// returns -> Promise<AxiosResponse>

Cancel a deployment

Cancel an ongoing deployment for a specific project

CancelDeployment({
	bearer: '...',
	id: '...', // deployment ID
	teamId: '...' //optional - for team project
});

// returns -> Promise<AxiosResponse>

Get all Projects

Get a list of all projects.

GetAllProjects({
	bearer: '...',
	from: 9999999999, // optional - timestamp
	limit: 0, // optional - count
	search: '...', //optional - filter
	teamId: '...' //optional - for team projects
});

// returns -> Promise<AxiosResponse>

Delete a Project

Delete a project by ID or Name.

DeleteProject({
	bearer: '...',
	idOrName: '...', // project unique ID or Name
	teamId: '...' //optional - if its a team project
});

// returns -> Promise<AxiosResponse>

Create a new Project

Create a project. Supported frameworks can be found on vercel doc.

CreateProject({
	bearer: '...',
	name: '...', // project name
	environmentVariables: ['ENV=val', '...'], //optional
    framework: "nextjs" //optional - see doc for up-to-date list of supported frameworks
});

// returns -> Promise<AxiosResponse>

Login with Email

As stated in vercel docs: Request a new login for a user to get a token. This will respond with a verification token and send an email to confirm the request. Once confirmed you can use the verification token to get an authentication token.

LoginWithEmail({
	email: '...', // user email
	tokenName: '...' //optional - name for the token
});

// returns -> Promise<AxiosResponse>

Verify email login request

As stated in vercel docs: Verify the user accepted the login request and get a authentication token.

VerifyLoginRequest({
	token: '...', // token received from above request
	email: '...', // user email
	tokenName: '...' //optional - name for the token
});

// returns -> Promise<AxiosResponse>