Skip to content

Hosting

You can host your media library on any file server you choose. To create a deployable folder, run the following command from your project folder:

Terminal window
npm run build

This command creates a folder named dist. It contains static HTML, CSS, JavaScript, and assets. Upload it to your file server.

If you do not have a hosting preference, we recommend GitHub and Cloudflare Workers.

Set up hosting on GitHub and Cloudflare Workers

Section titled “Set up hosting on GitHub and Cloudflare Workers”

Cloudflare Workers can build your project and serve the generated dist folder directly from Cloudflare’s global network.

Use GitHub as the main home for your LightNet project. It stores your source files, receives content changes from the Administration UI, and triggers Cloudflare Workers deployments whenever you push new commits. GitHub is the Git host we recommend for new LightNet projects.

GitHub and Cloudflare Workers both offer approachable free-tier starting points for static sites.

  • Cloudflare Workers can serve static assets from your generated dist folder.
  • GitHub gives you a familiar pull request workflow and acts as the shared backend for both Cloudflare deployments and Administration UI content updates.
  1. Create a GitHub account: If you do not have one yet, sign up at GitHub.
  2. Create a GitHub organization: For collaborating with others, create a GitHub organization to manage access more easily.
  3. Create a new repository: Create a new repository for your LightNet project. A private repository is usually the best choice if your project is not meant to be public.
  4. Push the repository to GitHub: Push your project folder to the new GitHub repository by running these commands from your project folder:
    Terminal window
    git remote add origin https://github.com/your-org/your-project.git
    git push --set-upstream origin --all
    Replace your-org and your-project with your actual values.
  1. Create a Cloudflare Account: Sign up at Cloudflare if you don’t have an account.
  2. Add a Workers config: Create a wrangler.jsonc file in your project root. Use this config to serve the dist folder as static assets:
    wrangler.jsonc
    {
    "name": "your-site",
    "compatibility_date": "2026-03-31",
    "workers_dev": true,
    "preview_urls": true,
    "send_metrics": false,
    "assets": {
    "directory": "./dist",
    "not_found_handling": "404-page"
    },
    "routes": [
    {
    "pattern": "your-site.org",
    "custom_domain": true
    }
    ]
    }
  3. Create a Workers application: In the Cloudflare dashboard, open Compute (Workers) and create a new Worker connected to your GitHub repository.
  4. Configure the build and deploy commands: Set npm run build as the build command and npx wrangler deploy as the deploy command.
  5. View your site: Cloudflare provides a workers.dev preview URL. Each time you push a new commit to GitHub, Cloudflare can rebuild and deploy the site. If preview_urls is enabled, you can also use preview deployments while testing changes.

You can use Cloudflare Domains to purchase a domain registration.

To configure a custom domain:

  1. Purchase a domain from Cloudflare Domains.
  2. Follow the instructions in the Cloudflare dashboard to attach your custom domain to your Worker route.