Guide

Prerequisites

VERY IMPORTANT: Depending on the database you use, you'll have to change the vercel-build script in package.json:

As we're using PlanetScale, our script is prisma generate && prisma db push && next build but for most of the other databases, you'll have to change it to prisma generate && prisma migrate && next build. Search for the specific Prisma integration guides to know more details.

For changing the package.json file, you'll have to fork and clone the repository locally and then make the edits and then finally deploy your edited version.

NOTE: If you prefer to use PlanetScale, you won't have to make any changes (Although, make sure you do not promote any branch to production).

Deploying with Vercel

We will use Vercel to deploy our instance. However, you can use any other hosting service which supports Next.js. Go ahead and create an account on Vercel if you haven't already. (It's free!)

Deploy with Vercel

Click on the button above. You will be asked for some environment variables. Let us look at these variables one-by-one.

Environment Variables

COOKIE_PASSWORD - It is used to encrypt cookies in the browser. This should be a 32 character long randomly generated string. (Make sure to exclude characters like $"' which can break the app)

CIPHER_KEY - It is used to encrypt the bucket keys which the user provides. This should also be a strong and randomly generated string.

SENDGRID_API_KEY - It is used to send emails for passwordless login. You can get this from the SendGrid dashboard.

EMAIL_FROM - It is used to send emails for passwordless login. This is the email which is added and verified in the SendGrid dashboard.

JWT_SECRET - This is again a randomly generated string which is used to sign and verify JWT tokens (used for paswordless logins).

DATABASE_URL - The database URL of your MySQL database. (This should not be a localhost URL)

DEPLOY_URL - This is the URL where you app will be deployed. For most of the times, Vercel gives you a URL like https://<your-project-name-on-vercel>.vercel.app. If this is not the case, you can keep a placeholder value here, wait until your app gets deployed for the first time, get your deployed URL, change the environment variable, and then finally click on Redeploy.

SELF_HOST - Just keep this value as true, we'll use this to disable paywalls in the future versions.

TIP: You can use a service like a random password generator to generate the secrets.
NOTE: If you change an environment variable, you will have to redeploy the app.

And finally, click on the Deploy button!

vercel-deployed

You can configure the domain of your instance in Vercel's project settings. (Make sure you update the DEPLOY_URL env)

It's time to start using Firefiles!

nice