Skip to content

Commit 6a854d0

Browse files
docs: integrate plugins in setup SDK
Signed-off-by: David Dal Busco <david.dalbusco@outlook.com>
1 parent 8f31700 commit 6a854d0

2 files changed

Lines changed: 31 additions & 15 deletions

File tree

docs/reference/plugins.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import { Bash } from "../components/bash.mdx";
4949

5050
In your Next.js config file — whether it's `next.config.js`, `next.config.ts`, `next.config.mjs` or else — wrap your configuration with `withJuno` to automatically load Juno settings:
5151

52-
```javascript
52+
```javascript title="next.config.js"
5353
import { withJuno } from "@junobuild/nextjs-plugin";
5454

5555
export default withJuno();
@@ -63,7 +63,7 @@ The plugin supports following options:
6363

6464
The plugin sets the build output to `export` by default. You can provide additional options as follows:
6565

66-
```javascript
66+
```javascript title="next.config.js"
6767
import { withJuno } from "@junobuild/nextjs-plugin";
6868

6969
/** @type {import('next').NextConfig} */
@@ -83,7 +83,7 @@ You can use the `container` option to:
8383
- Provide a custom container URL (e.g. for an emulator running on a specific port), or
8484
- Set it to `false` to disable local development behavior entirely.
8585

86-
```javascript title="next.config.mjs"
86+
```javascript title="next.config.js"
8787
import { withJuno } from "@junobuild/nextjs-plugin";
8888

8989
/** @type {import('next').NextConfig} */

docs/setup-the-sdk.mdx

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,43 @@ It is generally recommended to initialize globally the library at the top of you
5353

5454
## Configuration
5555

56-
To connect your application with a container (your Satellite) and other necessary resources, some configuration is required. This setup ensures your application can securely access and initialize the correct Satellite instance, environment variables, and key settings.
56+
Juno uses a configuration file to determine which Satellite to connect to. Scaffold a minimal config file using:
5757

58-
For most developers, the [Next.js](reference/plugins.mdx#nextjs-plugin) or [Vite](reference/plugins.mdx#vite-plugin) plugins streamline this process by managing environment variables automatically. However, if you're not using one of these plugins, a bit of manual configuration is needed.
58+
```bash
59+
npx @junobuild/cli init --minimal
60+
```
5961

60-
### Automated
62+
This creates a `juno.config` file — in TypeScript, JavaScript, or JSON depending on your preferences — at the root of your project.
6163

62-
When using the plugins, the configuration handled through a `juno.config` file (TypeScript, JavaScript, or JSON) at your project root is automatically injected within your application. The plugins read the file and automatically load the required information when you build and run your dApp.
64+
From there, if you're using **Next.js** or **Vite**, install the official plugin. It reads your config file and injects environment variables automatically for the SDK — no need to pass anything manually.
6365

64-
Juno's provided templates come preconfigured with these plugins, so you can quickly get started. For details on setting up the plugin yourself, refer to the [Next.js](reference/plugins.mdx#nextjs-plugin) or [Vite](reference/plugins.mdx#vite-plugin) documentation.
66+
- [Next.js Plugin](reference/plugins.mdx#nextjs-plugin)
6567

66-
To scaffold a minimal `juno.config` file, run:
68+
```javascript title="next.config.js"
69+
import { withJuno } from "@junobuild/nextjs-plugin";
6770

68-
```bash
69-
npx @junobuild/cli init --minimal
71+
export default withJuno();
7072
```
7173

72-
### Manually configure your application
74+
- [Vite Plugin](reference/plugins.mdx#vite-plugin)
75+
76+
```javascript title="vite.config.js"
77+
import juno from "@junobuild/vite-plugin";
7378

74-
If you aren't using a plugin, you can still configure your application by providing the `satelliteId` directly. In this case, add or update the following in your configuration file:
79+
export default defineConfig({
80+
plugins: [juno()]
81+
});
82+
```
83+
84+
:::note
85+
86+
The templates already include both the config file and the plugin setup.
87+
88+
:::
89+
90+
#### Not using a plugin?
91+
92+
You can also pass the Satellite ID manually to the SDK, though using the plugins is the preferred approach:
7593

7694
```typescript
7795
import { initSatellite } from "@junobuild/core";
@@ -81,6 +99,4 @@ await initSatellite({
8199
});
82100
```
83101

84-
Replace `your-actual-satellite-id` with your actual ID, available in the [console](https://console.juno.build) on the overview page.
85-
86102
[satellite]: terminology.md#satellite

0 commit comments

Comments
 (0)