> ## Documentation Index
> Fetch the complete documentation index at: https://docs.router.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-hosting

## Prerequisites

Before starting, ensure you have the following:

* An account with [Resend](https://resend.com/)
* An account with [Vercel](https://vercel.com/)
* A PostgreSQL database (we recommend [Vercel Postgres](https://vercel.com/docs/storage/vercel-postgres))

## Environment Variables

After creating your accounts, update your `.env.example` to be `.env.local` for running the application locally. Then update the keys for each value.

## Step-by-Step Instructions

1. **Clone the Repository**

   ```sh theme={null}
   git clone https://github.com/9d8dev/router.git
   cd router/main
   ```

2. **Install Dependencies**

   ```sh theme={null}
   npm install
   ```

3. **Set Up Environment Variables**

   Ensure your `.env` file is correctly configured as mentioned above.

4. **Generate the Database Migrations**

   ```sh theme={null}
   npm drizzle-kit generate
   ```

5. **Run the Databse Migrations**

   ```sh theme={null}
   npm tsx lib/db/migrate.ts
   ```

6. **Start the Development Server**

   ```sh theme={null}
   npm run dev
   ```

## Deploying to Vercel

* Push your code to a GitHub repository.
* Connect your repository to Vercel.
* Set the environment variables in Vercel's dashboard under "Settings > Environment Variables".

## Additional Resources

* [Vercel Documentation](https://vercel.com/docs)
* [Resend Documentation](https://resend.com/docs)
* [Drizzle Documentation](https://orm.drizzle.team/docs/overview)
* [Vercel Postgres Documentation](https://vercel.com/docs/storage/vercel-postgres/)
