Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 41 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
# Contributing Guidelines

We're excited you want to contribute and help improve the Flare Developer Hub. Your contributions make our documentation, tooling, and examples better for everyone.
Thank you for helping improve the **Flare Developer Hub**!
Your contributions make our documentation, tooling, and examples better for everyone.

## How You Can Contribute

We welcome contributions via:
We welcome:

- **[GitHub Issues](https://github.com/flare-foundation/developer-hub/issues):** Report bugs, suggest features, or ask questions.
- **Pull Requests (PRs):** Submit fixes, improvements, or new content (documentation, examples, site features).

## Development Workflow
## 🛠 Development Workflow

1. **Make Changes:** Edit or add documentation (`docs/`), source code (`src/`), examples (`examples/`), or automation scripts (`automations/`, `docgen/`) after forking and creating a new branch:
1. **Fork and branch:** Create a branch for your work:

```bash
git checkout -b feature/your-feature-name
```

2. **Follow Style Guides:**
- **Code/Docs:** Run `npm run format` to apply Prettier formatting. Match existing code style.
- **Diagrams:** Adhere to the [Diagram Style Guide](#diagrams-style-guide) below for consistency.
2. **Make changes:** Edit or add:
- Documentation (`docs/`)
- Source code (`src/`)
- Examples (`examples/`)
- automation scripts (`automations/`, `docgen/`)

3. **Follow Style Guides:**
- **Code/Docs:** Run [Pre-PR checks](#pre-pr-checks). Match existing code style.
- **Diagrams:** Adhere to the [Diagram Style Guide](#diagrams-style-guide) for consistency.

3. **Commit Your Changes:** We **require** the [Conventional Commits](https://www.conventionalcommits.org/) format for clear history and automated changelogs.
4. **Commit Your Changes:** We require [Conventional Commits](https://www.conventionalcommits.org/) format for clear history and automated changelogs.

**Format:** `<type>(<scope>): <description>`

Expand All @@ -38,64 +43,67 @@ We welcome contributions via:
| `style` | Formatting changes (whitespace, etc.) |
| `ci` | CI pipeline changes |

**Example:**
**Examples:**

```bash
git commit -m "fix(ftso): correct feed ID example in getting started guide"
git commit -m "feat(src): add copy button to code blocks"
git commit -m "docs(fassets): clarify liquidation process diagram"
```

4. **Push to Your Fork:**
5. **Push and open a PR:**

```bash
git push origin feature/your-feature-name
```

5. **Open a Pull Request (PR):** Submit a PR against the `main` branch of the `flare-foundation/developer-hub` repository.
Then open a PR against `main` in [flare-foundation/developer-hub](https://github.com/flare-foundation/developer-hub)

## 📋 Pull Request Guidelines

## Pull Request Guidelines
- ✅ **Small & Focused:** One logical change per PR.
- ✅ **Discuss Large Changes First:** Open an issue before starting.
- ✅ **Provide Context:** Describe the problem, solution, and link related issues.
- ✅ **Pass CI:** Fix any GitHub Actions failures before requesting review.
- ✅ **Update Docs:** If behavior or usage changes.
- ✅ **Confirm Licensing:** All PRs are submitted under this repo’s license.

- ✅ **Keep PRs Small & Focused:** One logical change per PR.
- ✅ **Discuss Large Changes First:** Open an issue to discuss significant changes _before_ starting work.
- ✅ **Provide Context:** Clearly describe the problem and solution in your PR description. Link relevant issues.
- ✅ **Ensure Tests & CI Pass:** Fix any failures reported by GitHub Actions. Run tests locally if applicable (especially for `examples/`).
- ✅ **Update Documentation:** If your change affects functionality or usage, update relevant documentation.
- ✅ **Confirm Licensing:** By submitting a PR, you agree to license your contribution under the project's license.
## <a id="pre-pr-checks"></a>🔍 Pre-PR Checks

## Formatting, linting and testing requirements
Run these before submitting a PR:

1. Build the project and verify internal links:
1. **Build & verify internal links:**

```bash
npm run build
```

2. Run formatting, linting, and type‑checking:
2. **Format, lint, and type-check:**

```bash
npm run format && npm run lint && npm run typecheck
```

3. Validate external links using [lychee](https://github.com/lycheeverse/lychee):
3. **Check external links** (requires [lychee](https://github.com/lycheeverse/lychee)):

```bash
lychee --config lychee.toml .
```

4. (Optional) If you’ve added or modified scripts under any `examples/developer-hub-*/` directory, navigate into that example’s folder and run its formatter and test suite.
See the example’s `README.md` for more instructions, e.g.:
4. **If you modified examples**, run their formatters/tests:
(example for Rust, see `examples/developer-hub-*/README.md` for more instructions)

```bash
cd examples/developer-hub-rust/
cargo build
cargo fmt && cargo clippy --fix
cargo test
cargo fmt -- --check # Format
cargo clippy --bins -- -D warnings # Lint
cargo build --bins --locked # Build
chmod +x test.sh && ./test.sh # Tes
```

## Diagrams Style Guide
## <a id="diagrams-style-guide"></a>🖼 Diagrams Style Guide

For consistency, follow these styles when creating or updating diagrams:
Follow these styles for consistency:

| Element | Light Mode | Dark Mode | Notes |
| :----------------------- | :--------- | :-------- | :------------------------------------------------- |
Expand All @@ -107,9 +115,9 @@ For consistency, follow these styles when creating or updating diagrams:
| Onchain Border Style | `Solid` | `Solid` | |
| Offchain Border Style | `Dashed` | `Dashed` | \_Use only if mixing onchain and offchain elements |

See the architecture diagram on the homepage as an [example](https://dev.flare.network/#understand-the-architecture).
See the [homepage architecture diagram](https://dev.flare.network/#understand-the-architecture) for an example.

## Need Help?
## 💬 Need Help?

If you get stuck or have questions, feel free to ask in a [GitHub Issue](https://github.com/flare-foundation/developer-hub/issues).

Expand Down
101 changes: 48 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,32 @@ This repository contains the source code and content for the [Flare Developer Hu

This site is built with [Docusaurus](https://docusaurus.io/), a modern static site generator.

## 🚀 Getting Started
> **Note:** This README is for contributors to the Developer Hub source.
> If you just want to read the documentation, visit [dev.flare.network](https://dev.flare.network).

Follow these steps to set up a local development environment for previewing changes or contributing.
## 🚀 Getting Started

### Prerequisites

- [Node.js v20](https://nodejs.org/en/) with [nvm](https://github.com/nvm-sh/nvm).
- [uv](https://docs.astral.sh/uv/), [Cargo](https://doc.rust-lang.org/cargo/) and [go](https://go.dev/doc/install) for language specific development.
- For language-specific [examples](examples/)
- [uv](https://docs.astral.sh/uv/) for Python
- [Cargo](https://doc.rust-lang.org/cargo/) for Rust
- [go](https://go.dev/doc/install) for Go

### Installation

1. Clone the repository:

```bash
git clone https://github.com/flare-foundation/developer-hub.git
cd developer-hub
```

2. Install dependencies:

```bash
npm install
```

3. Start the local development server:
Clone, install dependencies and start the local development server:

```bash
npm run start
```
```bash
git clone https://github.com/flare-foundation/developer-hub.git
cd developer-hub
npm install
npm run start
```

This launches the development server and automatically opens your default browser. Live reloading ensures changes appear instantly.
This launches the local development server with hot-reloading.
The site will open in your browser automatically.

## 📂 Repo Structure

Expand All @@ -56,10 +51,19 @@ flare-foundation/developer-hub/

Common tasks when developing or contributing content.

### 🏗️ **Building for Production**

Search and some features only work in production.
You can test locally with:

```bash
npm run build && npm run serve
```

### ▶️ Running Code Examples

The [`examples/`](examples/) directory contains code snippets demonstrating how to interact with Flare protocols.
Each language subdirectory often has its own `README.md` with setup instructions.
Each language subdirectory (`examples/developer-hub-*`) has its own `README.md` with setup instructions.

**Supported languages:**

Expand All @@ -68,25 +72,26 @@ Each language subdirectory often has its own `README.md` with setup instructions
- Rust
- Go

### ✨ Formatting Code & Documentation
### ✨ Formatting & Linting

Ensure consistent formatting using [Prettier](https://prettier.io/):
Run [Prettier](https://prettier.io/) for docs and site code:

```bash
npm run format
```

**Note**: Prettier support for MDXv3 is evolving ([tracking issue](https://github.com/prettier/prettier/issues/12209)). If needed, bypass Prettier by using:
Language-specific examples use their native formatters:

```plaintext
{/* prettier-ignore */}
```
- Go → `gofmt` for Go
- Rust →`cargo fmt` for Rust
- Python → `ruff` for Python

Code examples within the `examples/` directory follow language-specific formatting standards:

- `gofmt` for Go
- `cargo fmt` for Rust
- `ruff` for Python
> **Note:** Prettier support for MDXv3 is evolving ([tracking issue](https://github.com/prettier/prettier/issues/12209)).
> To skip formatting for a section:
>
> ```plaintext
> {/* prettier-ignore */}
> ```

### 📄 Generating Solidity documentation

Expand Down Expand Up @@ -118,37 +123,27 @@ To generate Solidity documentation:

1. **Update addresses and feeds:**

This script updates JSON files used by custom components (e.g., feed tables, contract address lists) by fetching data from the `ContractRegistry` onchain and referencing risk data defined in `automations/*_risk.json`.
Fetches latest contract addresses from `ContractRegistry` and feed data for use in site tables and components.

```bash
npm run automations
```

2. **Update language dependencies:**

This script runs package manager updates within the various language subdirectories under `examples/` to refresh their dependencies.
Updates dependencies in all `examples/*` subdirectories.

```bash
npm run update-deps
```

## 🏗️ **Building for Production**

To create a production-ready build:

```bash
npm run build
```

The static files are generated in the `build` directory. To serve the production build locally:

```bash
npm run serve
```

**Note**: Search only works in production builds.

## 🤝 Contributing

Contributions are highly welcome! Whether it's fixing a typo, improving documentation clarity, adding new examples, or enhancing the site itself, your help is appreciated.
Before your first PR, read the [CONTRIBUTING.md](CONTRIBUTING.md).
We welcome contributions of all sizes - from typo fixes to major feature additions.

1. Read the [CONTRIBUTING.md](CONTRIBUTING.md) guidelines.
2. Fork and create a feature branch:
```bash
git checkout -b feature/my-change
```
3. Commit, push, and open a PR.
Loading