DocumentationDevelopment
Rust · 0.1.0
Build the application
Embed the web build in the Rust release binary.
Use the integrated build
Run sh scripts/build.sh from an authorized checkout. The script installs frozen frontend dependencies, runs pnpm release, then performs a locked Cargo release build for the memos binary. The output is copied to build/memos, or build/memos.exe in the supported Windows shell path. Release builds require the actual frontend assets.
sh scripts/build.sh
./build/memos --versionProtocol generation
Canonical API definitions live in proto/api/v1 and store messages in proto/store. Rust protocol bindings are generated during the Rust build. Use the repository's generation scripts for TypeScript and OpenAPI; do not hand-edit generated outputs to hide drift. If a contract changes, update this documentation's checked-in API snapshot from the same verified commit.
Platform evidence
The source defines packaging for multiple platforms. A successful local build does not prove that every target artifact works. Record the target architecture and run the resulting binary in the intended environment. This documentation build does not build or certify application release images.
Smoke-test the built artifact
After sh scripts/build.sh succeeds, use a dedicated shell or sandbox without production /etc/secrets mounts. Run the copied artifact with an explicit SQLite driver, empty DSN, fresh test directory and loopback listener; a data directory alone does not override inherited database settings. In another terminal, check health and open the same address in a browser. The actual application UI should load, not the development placeholder. Save, reload and edit a synthetic memo. Stop the test process before reusing its port or data directory elsewhere.
# Terminal 1: run the built application
unset MEMOS_UNIX_SOCK MEMOS_DEMO
./build/memos --addr 127.0.0.1 --port 8081 --driver sqlite --dsn '' --data ./release-test-data
# Terminal 2: read-only startup check
curl --fail http://127.0.0.1:8081/healthzRegenerate the public protocol outputs
When changing a proto definition, run Buf from proto/. Rust bindings are generated separately by the Rust build; this command generates the OpenAPI and TypeScript outputs configured in buf.gen.yaml. Buf's remote plugins require network access. Review the generated diff for intentional additions/removals, then rerun the affected backend and frontend checks.
(
cd proto
buf lint
buf format --diff --exit-code
buf generate
)
git diff -- proto/gen web/src/types/proto
git diff --checkResolve the missing-frontend release error
crates/amemos/build.rs intentionally refuses a release build when server/frontend/dist/index.html is absent. Running pnpm build is not equivalent to pnpm release: the release script writes to the embedded-asset directory. Generate that output first, then rerun the integrated build. A locally built binary only proves the target you actually built and tested; do not label untested cross-platform artifacts as verified.
(cd web && pnpm install --frozen-lockfile && pnpm release)
sh scripts/build.sh