Skip to content

Commit d448b06

Browse files
feat: review frontend examples for deployment (#578)
* feat: review frontend examples for deployment Signed-off-by: David Dal Busco <david.dalbusco@outlook.com> * 📄 Update LLMs.txt snapshot for PR review --------- Signed-off-by: David Dal Busco <david.dalbusco@outlook.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent f60fb8d commit d448b06

10 files changed

Lines changed: 672 additions & 333 deletions

File tree

.llms-snapshots/llms-full.txt

Lines changed: 441 additions & 188 deletions
Large diffs are not rendered by default.

docs/guides/angular.mdx

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ title: Angular
44
description: Use Juno with Angular
55
toc_min_heading_level: 2
66
toc_max_heading_level: 2
7-
pagination_next: null
8-
pagination_prev: null
97
---
108

119
# Use Juno with Angular
@@ -72,7 +70,7 @@ To initialize your project with the Satellite ID you created, configure it in th
7270

7371
Replace `<DEV_SATELLITE_ID>` with the ID.
7472

75-
```typescript
73+
```javascript
7674
import { defineConfig } from "@junobuild/config";
7775

7876
/** @type {import('@junobuild/config').JunoConfig} */
@@ -171,40 +169,36 @@ you to focus on exploring and customizing your app right away.
171169

172170
---
173171

174-
## Hosting
175-
176-
If you already have an [Angular](https://angular.dev/) app, you're all set — proceed to the [Deployment](#deployment) section to upload your project to production.
177-
178-
Otherwise, you can bootstrap a new website using the Juno template by running the following command:
179-
180-
<Bash
181-
npm="npm create juno@latest -- --template angular-starter"
182-
yarn="yarn create juno -- --template angular-starter"
183-
pnpm="pnpm create juno -- --template angular-starter"
184-
/>
185-
186-
Once you’re set up, continue to the [Deployment](#deployment) section below.
187-
188-
---
189-
190172
## Deployment
191173

192-
Use this guide to deploy your project to production — directly to a satellite on mainnet.
174+
Use this guide to deploy your project to production.
193175

194-
:::note
176+
import CreateSatellite from "./components/create-satellite.mdx";
195177

196-
When following the steps below, make sure to:
178+
<CreateSatellite index={1} />
197179

198-
1. Register the `satelliteId` in the environment:
199-
When you create the satellite using juno build, a `satelliteId` is generated. This `satelliteId` must be copied into the `src/environments/environment.prod.ts` file.
180+
### 2. Configure your project
200181

201-
2. Configure the dist folder correctly:
202-
In Angular, the build artifacts are not always placed directly under the `dist` folder. Instead, they may be located at `dist/<application-name>` or `dist/<application-name>/browser`. When running `juno config init`, you need to provide the full path to ensure that `juno hosting deploy` works as expected.
182+
Create a `juno.config.mjs` file at the root of your project. Replace the `PROD_SATELLITE_ID` with the ID of the Satellite you created earlier and `dist/<application-name>/browser` with your project's name.
203183

204-
:::
184+
```javascript
185+
import { defineConfig } from "@junobuild/config";
186+
187+
/** @type {import('@junobuild/config').JunoConfig} */
188+
export default defineConfig({
189+
satellite: {
190+
ids: {
191+
development: "<DEV_SATELLITE_ID>",
192+
production: "<PROD_SATELLITE_ID>"
193+
},
194+
source: "dist/<application-name>/browser",
195+
predeploy: ["npm run build"]
196+
}
197+
});
198+
```
205199

206200
import Deploy from "./components/deploy.mdx";
207201

208-
<Deploy index={1} />
202+
<Deploy index={3} />
209203

210204
[satellite]: ../terminology.md#satellite

docs/guides/astro.mdx

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@ description: Learn how to integrate Juno with Astro for seamless development. Fo
55
keywords: [Astro, integrate Juno, quickstart, hosting, CLI, SDK]
66
toc_min_heading_level: 2
77
toc_max_heading_level: 2
8-
pagination_next: null
9-
pagination_prev: null
108
---
119

12-
import Link from "@docusaurus/Link";
13-
1410
# Use Juno with Astro
1511

1612
Easily set up and deploy your Astro project with Juno.
@@ -67,7 +63,7 @@ To initialize the library with the Satellite ID you created, configure it in the
6763

6864
Replace `<DEV_SATELLITE_ID>` with the ID.
6965

70-
```typescript
66+
```javascript
7167
import { defineConfig } from "@junobuild/config";
7268

7369
/** @type {import('@junobuild/config').JunoConfig} */
@@ -77,7 +73,7 @@ export default defineConfig({
7773
development: "<DEV_SATELLITE_ID>",
7874
production: "<PROD_SATELLITE_ID>"
7975
},
80-
source: "out",
76+
source: "dist",
8177
predeploy: ["npm run build"]
8278
}
8379
});
@@ -166,28 +162,36 @@ import WhatsNext from "./components/whats-next.md";
166162
167163
---
168164
169-
## Hosting
165+
## Deployment
170166
171-
If you already have an [Astro](https://astro.build/) app, you're all set — proceed to the [Deployment](#deployment) section to upload your project to production.
167+
Use this guide to deploy and host your project to production.
172168
173-
Otherwise, you can bootstrap a new website using the Juno template by running the following command:
169+
import CreateSatellite from "./components/create-satellite.mdx";
174170
175-
<Bash
176-
npm="npm create juno@latest -- --template astro-starter"
177-
yarn="yarn create juno -- --template astro-starter"
178-
pnpm="pnpm create juno -- --template astro-starter"
179-
/>
171+
<CreateSatellite index={1} />
180172
181-
Once you’re set up, continue to the [Deployment](#deployment) section below.
173+
### 2. Configure your project
182174
183-
---
175+
Create a `juno.config.mjs` file at the root of your project, and replace the `PROD_SATELLITE_ID` with the ID of the Satellite you created earlier.
184176
185-
## Deployment
177+
```javascript
178+
import { defineConfig } from "@junobuild/config";
186179
187-
Use this guide to deploy your project to production — directly to a satellite on mainnet.
180+
/** @type {import('@junobuild/config').JunoConfig} */
181+
export default defineConfig({
182+
satellite: {
183+
ids: {
184+
development: "<DEV_SATELLITE_ID>",
185+
production: "<PROD_SATELLITE_ID>"
186+
},
187+
source: "dist",
188+
predeploy: ["npm run build"]
189+
}
190+
});
191+
```
188192
189193
import Deploy from "./components/deploy.mdx";
190194
191-
<Deploy index={1} />
195+
<Deploy index={3} />
192196
193197
[satellite]: ../terminology.md#satellite

docs/guides/components/choice.mdx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ What would you like to do?
1010

1111
<Link
1212
className="button button--juno"
13-
to="#hosting"
14-
>Hosting</Link>
13+
to="#deployment"
14+
>Deploy</Link>
1515
</div>
16-
17-
:::note[Options]
18-
19-
Choose **Build** if you want to build a full featured rich application.
20-
21-
Choose **Hosting** if you just want to deploy a website.
22-
23-
:::
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export const index = 1;
2+
3+
### {props.index}. Create a container
4+
5+
1. Log in to the [Juno Console](https://console.juno.build).
6+
7+
2. Click the **Launch a new satellite** button (the container for your project) from the launchpad
8+
9+
3. Enter a **name** and select **Website**
10+
11+
4. Confirm with **Create a Satellite**
12+
13+
5. The platform will then provision its resources.
14+
15+
6. Once the process is complete, click Continue to access the overview page.

docs/guides/components/deploy.mdx

Lines changed: 71 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,79 @@
1-
import Link from "@docusaurus/Link";
2-
31
export const index = 1;
42

5-
### {props.index}. Set up a satellite
3+
### {props.index}. How to deploy
4+
5+
You can deploy using either [GitHub Actions](#github-actions-deployment) or [CLI](#cli-deployment) (command line interface).
6+
7+
#### GitHub Actions deployment
8+
9+
1. From your Satellite's overview, navigate to the **Setup** tab.
10+
11+
2. Click on **Add an access key**.
12+
13+
3. Generate a new key with the default option. Click **Submit**.
14+
15+
4. Upon successful creation, a **Secret token** will be displayed. Copy the value and save it as an [encrypted secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in your GitHub repository or organization, using the key `JUNO_TOKEN`.
16+
17+
5. Create a `deploy.yml` file in the `.github/workflows` subfolder of your repo.
18+
19+
6. Add the following workflow configuration:
20+
21+
```yaml title=".github/workflows/deploy.yml"
22+
name: Deploy to Juno
23+
24+
on:
25+
workflow_dispatch:
26+
push:
27+
branches: [main]
28+
29+
jobs:
30+
deploy:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Check out the repo
34+
uses: actions/checkout@v4
35+
36+
- uses: actions/setup-node@v4
37+
with:
38+
node-version: 24
39+
registry-url: "https://registry.npmjs.org"
40+
41+
- name: Install Dependencies
42+
run: npm ci
43+
44+
- name: Deploy to Juno
45+
uses: junobuild/juno-action@main
46+
with:
47+
args: hosting deploy
48+
env:
49+
JUNO_TOKEN: ${{ secrets.JUNO_TOKEN }}
50+
```
51+
52+
#### CLI deployment
53+
54+
1. Install the CLI
55+
56+
import Cli from "./cli.mdx";
57+
58+
<Cli />
59+
60+
2. Authenticate the CLI. This will open the Juno Console.
61+
62+
```bash
63+
juno login
64+
```
665

7-
If you haven't created a satellite yet, go ahead and [create](../../create-a-satellite.mdx) a new one in the Juno's console.
66+
:::tip
867

9-
### {props.index + 1}. Deploy
68+
An access token is used to identify your terminal. That's why the CLI asks whether you want to encrypt it with a password.
69+
For security reasons, it's recommended that you do so.
1070

11-
Once your satellite is up and running, you can proceed with uploading your app.
71+
:::
1272

13-
You can either automate your deployment with GitHub Actions (recommended) or deploy manually from your device. Choose your method:
73+
3. In the browser window, click **Authorize** to grant permission.
1474

15-
<div style={{display: "flex", gap: "1rem", justifyContent: "center", margin: "2rem 0 2.45rem"}}>
16-
<Link
17-
className="button button--hero"
18-
to="/docs/guides/github-actions"
19-
>GitHub Actions</Link>
75+
4. Deploy your site:
2076

21-
<Link
22-
className="button button--juno"
23-
to="/docs/guides/manual-deployment"
24-
>Manual</Link>
25-
</div>
77+
```bash
78+
juno hosting deploy
79+
```

docs/guides/nextjs.mdx

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ description: Learn how to integrate Juno with Next.js. Follow our quickstart gui
55
keywords: [Juno, Next.js, integration, quickstart, guide, examples, hosting]
66
toc_min_heading_level: 2
77
toc_max_heading_level: 2
8-
pagination_next: null
9-
pagination_prev: null
108
---
119

1210
# Use Juno with Next.js
@@ -73,7 +71,7 @@ To initialize the library with the Satellite ID you created, configure it in the
7371

7472
Replace `<DEV_SATELLITE_ID>` with the ID.
7573

76-
```typescript
74+
```javascript
7775
import { defineConfig } from "@junobuild/config";
7876

7977
/** @type {import('@junobuild/config').JunoConfig} */
@@ -175,32 +173,22 @@ you to focus on exploring and customizing your app right away.
175173

176174
---
177175

178-
## Hosting
179-
180-
If you already have an [Next.js](https://nextjs.org/) app, you're all set — proceed to the [Deployment](#deployment) section to upload your project to production.
181-
182-
Otherwise, you can bootstrap a new website using the Juno template by running the following command:
183-
184-
<Bash
185-
npm="npm create juno@latest -- --template nextjs-starter"
186-
yarn="yarn create juno -- --template nextjs-starter"
187-
pnpm="pnpm create juno -- --template nextjs-starter"
188-
/>
189-
190-
Once you’re set up, continue to the [Deployment](#deployment) section below.
191-
192-
---
193-
194176
## Deployment
195177

196-
Use this guide to deploy your project to production — directly to a satellite on mainnet.
178+
Use this guide to deploy and host your project to production.
197179

198180
### 1. Static exports
199181

200182
The Internet Computer, including Juno, currently does not support Server Side Rendering (_without workaround_). Therefore, it is recommended to generate a pre-rendered or client-side-only frontend application.
201183

202184
We suggest using the [static exports](https://nextjs.org/docs/pages/building-your-application/deploying/static-exports) option from Next.js.
203185

186+
:::note
187+
188+
If you’re using the official Juno [Next.js plugin](../reference/plugins.mdx#nextjs-plugin), static exports are already configured for you.
189+
190+
:::
191+
204192
In `next.config.js` file:
205193

206194
```javascript title="next.config.js"
@@ -212,8 +200,32 @@ const nextConfig = {
212200
module.exports = nextConfig;
213201
```
214202

203+
import CreateSatellite from "./components/create-satellite.mdx";
204+
205+
<CreateSatellite index={2} />
206+
207+
### 3. Configure your project
208+
209+
Create a `juno.config.mjs` file at the root of your project, and replace the `PROD_SATELLITE_ID` with the ID of the Satellite you created earlier.
210+
211+
```javascript
212+
import { defineConfig } from "@junobuild/config";
213+
214+
/** @type {import('@junobuild/config').JunoConfig} */
215+
export default defineConfig({
216+
satellite: {
217+
ids: {
218+
development: "<DEV_SATELLITE_ID>",
219+
production: "<PROD_SATELLITE_ID>"
220+
},
221+
source: "out",
222+
predeploy: ["npm run build"]
223+
}
224+
});
225+
```
226+
215227
import Deploy from "./components/deploy.mdx";
216228

217-
<Deploy index={2} />
229+
<Deploy index={4} />
218230

219231
[satellite]: ../terminology.md#satellite

0 commit comments

Comments
 (0)