Docs
Skip to content

Sites

Migrating from Vercel to Appwrite Sites_

A step-by-step guide to migrate your web applications from Vercel to Appwrite Sites.

7 min read

Raw

This guide walks you through migrating from Vercel to Appwrite Sites, covering project setup, configuration, routing, and serverless functionality.

Prerequisites

Before starting your migration:

  • Have access to your Vercel project dashboard
  • Ensure you can modify your domain's DNS settings
  • Prepare your source code repository

Platform differences

Understanding the key differences between Vercel and Appwrite Sites will help you plan your migration effectively.

FeatureVercelAppwrite Sites
DNS configurationUses A records for apex domainsUses NS records for apex domains
Configuration approachPlatform-level configuration via vercel.jsonFramework-native configuration with SSR support
RedirectsPlatform-level path redirects via vercel.jsonDomain-level redirects and framework-level path redirects

Migration process

Follow these steps to move your application from Vercel to Appwrite Sites.

Start by setting up a new project in Appwrite:

  1. Sign in to the Appwrite Console
  2. Click Create Project
  3. Enter a name for your project and click Create

Your new project will serve as the container for your migrated site and any other Appwrite services you might need.

Next, create a new site by connecting your existing repository:

  1. In your Appwrite project, select Sites from the sidebar
  2. Click Create Site
  3. Select Connect a repository
  4. Authenticate with GitHub
  5. Select the repository containing your Vercel project
  6. Choose your production branch (typically main)

Appwrite will auto-detect your framework. Verify this is correct or select manually from the dropdown menu.

Configure your domain

One of the differences between Vercel and Appwrite is how they handle domain configuration for apex domains. Vercel uses A records for apex domains, while Appwrite uses nameserver (NS) records. This means you'll need to delegate DNS management to Appwrite.

Migrating an apex domain

Before migrating, row your current Vercel DNS configuration:

  1. In Vercel, go to project settings > Domains
  2. Note any custom DNS records you've configured (MX, TXT, etc.)
  3. Don't remove the domain from Vercel until Appwrite is fully configured

Add your apex domain to your Appwrite site:

  1. Navigate to your site > Domains tab
  2. Click Add domain
  3. Enter your apex domain (e.g., example.com)
  4. Select Active deployment as the domain rule type
  5. Note the NS records Appwrite provides:
    • ns1.appwrite.zone
    • ns2.appwrite.zone

At your domain registrar:

  1. Update your domain's nameservers to point to Appwrite's nameservers
  2. If you had custom DNS records in Vercel (like MX records for email), you'll need to recreate these in Appwrite's DNS configuration

Migrating a subdomain

For subdomains, both Vercel and Appwrite use CNAME records, making the migration process simpler.

  1. Navigate to your site > Domains tab
  2. Click Add domain
  3. Enter your subdomain (e.g., www.example.com)
  4. Select Active deployment as the domain rule type
  5. Copy the CNAME value provided by Appwrite

At your domain registrar or DNS provider:

  1. Create or update the CNAME record for your subdomain
  2. Point it to the value provided by Appwrite
  3. Wait for DNS propagation and verification

Domain rule types

When adding a domain in Appwrite, you can choose from three rule types: Active deployment, Git branch, or Redirect.

Configure build settings

After setting up your project and domain, you'll need to configure your build settings to match your Vercel configuration.

Navigate to your site > Settings > Build settings and configure the following:

  • Framework: Appwrite will attempt to automatically detect your framework. Verify and ensure it is the same framework as in Vercel.
  • Install command: Enter the same install command from Vercel
  • Build command: Enter the same build command from Vercel
  • Output directory: Enter the same output directory from Vercel
  • Root directory: If your app is in a monorepo subdirectory, specify the path
  • Rendering: Select the appropriate rendering mode (Static or SSR)

Build settings
Build settings

Framework defaults

Appwrite automatically detects and applies default settings for popular frameworks like Next.js, Nuxt, SvelteKit, Angular, and Astro.

Manage environment variables

Environment variables require special attention during migration, as they control how your application behaves in different environments.

Before migrating, row all your Vercel environment variables:

  1. In Vercel, go to your project settings > Environment Variables
  2. Row all variables, noting which are for development, preview, or production
  3. Identify any system variables your application relies on
  1. Navigate to your site > Settings > Environment variables
  2. Click the plus (+) icon to add a new variable
  3. Enter the key and value for each variable. You can optionally import a .env file.
  4. Toggle Secret for sensitive variables that should be hidden

Environment variables
Environment variables

Appwrite system variables

Appwrite automatically injects these variables into your site:

