Chopin

Deployment

Next.js Deployments

Requirements

You must be using @chopinframework/next version 1.1.2 or higher with middleware enabled.

npm install @chopinframework/next@latest

And be sure you have created a middleware.ts file in the root of your project with the following content:

export { middleware } from "@chopinframework/next";

You can do this automatically with the following command in the root of your project:

echo "export { middleware } from \"@chopinframework/next\";" > middleware.ts

Instructions

Just deploy your app as you normally would on Vercel. It just works.

Other Frameworks

Other frameworks can be deployed using our Next Gateway. This routes your app through a Next.js server, so that it is compatible with our sequencing and auth system. In the future, we will have a more optimized deployment option for alternative frameworks.

Click here to automatically deploy the Next Gateway on Vercel

Manual Setup

  1. Host your non-Next.js project on a server with a domain name (i.e. your-project.com, your-project.herokuapp.com, etc.)
  2. Deploy this project to Vercel with your desired domain name. This will be how users will access your project.
  3. Set the DESTINATION_URL environment variable to the location that your non-Next.js project is hosted on. It must be a full URL (e.g. https://your-project.com) and cannot be an IP address.
  4. Recommended: Create a secret password that this server will use when talking to your destination server. This ensures that nobody can talk to your destination server without going through this gateway. Set the SEQUENCER_SECRET environment variable to the secret key of your sequencer. If you set this value, you must also implement middleware on your destination server that checks for this header.

Checking the Secret

If you did step 4, you must check for the x-sequencer-secret header in your destination server. If it is not present, you should return a 401 Unauthorized status.

For example, if you are using Express, your middleware should look like this:

app.use((req, res, next) => {
  if (!req.headers['x-sequencer-secret'] || req.headers['x-sequencer-secret'] !== process.env.SEQUENCER_SECRET) {
    return res.status(401).send('Unauthorized');
  }
 
  next();
});

API Keys

In the future, deployments using Chopin Framework's embedded wallet will require API keys. This is temporarily disabled to allow developers to deploy their apps without worrying about API keys. Keep in mind that this system is in beta, subject to change, and not suitable for production apps.