Hosting
Hosting your media library
Section titled “Hosting your media library”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:
npm run buildThis 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
distfolder. - GitHub gives you a familiar pull request workflow and acts as the shared backend for both Cloudflare deployments and Administration UI content updates.
Set up GitHub
Section titled “Set up GitHub”- Create a GitHub account: If you do not have one yet, sign up at GitHub.
- Create a GitHub organization: For collaborating with others, create a GitHub organization to manage access more easily.
- 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.
- Push the repository to GitHub: Push your project folder to the new GitHub repository by running these commands from your project folder:
Replace
Terminal window git remote add origin https://github.com/your-org/your-project.gitgit push --set-upstream origin --allyour-organdyour-projectwith your actual values.
Set up Cloudflare Workers
Section titled “Set up Cloudflare Workers”- Create a Cloudflare Account: Sign up at Cloudflare if you don’t have an account.
- Add a Workers config: Create a
wrangler.jsoncfile in your project root. Use this config to serve thedistfolder 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}]} - Create a Workers application: In the Cloudflare dashboard, open Compute (Workers) and create a new Worker connected to your GitHub repository.
- Configure the build and deploy commands: Set
npm run buildas the build command andnpx wrangler deployas the deploy command. - View your site: Cloudflare provides a
workers.devpreview URL. Each time you push a new commit to GitHub, Cloudflare can rebuild and deploy the site. Ifpreview_urlsis enabled, you can also use preview deployments while testing changes.
Configure a Cloudflare domain
Section titled “Configure a Cloudflare domain”You can use Cloudflare Domains to purchase a domain registration.
To configure a custom domain:
- Purchase a domain from Cloudflare Domains.
- Follow the instructions in the Cloudflare dashboard to attach your custom domain to your Worker route.