readest/CONTRIBUTING.md
dastarruer d4bf089ac2
feat: package for nix (#5605)
* refactor(nix): move nix files out of `ops/`

* feat(nix): package for nix

* docs(nix): add installation guide

* chore(workflows): add workflow to build on nix

* chore(workflows): move flake check to pull requests, and builds to cron

* fix(nix): only add ios shell on darwin

* chore(workflows): add workflow to update flake inputs periodically

* chore(workflows): rename nix.yml to nix-build.yml

* chore(workflows): add cachix to nix-build

* chore: check all systems

* chore: auto-update hashes

* fix: set platform to linux and add warning in docs

* fix: only evaluate android shell if system is not aarch64

* fix: drop soon-to-be-deprecated x86_64-darwin platform

* fix: use more explicit nix build command

* fix: respect .gitignore in src

* chore: only run nix build on push to main

* fix: remove duplicate nix installer action

* chore: fix script formatting

* chore: move build check to flake checks

* chore: remove automatic hash-mismatch fix

* fix: only give read permissions to nix build action

* fix: use more explicit matching

* fix: remove unnecessary passthru references

* fix: pin action versions

* fix: use cachix for nix flake check

* fix: remove unnecessary secret

* fix: do not push flake check builds

* fix: meta.platforms -> platforms

* fix(nix): wire up the public binary cache and drop aarch64-linux

The Cachix cache was populated by CI but unreachable by users: neither the
flake nor the README pointed at it, so every install compiled the Rust/Tauri
stack and webkitgtk from source. Add nixConfig substituters and document the
cachix use / nix.settings opt-ins.

skipPush was passed to install-nix-action, which has no such input, so PR
builds still pushed whenever the token was present. Move it to cachix-action
and drop authToken there: the cache is public, so pulling needs no token, and
PR-triggered builds no longer see the push token at all.

Restrict nix_flake_check to pull_request. It also ran on main pushes, where
nix-build.yml already builds and pushes the same paths.

Drop aarch64-linux from eachSystem. Nothing built or cached it, so ARM Linux
users got a cache miss on everything. That makes the two system != aarch64-linux
guards dead, so fold those attrsets back into their bases.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(nix): refresh the pnpm deps hash after lockfile changes on main

nix flake check builds the pull_request merge ref, so the fixed-output
derivation covers main's pnpm-lock.yaml, not just the branch's. Two lockfile
changes landed on main after the hash was pinned (#5754, #5764), so the FOD
went stale and the check failed with a hash mismatch.

Cargo.lock and the turso plugin are unchanged over the same range, so
cargoHash and tursoPluginDeps still match.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* perf(nix): make the PR flake check evaluation only

nix flake check builds every attribute in `checks`, so `checks.build =
packages.default` turned the PR check into a full release build: cargo vendor,
a production Next.js build, and a cold release compile of the whole Tauri tree.
Nix builds in a pure sandbox, so it cannot use the sccache and rust-cache the
other Rust jobs rely on, and the binary cache is still empty, so nothing
amortized it. Observed over 45 minutes per run.

Drop the attribute. The flake outputs are still evaluated across systems, which
catches eval errors, and nix-build.yml keeps doing the real build on main and
pushing the result to the cache.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore(nix): pin actions/checkout to a commit sha

nix-build.yml used the mutable v5 tag while the other 19 checkout usages in
this repo pin 3d3c42e5aac5ba805825da76410c181273ba90b1 (v7.0.1). A movable tag
lets the action change under us and is what the scorecard pinned-dependencies
check flags.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs(nix): compress the README install and fix the dev shell commands

README: five code blocks down to three. The three interchangeable ways to opt
in to the cache collapse to one, and the two configuration.nix snippets merge
into a single block, since a NixOS user edits one file. Note why the cache has
to be repeated there: a flake input's nixConfig does not apply to the importing
system build, so the systemPackages path would otherwise build from source.

CONTRIBUTING: the documented shells pointed at ./ops, which this branch
deleted when it moved the flake to the repository root, so all three commands
failed. The web shell is also named default now, and ios is gated behind
isDarwin.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Huang Xin <chrox.huang@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 18:03:22 +02:00

5.9 KiB

Contribution Guidelines

When contributing to Readest, whether on GitHub or in other community spaces:

  • Follow our Code of Conduct.
  • Be respectful, civil, and open-minded.
  • Before opening a new pull request, try searching through the issue tracker for known issues or fixes.
  • If you want to make code changes based on your personal opinion(s), make sure you open an issue first describing the changes you want to make, and open a pull request only when your suggestions get approved by maintainers.

How to Contribute

Prerequisites

In order to not waste your time implementing a change that has already been declined, or is generally not needed, start by opening an issue describing the problem you would like to solve.

For the best experience to build Readest for yourself, use a recent version of Node.js and Rust. Refer to the Tauri documentation for details on setting up the development environment prerequisites on different platforms.

Basically you need to install or update the following development tools:

  • Node.js and pnpm for Next.js development
  • Rust and Cargo for Tauri development
nvm install v24
nvm use v24
npm install -g pnpm
rustup update

Getting Started

To get started with Readest, follow these steps to clone and build the project.

1. Clone the Repository

git clone https://github.com/readest/readest.git
cd readest

2. Install Dependencies

# might need to rerun this when code is updated
git submodule update --init --recursive
pnpm install
# copy vendors dist libs to public directory
pnpm --filter @readest/readest-app setup-vendors

To confirm that all dependencies are correctly installed, run the following command:

pnpm tauri info

This command will display information about the installed Tauri dependencies and configuration on your platform. Note that the output may vary depending on the operating system and environment setup. Please review the output specific to your platform for any potential issues.

For Windows targets, “Build Tools for Visual Studio 2022” (or a higher edition of Visual Studio) and the “Desktop development with C++” workflow must be installed. For Windows ARM64 targets, the “VS 2022 C++ ARM64 build tools” and "C++ Clang Compiler for Windows" components must be installed. And make sure clang can be found in the path by adding C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin for example in the environment variable Path.

Using Nix

If you have Nix installed, you can leverage the included flake to enter a development shell to install and run all the necessary dependencies and commands. Run these from the repository root, where flake.nix lives:

nix develop           # enter a dev shell for the web and desktop app
nix develop .#android # enter a dev shell for the android app
nix develop .#ios     # enter a dev shell for the ios app (macOS only)

Then, simply run:

# copy vendors dist libs to public directory
pnpm --filter @readest/readest-app setup-vendors

4. Build for Development

# Start development for the Tauri app
pnpm tauri dev
# or start development for the Web app
pnpm dev-web
# preview with OpenNext build for the Web app
pnpm preview

Android

The following must be run once before running the Android app. Note that this is done automatically if using the nix Android devshell:

rm apps/readest-app/src-tauri/gen/android
pnpm tauri android init
pnpm tauri icon ../../data/icons/readest-book.png
git checkout apps/readest-app/src-tauri/gen/android

To run the Android app:

pnpm tauri android dev
# or if you want to dev on a real device
pnpm tauri android dev --host

iOS

# Set up the iOS environment (run once)
pnpm tauri ios init
pnpm tauri icon ../../data/icons/readest-book.png

pnpm tauri ios dev
# or if you want to dev on a real device
pnpm tauri ios dev --host

5. Build for Production

pnpm tauri build
pnpm tauri android build
pnpm tauri ios build

Please refer to our release script if you experience any issues: https://github.com/readest/readest/blob/main/.github/workflows/release.yml

7. More information

Please check the [wiki][link-gh-wiki] of this project for more information on development.

Now you're all setup and can start implementing your changes.

Implement your changes

This project is a monorepo. The code for the readest-app is in the apps/readest-app directory. Here are some useful scripts for developing the frontend only without compiling Tauri:

Command Description
pnpm dev-web Starts the development server for the web app only
pnpm build-web Builds the web app

Editor-specific setup

VS Code

Upon opening the project, you will be prompted to install the following recommended extensions:

  • JavaScript and TypeScript Nightly (ms-vscode.vscode-typescript-next)
  • VS Code ESLint extension (dbaeumer.vscode-eslint)
  • Biome - Code formatter and linter (biomejs.biome)
  • rust-analyzer (rust-lang.rust-analyzer) (for Tauri development only)

Zed

The only extension needed is biome-zed, for code formatting and linting.

When you're done

Check that your code follows the project's style guidelines by running:

pnpm build

Please also make a manual, functional test of your changes. When all that's done, it's time to file a pull request to upstream and fill out the title and body appropriately.

Credits

This documented was inspired by the contributing guidelines for cloudflare/wrangler2.