You just built your Next.js app with all the killer features you wanted. Now you want to put it out for the world to see. But you’re confused — “how do I do that?”. If you’re that person, this article is for you.
In this article, you will learn how to deploy your Next.js app completely free of cost. We will use Appwrite Sites to achieve that.
Appwrite is an open-source, all-in-one cloud development platform. Use built-in backend infrastructure and web hosting, all from a single place. You can build your entire backend within minutes and deploy effortlessly, adding Authentication, Databases, Functions, Storage, Messaging, and more to your projects using the frameworks and languages of your choice.
Appwrite Sites is a frontend hosting service that can help you deploy your Next.js (or any web framework) app in minutes with full RSC (React Server Components) and SSR (server‑side rendering) functionality.
Testing your Next.js build
Before you deploy your Next.js app, it’s essential to see if it builds successfully. Building is a process where Next.js bundles your app into files that can be run on a server and a browser, depending on your usage of SSR (server-side rendering).
To build your Next.js app, run the following command in your terminal:
npm run build
If your build succeeds, you can deploy your Next.js application to the internet. If your build fails, you must fix all the errors in your application. When deploying a Next.js app, the deployment provider builds your app on their servers, and cannot deploy if the build fails.
Configuring your Site on Appwrite
This article assumes you have your Next.js app code stored in a GitHub repository. If not, please do so, as it is needed for deployment. Deploying through code stored on GitHub also introduces advantages such as automatic deployments, preview deployments, etc.
Now, let’s link your GitHub repository to Appwrite Sites.
- Go to Appwrite Console and sign in using your preferred authentication method.
- Create a new project, or use an existing one.
- Click on the Sites option on the sidebar.
- Click on Create Site.
- Click on Connect a GitHub repository.
Now, you should be able to see the most recent GitHub repositories based on activity.
Click Connect against the desired GitHub repository. The Next.js logo should be the icon of any valid Next.js app.
Once you connect your GitHub repository, you will be presented with options for deployment.
Fill in the details as desired. Although there are some things you must know before moving forward.
- If you’re using a different branch for your intended production website, choose the specific branch.
- If you’re using a monorepo, Sites might not automatically detect your application. In such cases, manually provide the root directory for your Next.js app that contains the Next.js configuration file. For example, if you’re using Turborepo, your Next.js app might be located inside one of the folders in the
appsfolder, so your root directory should be something like./apps/web. - Most users don’t need to change the Build settings, although if you want to run different commands for installation and builds, you can configure those in this section. If you don’t know anything about this, it’s worth skipping this section altogether.
- The default build command for Next.js is
npm run build. - The default install command for Next.js is
npm install. - The default output directory for Next.js is
./.next.
- The default build command for Next.js is
- If your app uses environment variables, add them in the Environment variables section. If your app uses sensitive API keys, you are likely using environment variables.
- Configure an Appwrite Network subdomain to get started. You can add a custom domain or use a new Appwrite Network domain once your app is deployed.
Note on environment variables
In Next.js, public environment variables start with NEXT_PUBLIC_. These environment variables are accessible in the browser environment, so don’t store your sensitive API keys in a variable that starts with that prefix.
Now, hit the Deploy button, and the deployment process will begin. You can see the build logs as your website gets deployed.
Build fast, scale faster
Backend infrastructure and web hosting built for developers who ship.
Start for free
Open source
Support for over 13 SDKs
Managed cloud solution
Next steps
Once your Next.js application is deployed, you can view it on the provided domains on the deployment success splash screen or in the Sites section of the Appwrite console.
Now, you can perform further steps to level up your experience with Appwrite Sites:



