> For AI agents: the site index is available at https://www.juniortree.com/llms.txt; this page is available as Markdown at https://www.juniortree.com/docs/setup/deployment.md.
> Deploy your site to various platforms

## Page metadata

- **Source URL:** https://www.juniortree.com/docs/setup/deployment

# Deployment

## Package Mode

This theme which >= v4.0.0 has integrated NPM package mode. Recommended way is remove local package file, and install the theme integration from NPM. If there's some reason you want to change the package content, you should link local package to your theme template. A `bun` method is integrated. You should:

1. Add environment variable `BUN_LINK_PKG=true`.
2. Run `bun pure check` to link the package automatically.

This method can also work on Deployment for other platforms like 'Vercel'. All you need is to add the environment variable to build options on your platform control settings. The build command `astro-pure check && astro check && astro build` will automatically link the package.

## Deployment Mode

**tip:**

Astro had a very fantastic support for deployment. Check [Deploy your Astro Site](https://docs.astro.build/en/guides/deploy/) for more.

### Vercel

This theme supports Vercel by default:

1. Push your code to your online Git repository (GitHub, GitLab, BitBucket).
2. [Import your project](https://vercel.com/new) into Vercel.
3. Vercel will automatically detect Astro and configure the right settings.
4. Your application is deployed! (e.g. [astro.vercel.app](https://astro.vercel.app/))

And vercel also support static method:

```ts title="astro.config.mjs"
import vercelServerless from '@astrojs/vercel/serverless' // [!code --]
import vercelStatic from '@astrojs/vercel/static'; // [!code ++]

export default defineConfig({
  //   ...
  adapter: vercelServerless() // [!code --]
  adapter: vercelStatic(), // [!code ++]
})
```

### Node server

If you are deploying with Node.js locally, you need to install `@astrojs/node` first:

```shell
bun add '@astrojs/node'
```

Then follow the comments in `astro.config.ts` and modify like:

```ts title="astro.config.ts"
import node from '@astrojs/node' // [!code ++]
import vercelServerless from '@astrojs/vercel/serverless' // [!code --]

export default defineConfig({
  //   ...
  adapter: vercelServerless(), // [!code --]
  adapter: node({ mode: 'standalone' }), // [!code ++]

  integrations: [
    // prettier-ignore
    outputCopier({ // [!code --]
      integ: ['sitemap', 'pagefind'] // [!code --]
    }) // [!code --]
  ]
})
```

### Bun server

Bun also support static method.

Check [@nurodev/astro-bun](https://www.npmjs.com/package/@nurodev/astro-bun) for more.

### Static

Remove all server adapter configuration in `astro.config.ts`:

```ts title="astro.config.ts"
import vercelServerless from '@astrojs/vercel/serverless' // [!code --]

export default defineConfig({
  //   ...
  adapter: vercelServerless(), // [!code --]
  output: 'server' // [!code --]
})
```

### GitHub Pages

See [Astro: Configure Astro for GitHub Pages](https://docs.astro.build/en/guides/deploy/github/).

For ones deploying on GitHub Pages with a base path, like `username.github.io/repo-name`, please read [Deployment#Platform with Base Path](/docs/setup/deployment#platform-with-base-path).
carefully.

## Platform with Base Path

**danger:**

1. Astro provides basic support for a base path — see the "base" option in the configuration reference [Astro: base](https://docs.astro.build/en/reference/configuration-reference/#base) for more.
2. This theme will not support the base path, as it seriously break down the experience of remote developments. In general, deploying the template with a base path is not recommended because the homepage integrates lists, resume elements, and other features that rely on the template’s source structure.
3. If you follow the guide and modify the code, you can deploy with a base path, but you cannot use the same project copy to deploy both with and without a base path simultaneously. Proceed at your own risk; do not open issues about this unless you plan to contribute improvements to the docs.

1. Set the `base` option in `astro.config.ts` to your base path, for example:

   ```ts title="astro.config.ts"
   export default defineConfig({
     //   ...
     base: '/repo-name/' // Replace with your repository name
   })
   ```

2. Update all internal links in Dynamic script files:
   - `src/components/BaseHead.astro`
   - `src/pages/docs/DocsContent.astro`
   - `src/pages/rss.xml.ts`
   - `packages/pure/components/pages/PostPreview.astro` ([Customize Theme](/docs/advanced/customize) is required to make the change)

3. Update all static resource paths:
   - Add base paths in `src/site.config.ts`. Especially the menu configs.
   - Add base paths in `src/plugins/shiki-transformers.ts` for all `/icons/code.svg`.
   - Add base paths in `src/assets/styles/app.css` for all url in `@font-face` property.