VariableDescriptionAvailable at Build and/or Run Time
APPWRITE_SITE_API_ENDPOINTThe API endpoint of the running siteBoth
APPWRITE_SITE_NAMEThe name of the running site.Both
APPWRITE_SITE_DEPLOYMENTThe deployment ID of the running sites.Both
APPWRITE_SITE_PROJECT_IDThe project ID of the running site.Both
APPWRITE_SITE_RUNTIME_NAMEThe runtime name of the running site.Both
APPWRITE_SITE_RUNTIME_VERSIONThe runtime version of the running site.Both
APPWRITE_SITE_CPUSThe CPU (runtime) specification of the running site.Both
APPWRITE_SITE_MEMORYThe memory (runtime) specification of the running site.Both

Handle redirects and rewrites

One key difference between Vercel and Appwrite is how they handle redirects and rewrites.

Appwrite's domain-level redirects are configured in the Domains tab of your site:

  1. Navigate to your site > Domains tab
  2. Click Add domain or select an existing domain
  3. Choose Redirect as the domain rule type
  4. Enter the destination URL and select an appropriate HTTP status code (301, 302, 303, 307, or 308)

Domain redirects in Appwrite do not preserve path or query parameters. For example, if you redirect example.com to appwrite.io, then example.com/docs?id=123 will redirect to appwrite.io (not appwrite.io/docs?id=123).

For path-based redirects, use your framework's built-in functionality:

Next.js

JavaScript
// next.config.js
module.exports = {
async redirects() {
return [
{
source: '/old-path',
destination: '/new-path',
permanent: true, // 308 status code
},
];
},
};

SvelteKit

JavaScript
// src/routes/+layout.server.js
export function load({ url }) {
if (url.pathname === '/old-path') {
return {
status: 301,
redirect: '/new-path'
};
}
}

Nuxt

JavaScript
// nuxt.config.js
export default {
router: {
extendRoutes(routes, resolve) {
routes.push({
path: '/old-path',
redirect: {
to: '/new-path',
statusCode: 301
}
});
}
}
}

Migrate serverless functions

There are two approaches to serverless functions when migrating from Vercel to Appwrite:

For frameworks with built-in API routes:

  1. Next.js: API routes in /pages/api or route handlers in /app/api work natively
  2. Nuxt: Server API endpoints work as expected
  3. SvelteKit: Server routes and API endpoints function normally

No migration is needed for these framework-native API routes - they'll work automatically when you deploy your site with SSR enabled.

For standalone serverless functions or more complex use cases:

  1. In your Appwrite project, go to Functions
  2. Click Create Function
  3. Select a runtime that matches your needs (Node.js, Python, PHP, Ruby, etc.)
  4. Create your function code
  5. Deploy your function

Framework API routes

When using framework API routes within Appwrite Sites (with SSR enabled), your endpoints remain the same:

  • Vercel: /api/hello
  • Appwrite Sites: /api/hello (no change needed)

Your existing API routes code will work without modification:

JavaScript
// /api/hello.js in Next.js (works the same in both Vercel and Appwrite Sites)
export default function handler(req, res) {
res.status(200).json({ message: 'Hello!' });
}

Standalone Appwrite Functions

If you're using standalone Appwrite Functions (outside your site's codebase), you'll need to update your frontend code to use the Appwrite Functions API:

JavaScript
// Calling an Appwrite Function from your frontend
import { Client, Functions } from 'appwrite';
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('your-project-id');
const functions = new Functions(client);
const response = await functions.createExecution({
functionId: 'your-function-id'
});

Handle middleware

While Vercel offers platform-level Edge Middleware configured through vercel.json, Appwrite Sites fully supports framework-native middleware when using SSR. This means your existing middleware code will continue to work without modification.

Next.js

JavaScript
// middleware.js
export function middleware(request) {
// Your middleware logic
}
export const config = {
matcher: '/path/:path*',
};

SvelteKit

JavaScript
// src/hooks.server.js
export async function handle({ event, resolve }) {
// Your middleware logic before response
const response = await resolve(event);
// Your middleware logic after response
return response;
}

Nuxt

JavaScript
// server/middleware/example.js
export default defineEventHandler((event) => {
// Your middleware logic
});

Next steps

After completing your migration from Vercel to Appwrite Sites, we recommend:

  1. Test thoroughly - Verify all routes, functionality, and environment-specific features
  2. Monitor performance - Check that your site performs as expected on Appwrite
  3. Set up CI/CD - Appwrite already provides git integration and deployment workflows, but you can also use GitHub Actions or any other CI/CD tool to automate your deployments.
  4. Explore Appwrite services - Consider integrating with other Appwrite services like Authentication, Databases, and Storage

Conclusion

This guide has outlined the key steps for migrating from Vercel to Appwrite Sites. You'll find that Git integration and deployment workflows remain largely familiar, making these aspects of migration more approachable for most projects.

While domain configuration and platform-specific features like middleware require some adaptation, the framework-native approaches detailed in this guide help ensure a smooth transition.

For additional help, refer to the Sites documentation or reach out to the Appwrite community on Discord.

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.