diff --git a/.llms-snapshots/llms-full.txt b/.llms-snapshots/llms-full.txt index 14841048..323e8e2f 100644 --- a/.llms-snapshots/llms-full.txt +++ b/.llms-snapshots/llms-full.txt @@ -2246,13 +2246,13 @@ angular-example/├── public/ # Static assets├── src/ ## How to Run -1. **Install dependencies**: +. **Install dependencies**: ``` npm install ``` -2. **Start Juno local emulator**: +NaN. **Start Juno local emulator**: **Important:** @@ -2293,11 +2293,10 @@ npm run dev * Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. * Update `src/environments/environment.prod.ts` and `juno.config.mjs` with the production Satellite ID. * Build and deploy: - - ``` - npm run buildjuno deploy - ``` - + +``` +npm run buildjuno deploy +``` --- @@ -2378,13 +2377,13 @@ export interface NoteData { text: string; url?: string;}export type Note = Doc ## How to Run -1. **Install dependencies**: +. **Install dependencies**: ``` npm install ``` -2. **Start Juno local emulator**: +NaN. **Start Juno local emulator**: **Important:** @@ -2394,7 +2393,7 @@ Requires the Juno CLI to be available `npm i -g @junobuild/cli` juno dev start ``` -3. **Create a Satellite** for local dev: +3. **Create a Satellite** for local dev: * Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. * Update `juno.config.mjs` with your Satellite ID. @@ -2512,13 +2511,13 @@ react-example/├── public/ # Static assets├── src/│ ## How to Run -1. **Install dependencies**: +. **Install dependencies**: ``` npm install ``` -2. **Start Juno local emulator**: +NaN. **Start Juno local emulator**: **Important:** @@ -2528,7 +2527,7 @@ Requires the Juno CLI to be available `npm i -g @junobuild/cli` juno dev start ``` -3. **Create a Satellite** for local dev: +3. **Create a Satellite** for local dev: * Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. * Update `juno.config.mjs` with your Satellite ID. @@ -2646,13 +2645,13 @@ export interface NoteData { text: string; url?: string;}export type Note = Doc ## How to Run -1. **Install dependencies**: +. **Install dependencies**: ``` npm install ``` -2. **Start Juno local emulator**: +NaN. **Start Juno local emulator**: **Important:** @@ -2662,7 +2661,7 @@ Requires the Juno CLI to be available `npm i -g @junobuild/cli` juno dev start ``` -3. **Create a Satellite** for local dev: +3. **Create a Satellite** for local dev: * Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. * Update `juno.config.ts` with your Satellite ID. @@ -2690,13 +2689,15 @@ npm run dev ## Production Deployment * Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. -* Update `juno.config.ts` with the production Satellite ID. +* Update with the production Satellite ID. * Build and deploy: ``` npm run buildjuno deploy ``` +--- + ## Notes * The app is intended as a starting point for Juno-based projects. @@ -2775,13 +2776,13 @@ export interface Note { text: string; url?: string;} ## How to Run -1. **Install dependencies**: +. **Install dependencies**: ``` npm install ``` -2. **Start Juno local emulator**: +NaN. **Start Juno local emulator**: **Important:** @@ -2791,7 +2792,7 @@ Requires the Juno CLI to be available `npm i -g @junobuild/cli` juno dev start ``` -3. **Create a Satellite** for local dev: +3. **Create a Satellite** for local dev: * Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. * Update `juno.config.ts` with your Satellite ID. @@ -2818,8 +2819,8 @@ npm run dev ## Production Deployment -* Create a Satellite on the [Juno Console](https://juno.build) for mainnet. -* Update `juno.config.ts` with the production Satellite ID. +* Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. +* Update with the production Satellite ID. * Build and deploy: ``` @@ -2904,13 +2905,13 @@ vanilla-js-example/├── public/ # Static assets├── src ## How to Run -1. **Install dependencies**: +. **Install dependencies**: ``` npm install ``` -2. **Start Juno local emulator**: +NaN. **Start Juno local emulator**: **Important:** @@ -2920,7 +2921,7 @@ Requires the Juno CLI to be available `npm i -g @junobuild/cli` juno dev start ``` -3. **Create a Satellite** for local dev: +3. **Create a Satellite** for local dev: * Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. * Update `juno.config.mjs` with your Satellite ID. @@ -2947,7 +2948,7 @@ npm run dev ## Production Deployment -* Create a Satellite on the [Juno Console](https://juno.build) for mainnet. +* Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. * Update `juno.config.mjs` with the production Satellite ID. * Build and deploy: @@ -3035,13 +3036,13 @@ export interface Note { text: string; url?: string;} ## How to Run -1. **Install dependencies**: +. **Install dependencies**: ``` npm install ``` -2. **Start Juno local emulator**: +NaN. **Start Juno local emulator**: **Important:** @@ -3051,7 +3052,7 @@ Requires the Juno CLI to be available `npm i -g @junobuild/cli` juno dev start ``` -3. **Create a Satellite** for local dev: +3. **Create a Satellite** for local dev: * Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. * Update `juno.config.ts` with your Satellite ID. @@ -3078,8 +3079,8 @@ npm run dev ## Production Deployment -* Create a Satellite on the [Juno Console](https://juno.build) for mainnet. -* Update `juno.config.ts` with the production Satellite ID. +* Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. +* Update with the production Satellite ID. * Build and deploy: ``` @@ -3172,13 +3173,13 @@ Here’s the actual Rust logic from `lib.rs`: git clone https://github.com/junobuild/examplescd rust/assertions ``` -2. **Install dependencies**: +2. **Install dependencies**: ``` npm install ``` -3. **Start Juno local emulator**: +3. **Start Juno local emulator**: **Important:** @@ -3188,7 +3189,7 @@ Requires the Juno CLI to be available `npm i -g @junobuild/cli` juno dev start ``` -4. **Create a Satellite** for local dev: +4. **Create a Satellite** for local dev: * Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. * Update `juno.config.ts` with your Satellite ID. @@ -3283,7 +3284,7 @@ It’s a great reference for more advanced setups and multi-collection coordinat These crates are used to build and extend serverless functions in Rust with Juno: * [junobuild-satellite](https://docs.rs/junobuild-satellite): Core features and runtime for building a Satellite in Rust, including hooks, assertions, and datastore integration. -* [junobuild-macros](https://docs.rs/junobuild-macros): Procedural macros for declaratively attaching hooks and assertions (e.g., `#[assert_set_doc]`, `#[on_delete_doc]`). +* [junobuild-macros](https://docs.rs/junobuild-macros): Procedural macros for declaratively attaching hooks and assertions. * [junobuild-utils](https://docs.rs/junobuild-utils): Utility helpers for working with documents, including data encoding, decoding, and assertion context handling. # Rust Hooks Example @@ -3348,13 +3349,13 @@ use ic_cdk::print;use junobuild_macros::{on_delete_doc, on_set_doc, on_set_many_ git clone https://github.com/junobuild/examplescd rust/hooks ``` -2. **Install dependencies**: +2. **Install dependencies**: ``` npm install ``` -3. **Start Juno local emulator**: +3. **Start Juno local emulator**: **Important:** @@ -3364,7 +3365,7 @@ Requires the Juno CLI to be available `npm i -g @junobuild/cli` juno dev start ``` -4. **Create a Satellite** for local dev: +4. **Create a Satellite** for local dev: * Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. * Update `juno.config.ts` with your Satellite ID. @@ -3459,7 +3460,7 @@ It’s a great reference for more advanced setups and multi-collection coordinat These crates are used to build and extend serverless functions in Rust with Juno: * [junobuild-satellite](https://docs.rs/junobuild-satellite): Core features and runtime for building a Satellite in Rust, including hooks, assertions, and datastore integration. -* [junobuild-macros](https://docs.rs/junobuild-macros): Procedural macros for declaratively attaching hooks and assertions (e.g., `#[on_set_doc]`, `#[on_delete_doc]`). +* [junobuild-macros](https://docs.rs/junobuild-macros): Procedural macros for declaratively attaching hooks and assertions. * [junobuild-utils](https://docs.rs/junobuild-utils): Utility helpers for working with documents, including data encoding, decoding, and assertion context handling. # Using Juno with AI diff --git a/docs/examples/components/create-a-satellite.mdx b/docs/examples/components/create-a-satellite.mdx new file mode 100644 index 00000000..be111e12 --- /dev/null +++ b/docs/examples/components/create-a-satellite.mdx @@ -0,0 +1,16 @@ +export default function ({ index = 3, config = "juno.config.ts" }) { + return ( + <> +

