This project leverages Earthstar, an open-source library for building peer-to-peer (p2p) applications, to create and deploy static websites on a private distributed network. By using Earthstar's sync capabilities, website content is replicated across multiple devices in a network, ensuring high availability and resilience. The project is designed for individuals and organizations that require a decentralized approach to hosting—enhancing privacy and control over their content.
- Earthstar is an offline-first database.
- Earthstar is a key-value database which supports author versions.
- Earthstar data is mutable.
- Earthstar databases can sync
- Earthstar databases are private
- Earthstar works in the browser
To run this project, you will need:
- Deno
To get started with this project, follow these instructions:
- Clone the repository:
git clone earthstar-server cd
- Now you need to create your shareAddress and a secret though we are not going to use the secret at this point.
deno import * as Earthstar from "https://deno.land/x/earthstar/mod.ts"; let shareKeypair = await Earthstar.Crypto.generateShareKeypair("gardening");
- Copy and paste the shareAddress in known_shares.json
"+gardening.......",
- Run deno:
deno run server.ts
This will run a local server that can sync your data only if the known_shares are provided.Remember this is a private network unlike regular peer to peer network where peers are discovered. In Earthstar discovery takes places given you have a shareAddress beforehand.
- Use the CF Earthstar CLI or an Earthstar-enabled application to publish and sync your static website content across your private network.
- There is a repository includes a simple static site generator. Create your assets (HTML, CSS, JS) within the designated folders and run the build script to prepare them for distribution: (Use the shareAddress and secret from the above)
deno run deploy --name projectName -shareAddress address --secret secret
- Distribute the built assets across the network using Earthstar's sync functionality:
deno sync --address 'https://pub.cynsar.foundation' || 'http://localhost:8080'
- Your website is now hosted and distributed on the private network and can be accessed through any peer with the content synced.
- Your website will be available on the network here
https://serve.cynsar.foundation/{projectName}
We encourage contributions to this project. Please fork the repository, make your changes, and submit a pull request for review. If you're planning to propose significant changes or would like to discuss ideas and issues, it's best to open an issue first to get feedback from the maintainers.
If you encounter any issues or have questions, refer to the Earthstar documentation or open an issue in this repository's issue tracker.
This project is licensed under the MIT License - see the LICENSE
file for details.
- The Earthstar Project - for offering the tools and resources that make this project possible.
This project is in development and should not be considered production-ready. Use at your own risk and always ensure you comply with local regulations regarding data sharing and privacy.