diff --git a/src/routes/blog/author/atharva/+page.markdoc b/src/routes/blog/author/atharva/+page.markdoc new file mode 100644 index 0000000000..7c00e253fa --- /dev/null +++ b/src/routes/blog/author/atharva/+page.markdoc @@ -0,0 +1,12 @@ +--- +layout: author +name: Atharva Deosthale +slug: atharva +role: DevRel Intern +bio: Developer & Content Creator +avatar: /images/avatars/atharva.png +twitter: https://x.com/atharvabuilds +github: https://github.com/atharvadeosthale +linkedin: https://www.linkedin.com/in/atharvadeosthale/ +--- + diff --git a/src/routes/blog/post/deploy-nextjs-app-to-appwrite-sites/+page.markdoc b/src/routes/blog/post/deploy-nextjs-app-to-appwrite-sites/+page.markdoc new file mode 100644 index 0000000000..a456f28fe0 --- /dev/null +++ b/src/routes/blog/post/deploy-nextjs-app-to-appwrite-sites/+page.markdoc @@ -0,0 +1,80 @@ +--- +layout: post +title: Deploy a Next.js app to Appwrite Sites +description: Learn how to deploy a Next.js app to Appwrite Sites. +date: 2025-08-28 +cover: /images/blog/deploy-nextjs-app-to-appwrite-sites/cover.png +timeToRead: 5 +author: atharva +category: tutorial +--- + +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 all-in-one open-source BaaS (backend as a service) that handles the backend part of your application so that you can focus on the app's core logic rather than unnecessary technical details. + +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: + +```bash +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](https://cloud.appwrite.io) 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. + +![Connecting your GitHub repository to Appwrite Sites](/images/blog/deploy-nextjs-app-to-appwrite-sites/connect-repo.png) + +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. + +![Configuring your Site on Appwrite](/images/blog/deploy-nextjs-app-to-appwrite-sites/site-config.png) + +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 `apps` folder, 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`. +- 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. + +{% info title="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. +{% /info %} + +Now, hit the **Deploy** button, and the deployment process will begin. You can see the build logs as your website gets deployed. + +# Next steps + +![Deployment successful screen](/images/blog/deploy-nextjs-app-to-appwrite-sites/site-deployed.png) + +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: + +- [Custom domains with Appwrite Sites](/blog/post/custom-domains-with-sites) +- [How to host SSR web apps on Appwrite Sites](/blog/post/host-ssr-web-apps-sites) +- [Build and deploy a personal portfolio on Appwrite Sites](/blog/post/portfolio-template-sites) +- [Appwrite Sites quick-starts](/docs/products/sites/quick-start) \ No newline at end of file diff --git a/static/images/avatars/atharva.png b/static/images/avatars/atharva.png new file mode 100644 index 0000000000..999e9eac00 Binary files /dev/null and b/static/images/avatars/atharva.png differ diff --git a/static/images/blog/deploy-nextjs-app-to-appwrite-sites/connect-repo.png b/static/images/blog/deploy-nextjs-app-to-appwrite-sites/connect-repo.png new file mode 100644 index 0000000000..22e6a0b2da Binary files /dev/null and b/static/images/blog/deploy-nextjs-app-to-appwrite-sites/connect-repo.png differ diff --git a/static/images/blog/deploy-nextjs-app-to-appwrite-sites/cover.png b/static/images/blog/deploy-nextjs-app-to-appwrite-sites/cover.png new file mode 100644 index 0000000000..78729deffa Binary files /dev/null and b/static/images/blog/deploy-nextjs-app-to-appwrite-sites/cover.png differ diff --git a/static/images/blog/deploy-nextjs-app-to-appwrite-sites/site-config.png b/static/images/blog/deploy-nextjs-app-to-appwrite-sites/site-config.png new file mode 100644 index 0000000000..4415183448 Binary files /dev/null and b/static/images/blog/deploy-nextjs-app-to-appwrite-sites/site-config.png differ diff --git a/static/images/blog/deploy-nextjs-app-to-appwrite-sites/site-deployed.png b/static/images/blog/deploy-nextjs-app-to-appwrite-sites/site-deployed.png new file mode 100644 index 0000000000..b48f32c2a2 Binary files /dev/null and b/static/images/blog/deploy-nextjs-app-to-appwrite-sites/site-deployed.png differ