Skip to content
Open
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
19 changes: 19 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

See [CONTRIBUTING.md](CONTRIBUTING.md) for build commands, testing, code style, and development workflow.

## Workspace Structure

- **ldk-server** - Main daemon server (entry point: `src/main.rs`)
- **ldk-server-cli** - CLI client using clap
- **ldk-server-client** - Reqwest-based client library
- **ldk-server-protos** - Protocol buffer definitions and generated Rust code

## Development Rules
Copy link
Collaborator

@tnull tnull Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could mention "Always ensure that tests pass and lints are fixed before committing". Also, maybe, "run cargo +nightly fmt before committing if nightly channel Rust is locally installed already"? Or do you feel such things rather belong in the local/personal CLAUDE.md?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather not put the nightly fmt in here. If we merge a PR without it, we don't want someone else's PR formatting other unrelated code


- Always ensure tests pass and lints are fixed before committing
- Run `cargo fmt --all` after every code change
- Never add new dependencies unless explicitly requested
- Please always disclose the use of any AI tools in commit messages and PR descriptions
80 changes: 80 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Contributing to LDK Server

Contributions are welcome and encouraged! Whether you're fixing bugs, adding features, improving documentation, or
helping with testing, we appreciate your help!

## Building

```bash
cargo build # Build all crates
cargo build --release # Production build (LTO enabled)
```

## Running

```bash
cargo run --bin ldk-server ./ldk-server/ldk-server-config.toml
```

## Testing

```bash
cargo test # Run all tests
cargo test --all-features # Run tests with all features
```

## Code Quality

```bash
cargo fmt --all # Format code
cargo fmt --all -- --check # Check formatting
cargo clippy --all-features -- -D warnings -A clippy::drop_non_drop # Lint (CI uses this on MSRV)
```

## Code Style

- MSRV: Rust 1.85.0
- Hard tabs, max width 100 chars
- Imports grouped: std, external crates, local crates

## Protocol Buffer Generation

```bash
RUSTFLAGS="--cfg genproto" cargo build -p ldk-server-protos
```

After regenerating, you must manually readd the copyright header to each generated file in `ldk-server-protos/src/` (
`api.rs`, `types.rs`, `events.rs`, `error.rs`):

```
// This file is Copyright its original authors, visible in version control
// history.
//
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// You may not use this file except in accordance with one or both of these
// licenses.
```

Then run `cargo fmt --all` to format the generated code.

## Adding a New API Endpoint

1. Define request/response messages in `ldk-server-protos/src/proto/api.proto`
2. Regenerate protos (see above)
3. Create handler in `ldk-server/src/api/` (follow existing patterns)
4. Add route in `ldk-server/src/service.rs`
5. Add CLI command in `ldk-server-cli/src/main.rs`

## Configuration

- Config template with all options: `ldk-server/ldk-server-config.toml`
- When updating config options, also update the tests in `ldk-server/src/util/config.rs`

## Before Submitting

- Ensure all tests pass
- Ensure all lints are fixed
- Run `cargo fmt --all`
- Please disclose the use of any AI tools in commit messages and PR descriptions
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ eval "$(ldk-server-cli completions zsh)"
# Fish (add to ~/.config/fish/config.fish)
ldk-server-cli completions fish | source
```

## Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on building, testing, code style, and development workflow.