FMHY-Website/docs/other/selfhosting.md
2025-07-05 18:08:02 +01:00

3.4 KiB

title description
Selfhosting FMHY This guide will help you set up and run your own instance of FMHY locally.

Selfhosting

:::warning Do note that you must differentiate your instance from the official site (fmhy.net) to avoid confusion. Steps to do so are given below. :::

This guide will help you set up and run your own instance of FMHY locally.

Docker (Experimental)

To run a local instance, you will need to install Docker and Docker Compose.

After installing both, run the following commands:

git clone https://github.com/fmhy/edit.git
cd edit
sudo docker compose up --build

It might take a few minutes to build the image and start the container, running at port 4173.

Nix Flake

You can use nix to set up a development environment, we have a flake that setups nodejs and pnpm.

  1. Fork the repository and clone it to your local machine with git clone https://github.com/fmhy/edit.git.
  2. Run nix flake update to update the flake lock file.
  3. Run nix develop to enter the development environment.
  4. Make your changes.
  5. Exit the development environment by running exit.

Manually

You will need to install the following:

Step 1: Clone the Repository

git clone https://github.com/fmhy/edit.git
cd edit

Step 2: Install Dependencies

Install project dependencies using pnpm:

pnpm install

Step 3: Development Mode

To run the project in development mode:

# Start the documentation site in dev mode
pnpm docs:dev

# Start the API in dev mode (if needed)
pnpm api:dev

The development server will start at http://localhost:5173 by default.

Step 4: Building for Production

You will need to update:

  • the meta constant in docs/.vitepress/constants.ts
    • name: Name of your instance
    • hostname: Your domain
    • description: Description of your instance
    • tags: Opengraph tags
    • build: Build options (can be configured with Environment Variables)
  • docs/index.md
    • title
    • description
    • hero.name
    • hero.tagline

To build the project for production:

# Build the documentation site
pnpm docs:build

# Build the API (if needed) using the Node.js preset
NITRO_PRESET=node pnpm api:build

Step 5: Preview Production Build

To preview the production build locally:

# Preview the documentation site
pnpm docs:preview

# Preview the API (if needed)
pnpm api:preview

Step 6: Deploy

See the VitePress deployment guide for more info.

Environment Variables

You may want to disable NSFW content (sidebar entry, page contents) and/or the API component for Feedback:

  • FMHY_BUILD_NSFW - Disables NSFW content (experimental)
  • FMHY_BUILD_API - Disables the API component

Troubleshooting

  1. If you encounter Node.js version issues, make sure you're using Node.js 21+
  2. For pnpm-related issues, make sure you're using pnpm 9+
  3. If you encounter build issues, try clearing cache:
    rm -rf docs/.vitepress/cache
    rm -rf docs/.vitepress/dist
    pnpm install