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 --buildIt 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.
- Fork the repository and clone it to your local machine with
git clone https://github.com/fmhy/edit.git. - Run
nix flake updateto update the flake lock file. - Run
nix developto enter the development environment. - Make your changes.
- Exit the development environment by running
exit.
Manually
You will need to install the following:
- Git
- Node.js - Install version 21.7.3
- pnpm 9.12.2+
Step 1: Clone the Repository
git clone https://github.com/fmhy/edit.git
cd editStep 2: Install Dependencies
Install project dependencies using pnpm:
pnpm installStep 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:devThe development server will start at http://localhost:5173 by default.
Step 4: Building for Production
You will need to update:
meta: Constant indocs/.vitepress/constants.tsname: Name of your instancehostname: Your domaindescription: Description of your instancetags: Opengraph tagsbuild: Build options (can be configured with Environment Variables)
docs/index.mdtitledescriptionhero.namehero.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:buildStep 5: Preview Production Build
To preview the production build locally:
# Preview the documentation site
pnpm docs:preview
# Preview the API (if needed)
pnpm api:previewStep 6: Deploy
See the VitePress deployment guide for more info.
API Deployment
If you want to deploy the API component (feedback system), you'll need to set up Cloudflare Workers and KV storage.
Prerequisites
- A Cloudflare account
- Wrangler CLI installed globally
Step 1: Configure Wrangler
Update wrangler.toml with your Cloudflare account information:
- Get your account ID from the Cloudflare dashboard (found in the right sidebar)
- Replace the
account_idvalue inwrangler.tomlwith your account ID - If you're using a custom domain, keep
workers_dev = falseand update theroutessection - If you're deploying to
*.workers.dev, setworkers_dev = trueand remove theroutessection
Step 2: Create KV Namespace
Create a KV namespace for data storage:
npx wrangler kv:namespace create STORAGEThis command will return a namespace ID. Copy this ID and replace the id value in the [[kv_namespaces]] section of wrangler.toml (line 14).
Note: If you want to deploy without running Wrangler locally (e.g., in CI/CD), you'll need to:
- Create the KV namespace manually in the Cloudflare dashboard
- Update both the
account_idandidvalues inwrangler.tomlin your fork
Step 3: Build and Deploy
Build and deploy the API:
# Build the API
pnpm api:build
# Deploy to Cloudflare Workers
pnpm api:deployThe API will be deployed to your configured domain or *.workers.dev subdomain.
Rate Limiting (Optional)
The rate limiter binding requires setup through the Cloudflare dashboard. You can skip this for basic deployments or configure it later through the Workers dashboard under the "Rate limiting" section.
Environment Variables
Build-time Variables (for Documentation)
These variables control what gets included when building the documentation site:
FMHY_BUILD_NSFW- Enable NSFW sidebar entry (experimental)FMHY_BUILD_API- Enable API component for feedback system
Runtime Variables (for API Worker)
These variables are used by the deployed Cloudflare Worker API:
WEBHOOK_URL- Discord webhook URL for posting feedback messages (required for API feedback functionality)
Troubleshooting
- If you encounter Node.js version issues, ensure you're using Node.js 21+
- For pnpm-related issues, ensure you're using pnpm 9+
- If you encounter build issues, try clearing cache:bash
# Linux rm -rf docs/.vitepress/cache # PowerShell rm -r -fo docs/.vitepress/cache
Reverse Proxy
You should be able to use any reverse proxy with this vitepress website, but find a reasonable config for an nginx server in the repo here