{index}. Create a Satellite for local dev:

+ + + ); + +} diff --git a/docs/examples/frontend/components/how-to-start.md b/docs/examples/components/how-to-start.mdx similarity index 54% rename from docs/examples/frontend/components/how-to-start.md rename to docs/examples/components/how-to-start.mdx index f3bc877c..d6ad8a31 100644 --- a/docs/examples/frontend/components/how-to-start.md +++ b/docs/examples/components/how-to-start.mdx @@ -1,10 +1,12 @@ -1. **Install dependencies**: +export const index = 1; + +{props.index}. **Install dependencies**: ```bash npm install ``` -2. **Start Juno local emulator**: +{props.index + 1}. **Start Juno local emulator**: :::important diff --git a/docs/examples/frontend/angular.mdx b/docs/examples/frontend/angular.mdx index 0c318fb6..fd9897b9 100644 --- a/docs/examples/frontend/angular.mdx +++ b/docs/examples/frontend/angular.mdx @@ -69,7 +69,7 @@ import KeyFeatures from "./components/key-features.md"; ## How to Run -import HowToStart from "./components/how-to-start.md"; +import HowToStart from "../components/how-to-start.mdx"; @@ -97,10 +97,11 @@ import HowToRun from "./components/how-to-run.md"; - Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. - Update `src/environments/environment.prod.ts` and `juno.config.mjs` with the production Satellite ID. - Build and deploy: - ```bash - npm run build - juno deploy - ``` + +```bash +npm run build +juno deploy +``` --- diff --git a/docs/examples/frontend/components/prod-deploy.mdx b/docs/examples/frontend/components/prod-deploy.mdx new file mode 100644 index 00000000..2bc403e5 --- /dev/null +++ b/docs/examples/frontend/components/prod-deploy.mdx @@ -0,0 +1,10 @@ +export const config = "juno.config.ts"; + +- Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. +- Update {props.config} with the production Satellite ID. +- Build and deploy: + +```bash +npm run build +juno deploy +``` diff --git a/docs/examples/frontend/nextjs.mdx b/docs/examples/frontend/nextjs.mdx index bdaa05a9..f8d15ee1 100644 --- a/docs/examples/frontend/nextjs.mdx +++ b/docs/examples/frontend/nextjs.mdx @@ -69,14 +69,13 @@ export type Note = Doc; ## How to Run -import HowToStart from "./components/how-to-start.md"; +import HowToStart from "../components/how-to-start.mdx"; -3. **Create a Satellite** for local dev: +import CreateSatellite from "../components/create-a-satellite.mdx"; -- Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. -- Update `juno.config.mjs` with your Satellite ID. + import HowToRun from "./components/how-to-run.md"; @@ -93,14 +92,9 @@ import HowToRun from "./components/how-to-run.md"; ## Production Deployment -- Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. -- Update `juno.config.mjs` with the production Satellite ID. -- Build and deploy: +import ProdDeploy from "./components/prod-deploy.mdx"; -```bash -npm run build -juno deploy -``` + --- diff --git a/docs/examples/frontend/react-javascript.mdx b/docs/examples/frontend/react-javascript.mdx index 364dceaa..f49a3270 100644 --- a/docs/examples/frontend/react-javascript.mdx +++ b/docs/examples/frontend/react-javascript.mdx @@ -77,14 +77,13 @@ import KeyFeatures from "./components/key-features.md"; ## How to Run -import HowToStart from "./components/how-to-start.md"; +import HowToStart from "../components/how-to-start.mdx"; -3. **Create a Satellite** for local dev: +import CreateSatellite from "../components/create-a-satellite.mdx"; -- Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. -- Update `juno.config.mjs` with your Satellite ID. + import HowToRun from "./components/how-to-run.md"; @@ -101,14 +100,9 @@ import HowToRun from "./components/how-to-run.md"; ## Production Deployment -- Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. -- Update `juno.config.mjs` with the production Satellite ID. -- Build and deploy: +import ProdDeploy from "./components/prod-deploy.mdx"; -```bash -npm run build -juno deploy -``` + --- diff --git a/docs/examples/frontend/react-typescript.mdx b/docs/examples/frontend/react-typescript.mdx index 47b0252d..f4365d0b 100644 --- a/docs/examples/frontend/react-typescript.mdx +++ b/docs/examples/frontend/react-typescript.mdx @@ -75,14 +75,13 @@ export type Note = Doc; ## How to Run -import HowToStart from "./components/how-to-start.md"; +import HowToStart from "../components/how-to-start.mdx"; -3. **Create a Satellite** for local dev: +import CreateSatellite from "../components/create-a-satellite.mdx"; -- Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. -- Update `juno.config.ts` with your Satellite ID. + import HowToRun from "./components/how-to-run.md"; @@ -99,14 +98,11 @@ import HowToRun from "./components/how-to-run.md"; ## Production Deployment -- Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. -- Update `juno.config.ts` with the production Satellite ID. -- Build and deploy: +import ProdDeploy from "./components/prod-deploy.mdx"; -```bash -npm run build -juno deploy -``` + + +--- ## Notes diff --git a/docs/examples/frontend/sveltekit.mdx b/docs/examples/frontend/sveltekit.mdx index 91eac938..c75f7340 100644 --- a/docs/examples/frontend/sveltekit.mdx +++ b/docs/examples/frontend/sveltekit.mdx @@ -70,14 +70,13 @@ export interface Note { ## How to Run -import HowToStart from "./components/how-to-start.md"; +import HowToStart from "../components/how-to-start.mdx"; -3. **Create a Satellite** for local dev: +import CreateSatellite from "../components/create-a-satellite.mdx"; -- Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. -- Update `juno.config.ts` with your Satellite ID. + import HowToRun from "./components/how-to-run.md"; @@ -94,14 +93,9 @@ import HowToRun from "./components/how-to-run.md"; ## Production Deployment -- Create a Satellite on the [Juno Console](https://juno.build) for mainnet. -- Update `juno.config.ts` with the production Satellite ID. -- Build and deploy: +import ProdDeploy from "./components/prod-deploy.mdx"; -```bash -npm run build -juno deploy -``` + --- diff --git a/docs/examples/frontend/vanilla-javascript.mdx b/docs/examples/frontend/vanilla-javascript.mdx index 45dfc463..6439e62f 100644 --- a/docs/examples/frontend/vanilla-javascript.mdx +++ b/docs/examples/frontend/vanilla-javascript.mdx @@ -71,14 +71,13 @@ import KeyFeatures from "./components/key-features.md"; ## How to Run -import HowToStart from "./components/how-to-start.md"; +import HowToStart from "../components/how-to-start.mdx"; -3. **Create a Satellite** for local dev: +import CreateSatellite from "../components/create-a-satellite.mdx"; -- Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. -- Update `juno.config.mjs` with your Satellite ID. + import HowToRun from "./components/how-to-run.md"; @@ -95,14 +94,9 @@ import HowToRun from "./components/how-to-run.md"; ## Production Deployment -- Create a Satellite on the [Juno Console](https://juno.build) for mainnet. -- Update `juno.config.mjs` with the production Satellite ID. -- Build and deploy: +import ProdDeploy from "./components/prod-deploy.mdx"; -```bash -npm run build -juno deploy -``` + --- diff --git a/docs/examples/frontend/vue.mdx b/docs/examples/frontend/vue.mdx index 73a82b2e..20ef8a00 100644 --- a/docs/examples/frontend/vue.mdx +++ b/docs/examples/frontend/vue.mdx @@ -71,14 +71,13 @@ export interface Note { ## How to Run -import HowToStart from "./components/how-to-start.md"; +import HowToStart from "../components/how-to-start.mdx"; -3. **Create a Satellite** for local dev: +import CreateSatellite from "../components/create-a-satellite.mdx"; -- Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. -- Update `juno.config.ts` with your Satellite ID. + import HowToRun from "./components/how-to-run.md"; @@ -95,14 +94,9 @@ import HowToRun from "./components/how-to-run.md"; ## Production Deployment -- Create a Satellite on the [Juno Console](https://juno.build) for mainnet. -- Update `juno.config.ts` with the production Satellite ID. -- Build and deploy: +import ProdDeploy from "./components/prod-deploy.mdx"; -```bash -npm run build -juno deploy -``` + --- diff --git a/docs/examples/functions/components/how-to-run.md b/docs/examples/functions/components/how-to-run.md new file mode 100644 index 00000000..cc5ad662 --- /dev/null +++ b/docs/examples/functions/components/how-to-run.md @@ -0,0 +1,13 @@ +6. **Start the frontend dev server** (in a separate terminal): + +```bash +npm run dev +``` + +7. **Build the serverless functions** (in a separate terminal): + +```bash +juno functions build +``` + +The emulator will automatically upgrade your Satellite and live reload the changes. diff --git a/docs/examples/functions/components/prod-deploy.md b/docs/examples/functions/components/prod-deploy.md new file mode 100644 index 00000000..aeb83ead --- /dev/null +++ b/docs/examples/functions/components/prod-deploy.md @@ -0,0 +1,15 @@ +- Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. +- Update `juno.config.ts` with the production Satellite ID. +- Build and deploy the frontend: + +```bash +npm run build +juno deploy +``` + +- Build and upgrade the serverless functions: + +```bash +juno functions build +juno functions upgrade +``` diff --git a/docs/examples/functions/rust/assertions.mdx b/docs/examples/functions/rust/assertions.mdx index 2bae5072..89af1812 100644 --- a/docs/examples/functions/rust/assertions.mdx +++ b/docs/examples/functions/rust/assertions.mdx @@ -106,47 +106,22 @@ git clone https://github.com/junobuild/examples cd rust/assertions ``` -2. **Install dependencies**: +import HowToStart from "../../components/how-to-start.mdx"; -```bash -npm install -``` - -3. **Start Juno local emulator**: - -:::important - -Requires the Juno CLI to be available `npm i -g @junobuild/cli` - -::: - -```bash -juno dev start -``` + -4. **Create a Satellite** for local dev: +import CreateSatellite from "../../components/create-a-satellite.mdx"; -- Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. -- Update `juno.config.ts` with your Satellite ID. + 5. **Create required collections**: - `notes` in Datastore: [http://localhost:5866/datastore](http://localhost:5866/datastore) - `images` in Storage: [http://localhost:5866/storage](http://localhost:5866/storage) -6. **Start the frontend dev server** (in a separate terminal): - -```bash -npm run dev -``` - -7. **Build the serverless functions** (in a separate terminal): - -```bash -juno functions build -``` +import HowToRun from "../components/how-to-run.md"; -The emulator will automatically upgrade your Satellite and live reload the changes. + --- @@ -159,21 +134,9 @@ The emulator will automatically upgrade your Satellite and live reload the chang ## Production Deployment -- Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. -- Update `juno.config.ts` with the production Satellite ID. -- Build and deploy the frontend: +import ProdDeploy from "../components/prod-deploy.md"; -```bash -npm run build -juno deploy -``` - -- Build and upgrade the serverless functions: - -```bash -juno functions build -juno functions upgrade -``` + --- @@ -186,40 +149,12 @@ juno functions upgrade ## Real-World Example -Want to see how assertions and serverless logic are used in a live project? - -Check out [proposals.network](https://proposals.network), an open-source app built with Juno: - -- GitHub: [github.com/peterpeterparker/proposals.network](https://github.com/peterpeterparker/proposals.network) -- Example logic: [src/satellite/src/lib.rs](https://github.com/peterpeterparker/proposals.network/blob/main/src/satellite/src/lib.rs) +import ProposalsNetwork from "./components/proposals-network.md"; -This app uses: - -- `#[on_delete_doc]` and `#[assert_delete_doc]` to validate and clean up related documents and assets -- Shared helper modules like `assert`, `delete`, and `types` to keep logic organized -- A real-world pattern of chaining asset/document deletions with assertions - -It’s a great reference for more advanced setups and multi-collection coordination. + --- -## References - -- [Serverless Functions Guide](../../../guides/rust.mdx) -- [Rust Functions Development](../../../build/functions/index.md) -- [Rust SDK Reference](../../../reference/functions/rust/sdk.mdx) -- [Rust Utils Reference](../../../reference/functions/rust/utils.mdx) -- [Run Local Development](../../../guides/local-development.mdx) -- [CLI Reference](../../../reference/cli) -- [Configuration Reference](../../../reference/configuration.mdx) -- [Datastore Collections](../../../build/datastore/collections.md) - ---- - -## Crate Docs - -These crates are used to build and extend serverless functions in Rust with Juno: +import References from "./components/references.md"; -- [junobuild-satellite](https://docs.rs/junobuild-satellite): Core features and runtime for building a Satellite in Rust, including hooks, assertions, and datastore integration. -- [junobuild-macros](https://docs.rs/junobuild-macros): Procedural macros for declaratively attaching hooks and assertions (e.g., `#[assert_set_doc]`, `#[on_delete_doc]`). -- [junobuild-utils](https://docs.rs/junobuild-utils): Utility helpers for working with documents, including data encoding, decoding, and assertion context handling. + diff --git a/docs/examples/functions/rust/components/proposals-network.md b/docs/examples/functions/rust/components/proposals-network.md new file mode 100644 index 00000000..744a0319 --- /dev/null +++ b/docs/examples/functions/rust/components/proposals-network.md @@ -0,0 +1,14 @@ +Want to see how assertions and serverless logic are used in a live project? + +Check out [proposals.network](https://proposals.network), an open-source app built with Juno: + +- GitHub: [github.com/peterpeterparker/proposals.network](https://github.com/peterpeterparker/proposals.network) +- Example logic: [src/satellite/src/lib.rs](https://github.com/peterpeterparker/proposals.network/blob/main/src/satellite/src/lib.rs) + +This app uses: + +- `#[on_delete_doc]` and `#[assert_delete_doc]` to validate and clean up related documents and assets +- Shared helper modules like `assert`, `delete`, and `types` to keep logic organized +- A real-world pattern of chaining asset/document deletions with assertions + +It’s a great reference for more advanced setups and multi-collection coordination. diff --git a/docs/examples/functions/rust/components/references.md b/docs/examples/functions/rust/components/references.md new file mode 100644 index 00000000..e0c46fb0 --- /dev/null +++ b/docs/examples/functions/rust/components/references.md @@ -0,0 +1,20 @@ +## References + +- [Serverless Functions Guide](../../../../guides/rust.mdx) +- [Rust Functions Development](../../../../build/functions/index.md) +- [Rust SDK Reference](../../../../reference/functions/rust/sdk.mdx) +- [Rust Utils Reference](../../../../reference/functions/rust/utils.mdx) +- [Run Local Development](../../../../guides/local-development.mdx) +- [CLI Reference](pathname:///docs/reference/cli) +- [Configuration Reference](../../../../reference/configuration.mdx) +- [Datastore Collections](../../../../build/datastore/collections.md) + +--- + +## Crate Docs + +These crates are used to build and extend serverless functions in Rust with Juno: + +- [junobuild-satellite](https://docs.rs/junobuild-satellite): Core features and runtime for building a Satellite in Rust, including hooks, assertions, and datastore integration. +- [junobuild-macros](https://docs.rs/junobuild-macros): Procedural macros for declaratively attaching hooks and assertions. +- [junobuild-utils](https://docs.rs/junobuild-utils): Utility helpers for working with documents, including data encoding, decoding, and assertion context handling. diff --git a/docs/examples/functions/rust/hooks.mdx b/docs/examples/functions/rust/hooks.mdx index 8b143fe5..3471f9b3 100644 --- a/docs/examples/functions/rust/hooks.mdx +++ b/docs/examples/functions/rust/hooks.mdx @@ -160,47 +160,22 @@ git clone https://github.com/junobuild/examples cd rust/hooks ``` -2. **Install dependencies**: +import HowToStart from "../../components/how-to-start.mdx"; -```bash -npm install -``` - -3. **Start Juno local emulator**: - -:::important - -Requires the Juno CLI to be available `npm i -g @junobuild/cli` - -::: - -```bash -juno dev start -``` + -4. **Create a Satellite** for local dev: +import CreateSatellite from "../../components/create-a-satellite.mdx"; -- Visit [http://localhost:5866](http://localhost:5866) and follow the instructions. -- Update `juno.config.ts` with your Satellite ID. + 5. **Create required collections**: - `demo` in Datastore: [http://localhost:5866/datastore](http://localhost:5866/datastore) - `images` in Storage: [http://localhost:5866/storage](http://localhost:5866/storage) -6. **Start the frontend dev server** (in a separate terminal): - -```bash -npm run dev -``` - -7. **Build the serverless functions** (in a separate terminal): - -```bash -juno functions build -``` +import HowToRun from "../components/how-to-run.md"; -The emulator will automatically upgrade your Satellite and live reload the changes. + --- @@ -213,21 +188,9 @@ The emulator will automatically upgrade your Satellite and live reload the chang ## Production Deployment -- Create a Satellite on the [Juno Console](https://console.juno.build) for mainnet. -- Update `juno.config.ts` with the production Satellite ID. -- Build and deploy the frontend: +import ProdDeploy from "../components/prod-deploy.md"; -```bash -npm run build -juno deploy -``` - -- Build and upgrade the serverless functions: - -```bash -juno functions build -juno functions upgrade -``` + --- @@ -240,40 +203,12 @@ juno functions upgrade ## Real-World Example -Want to see how assertions and serverless logic are used in a live project? - -Check out [proposals.network](https://proposals.network), an open-source app built with Juno: - -- GitHub: [github.com/peterpeterparker/proposals.network](https://github.com/peterpeterparker/proposals.network) -- Example logic: [src/satellite/src/lib.rs](https://github.com/peterpeterparker/proposals.network/blob/main/src/satellite/src/lib.rs) +import ProposalsNetwork from "./components/proposals-network.md"; -This app uses: - -- `#[on_delete_doc]` and `#[assert_delete_doc]` to validate and clean up related documents and assets -- Shared helper modules like `assert`, `delete`, and `types` to keep logic organized -- A real-world pattern of chaining asset/document deletions with assertions - -It’s a great reference for more advanced setups and multi-collection coordination. + --- -## References - -- [Serverless Functions Guide](../../../guides/rust.mdx) -- [Rust Functions Development](../../../build/functions/index.md) -- [Rust SDK Reference](../../../reference/functions/rust/sdk.mdx) -- [Rust Utils Reference](../../../reference/functions/rust/utils.mdx) -- [Run Local Development](../../../guides/local-development.mdx) -- [CLI Reference](../../../reference/cli) -- [Configuration Reference](../../../reference/configuration.mdx) -- [Datastore Collections](../../../build/datastore/collections.md) - ---- - -## Crate Docs - -These crates are used to build and extend serverless functions in Rust with Juno: +import References from "./components/references.md"; -- [junobuild-satellite](https://docs.rs/junobuild-satellite): Core features and runtime for building a Satellite in Rust, including hooks, assertions, and datastore integration. -- [junobuild-macros](https://docs.rs/junobuild-macros): Procedural macros for declaratively attaching hooks and assertions (e.g., `#[on_set_doc]`, `#[on_delete_doc]`). -- [junobuild-utils](https://docs.rs/junobuild-utils): Utility helpers for working with documents, including data encoding, decoding, and assertion context handling. +