# Runestone

English | [繁體中文](https://github.com/cymondez/runestone/blob/main/docs/README/README.zh-TW.md) | [日本語](https://github.com/cymondez/runestone/blob/main/docs/README/README.ja-JP.md)

![logo](https://raw.githubusercontent.com/cymondez/runestone/main/logos/runestone_icon_gray_large.png)

This project was forked from [druidfi/stonehenge 5.2](https://github.com/druidfi/stonehenge).
The main change is replacing Makefile-based installation and management with an npm global tool that is easier to use across platforms.
If you like this project, please also support the original idea by starring [druidfi/stonehenge 5.2](https://github.com/druidfi/stonehenge).

## Introduction

1. Local frontend and backend projects can be tested with `SSL certificates` and a `local domain`, avoiding many localhost-related issues.
2. Ports 80 and 443 can be reused, reducing port conflicts between multiple local projects.
3. You do not need to edit the hosts file just to use a `local domain`.

## Core Components

- traefik: Reverse proxy that routes requests to the matching project.
- mailpit: SMTP testing tool that captures and displays sent emails.
- npm tool: Command line tool for managing and running Runestone.
- @mkcert/node: Generates locally trusted SSL certificates.

## Requirements

- Latest Ubuntu LTS, or Windows 10/11 with WSL2 installed.
- Docker 29.0+ with Docker Compose V2.
- Node.js 22.0+.

## Installation And Usage

### Install

```bash
npm install -g @developers-homelab/runestone-cli
```

### Start

The first time you run it, an interactive setup wizard will appear. To change settings later, run `runestone setup`.

```bash
runestone up
```

### Stop Or Shut Down

Note: If Runestone was not stopped before shutting down your system, it will start automatically on the next boot.

Stop:

```bash
runestone stop
```

Shut down (stop and remove containers):

```bash
runestone down
```

## Certificate Management

### List Certificates

Shows the certificate list from the `.runestone/certs` directory.

```bash
runestone certs list
```

### Add Certificate

Adds a certificate generated by `@mkcert/node` to the `.runestone/certs` directory and creates the dynamic Traefik configuration.

```bash
runestone certs create <domain>
```

### Remove Certificate

Removes the certificate from the `.runestone/certs` directory and deletes the matching dynamic configuration.

```bash
runestone certs remove <domain>
```

## More Help

```bash
runestone --help
```

## Todo

- [ ] Test on macOS (M1/M2/M3/M4/M5).

## References

- [druidfi/stonehenge](https://github.com/druidfi/stonehenge)
- [axllent/mailpit](https://github.com/axllent/mailpit)
- [FiloSottile/mkcert](https://github.com/FiloSottile/mkcert)
- [traefik.io](https://traefik.io/)

## License

[MIT License](LICENSE)
