Skip to content

Commit c19cad5

Browse files
authored
Merge pull request #2635 from appwrite/bun
2 parents 140bd83 + 6867839 commit c19cad5

21 files changed

Lines changed: 1798 additions & 7835 deletions

.github/workflows/copilot-setup-steps.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ jobs:
1818
contents: read
1919
steps:
2020
- uses: actions/checkout@v5
21-
- name: Use Node.js
22-
uses: actions/setup-node@v6
21+
- name: Setup Bun
22+
uses: oven-sh/setup-bun@v2
2323
with:
24-
node-version: 22
24+
bun-version: 1.3.8
2525

26-
- name: Install pnpm
27-
uses: pnpm/action-setup@v4
2826
- name: Install dependencies
29-
run: pnpm install --frozen-lockfile
27+
run: bun install --frozen-lockfile

.github/workflows/e2e.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,13 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15-
16-
- name: Use Node.js
17-
uses: actions/setup-node@v3
15+
- name: Setup Bun
16+
uses: oven-sh/setup-bun@v2
1817
with:
19-
node-version: 22
20-
21-
- name: Install pnpm
22-
uses: pnpm/action-setup@v4
18+
bun-version: 1.3.8
2319

2420
- name: Install dependencies
25-
run: pnpm install --frozen-lockfile
21+
run: bun install --frozen-lockfile
2622

2723
- name: Cache Playwright browsers
2824
uses: actions/cache@v4
@@ -34,11 +30,10 @@ jobs:
3430
${{ runner.os }}-playwright-
3531
3632
- name: Install Playwright Browsers
37-
if: steps.playwright-cache.outputs.cache-hit != 'true'
38-
run: pnpm exec playwright install --with-deps chromium
33+
run: bunx playwright install --with-deps chromium
3934

4035
- name: E2E Tests
41-
run: pnpm run e2e
36+
run: bun test:e2e
4237
- uses: actions/upload-artifact@v4
4338
if: ${{ !cancelled() }}
4439
with:

.github/workflows/tests.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,25 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
19-
- name: Use Node.js
20-
uses: actions/setup-node@v3
18+
- name: Setup Bun
19+
uses: oven-sh/setup-bun@v2
2120
with:
22-
node-version: 22
23-
24-
- name: Install pnpm
25-
uses: pnpm/action-setup@v4
21+
bun-version: 1.3.8
2622

2723
- name: Audit dependencies
28-
run: pnpm audit --audit-level high
24+
run: bun audit --audit-level high
2925

3026
- name: Install dependencies
31-
run: pnpm install --frozen-lockfile
27+
run: bun install --frozen-lockfile
3228

3329
- name: Svelte Diagnostics
34-
run: pnpm run check
30+
run: bun check
3531

3632
- name: Linter
37-
run: pnpm run lint
33+
run: bun lint
3834

3935
- name: Unit Tests
40-
run: pnpm run test
36+
run: bun test:unit
4137

4238
- name: Build Console
43-
run: pnpm run build
39+
run: bun run build

.gitpod.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
66

77
tasks:
8-
- init: npm install && npm run build
9-
command: npm run dev
8+
- init: bun install && bun run build
9+
command: bun run dev

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Ignore files for PNPM, NPM and YARN
1+
# Ignore files for PNPM, NPM, BUN and YARN
22
pnpm-lock.yaml
33
package-lock.json
44
yarn.lock
5+
bun.lock

AGENTS.md

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,39 @@
22

33
## Repository Overview
44

5-
Appwrite Console is the web-based GUI for the Appwrite backend-as-a-service platform. Single-page application built with **Svelte 5 + SvelteKit 2**, **TypeScript** (not strict mode), **Vite 7**, tested with **Vitest + Playwright**. Package manager: **pnpm 10.15.1**, Node 20+. ~1500 files with extensive component-based architecture.
5+
Appwrite Console is the web-based GUI for the Appwrite backend-as-a-service platform. Single-page application built with
6+
**Svelte 5 + SvelteKit 2**, **TypeScript** (not strict mode), **Vite 7**, tested with **Vitest + Playwright**. Package
7+
manager/runtime: **Bun** (Node 20+ optional for tooling). ~1500 files with extensive component-based architecture.
68

79
## Critical Build & Test Commands
810

911
### Setup (REQUIRED before any commands)
1012

11-
1. **Install pnpm**: `npm install -g corepack && corepack enable && corepack prepare pnpm@10.15.1 --activate`
13+
1. **Install Bun**:
14+
- Linux & macOS: `curl -fsSL https://bun.sh/install | bash`
15+
- Windows: `powershell -c "irm bun.sh/install.ps1 | iex"`
1216
2. **Create .env**: `cp .env.example .env` (configure `PUBLIC_APPWRITE_ENDPOINT` and `PUBLIC_CONSOLE_MODE`)
1317
3. **Configure network access** (if using GitHub Actions or restricted environments):
1418
- Ensure firewall/proxy allows access to: `pkg.pr.new`, `pkg.vc`, `registry.npmjs.org`
15-
- These domains are required for dependencies: `@appwrite.io/console`, `@appwrite.io/pink-icons-svelte`, `@appwrite.io/pink-svelte`
16-
- In GitHub Actions: Use `pnpm/action-setup@v4` which handles registry configuration
19+
- These domains are required for dependencies: `@appwrite.io/console`, `@appwrite.io/pink-icons-svelte`,
20+
`@appwrite.io/pink-svelte`
21+
- In GitHub Actions: Ensure Bun is installed and registry access is configured
1722
- If network errors persist, check proxy settings: `npm config get proxy` and `npm config get https-proxy`
18-
4. **Install dependencies**: `pnpm install --frozen-lockfile` (if pkg.pr.new/pkg.vc fail due to network restrictions, installation may still succeed with cached versions)
23+
4. **Install dependencies**: `bun install --frozen-lockfile` (if pkg.pr.new/pkg.vc fail due to network restrictions,
24+
installation may still succeed with cached versions)
1925

2026
### Development Commands
2127

2228
**Standard workflow**: `check``lint``test``build` (before committing)
2329

24-
- `pnpm run check` - TypeScript/Svelte validation (~30-60s)
25-
- `pnpm run lint` - ESLint check (~10-20s)
26-
- `pnpm run format` - Auto-fix Prettier formatting
27-
- `pnpm run test` - Vitest unit tests with TZ=EST (~10-30s)
28-
- `pnpm run build` - Production build via build.js (~60-120s)
29-
- `pnpm dev` - Dev server on port 3000
30-
- `pnpm run preview` - Preview build on port 4173
31-
- `pnpm run e2e` - Playwright tests (needs `pnpm exec playwright install --with-deps chromium` first, ~120s+)
30+
- `bun run check` - TypeScript/Svelte validation (~30-60s)
31+
- `bun run lint` - ESLint check (~10-20s)
32+
- `bun run format` - Auto-fix Prettier formatting
33+
- `bun run test` - Vitest unit tests with TZ=EST (~10-30s)
34+
- `bun run build` - Production build via build.js (~60-120s)
35+
- `bun run dev` - Dev server on port 3000
36+
- `bun run preview` - Preview build on port 4173
37+
- `bun run e2e` - Playwright tests (needs `bunx playwright install --with-deps chromium` first, ~120s+)
3238

3339
**CI Pipeline** (`.github/workflows/tests.yml`): audit → install → check → lint → test → build
3440

@@ -52,36 +58,42 @@ src/
5258
└── app.html, hooks.{client,server}.ts, service-worker.ts
5359
```
5460

55-
**SvelteKit conventions**: `+page.svelte` (component), `+page.ts` (data loader), `+layout.svelte` (wrapper), `+error.svelte` (errors). Groups like `(console)` organize routes without affecting URLs. Dynamic params: `[param]`.
61+
**SvelteKit conventions**: `+page.svelte` (component), `+page.ts` (data loader), `+layout.svelte` (wrapper),
62+
`+error.svelte` (errors). Groups like `(console)` organize routes without affecting URLs. Dynamic params: `[param]`.
5663

5764
## Key Configuration
5865

59-
**svelte.config.js**: Adapter = static SPA (fallback: index.html), base path `/console`, aliases: `$lib`, `$routes`, `$themes`
60-
**vite.config.ts**: Dev port 3000, Vitest (client=jsdom, server=node), test files: `src/**/*.{test,spec}.{js,ts}`
66+
**svelte.config.js**: Adapter = static SPA (fallback: index.html), base path `/console`, aliases: `$lib`, `$routes`,
67+
`$themes`
68+
**vite.config.ts**: Dev port 3000
6169
**tsconfig.json**: Extends `.svelte-kit/tsconfig.json`, **NOT strict mode** (`strict: false`)
6270
**eslint.config.js**: Flat config (ESLint 9+), many rules disabled (see TODOs)
6371
**.prettierrc**: 4 spaces, single quotes, 100 char width, no trailing commas
6472

6573
## Testing
6674

67-
**Unit (Vitest)**: Tests in `src/lib/helpers/*.test.ts`, run with `TZ=EST` (timezone matters). Setup mocks SvelteKit (`$app/*`) in `vitest-setup-client.ts`.
68-
**E2E (Playwright)**: Tests in `e2e/journeys/*.spec.ts`, needs build+preview on port 4173, retries 3x, timeout 120s, Chromium only.
75+
**Unit (Bun test)**: Tests in `src/lib/helpers/*.test.ts`, run with `TZ=EST` (timezone matters). Setup mocks SvelteKit (
76+
`$app/*`) in `bun-test-setup.ts` via `bunfig.toml`.
77+
**E2E (Playwright)**: Tests in `e2e/journeys/*.spec.ts`, needs build+preview on port 4173, retries 3x, timeout 120s,
78+
Chromium only.
6979

7080
## Common Pitfalls
7181

72-
1. **Blank page in dev**: Disable ad blockers if seeing "Failed to fetch dynamically imported module" (known SvelteKit issue)
82+
1. **Blank page in dev**: Disable ad blockers if seeing "Failed to fetch dynamically imported module" (known SvelteKit
83+
issue)
7384
2. **Network errors on install**:
7485
- pkg.pr.new/pkg.vc deps may fail due to firewall/proxy restrictions
7586
- Check access: `curl -I https://pkg.pr.new` and `curl -I https://pkg.vc`
76-
- Configure proxy if needed: `npm config set proxy http://proxy:port` and `npm config set https-proxy http://proxy:port`
77-
- GitHub Actions: Ensure runner has internet access; use `pnpm/action-setup@v4` action
87+
- Configure proxy if needed: `npm config set proxy http://proxy:port` and
88+
`npm config set https-proxy http://proxy:port`
89+
- GitHub Actions: Ensure runner has internet access and Bun is installed
7890
- Local dev: Often safe to continue with cached versions if network fails
7991
3. **OOM on build**: Set `NODE_OPTIONS=--max_old_space_size=8192` (like Dockerfile does)
80-
4. **Test failures**: Always use `pnpm run test` (sets TZ=EST), not `vitest` directly
81-
5. **TS errors not showing**: Run `pnpm run check` explicitly (dev server doesn't always surface them)
82-
6. **Format vs lint conflicts**: Run `pnpm run format` before `pnpm run lint`
92+
4. **Test failures**: Always use `bun run test` (sets TZ=EST), not `bun test` directly
93+
5. **TS errors not showing**: Run `bun run check` explicitly (dev server doesn't always surface them)
94+
6. **Format vs lint conflicts**: Run `bun run format` before `bun run lint`
8395
7. **E2E timeouts**: Wait 120s for preview server startup, tests auto-retry 3x
84-
8. **Stale build**: Clear `.svelte-kit` if changes not reflected: `rm -rf .svelte-kit && pnpm run build`
96+
8. **Stale build**: Clear `.svelte-kit` if changes not reflected: `rm -rf .svelte-kit && bun run build`
8597

8698
## Code Conventions
8799

@@ -96,28 +108,31 @@ src/
96108

97109
1. Run Appwrite backend locally (see [docs](https://appwrite.io/docs/advanced/self-hosting))
98110
2. Configure `.env` with backend endpoint
99-
3. `pnpm install --frozen-lockfile`
100-
4. `pnpm dev` (hot reload on port 3000)
101-
5. Before commit: `pnpm run check && pnpm run format && pnpm run lint && pnpm run test && pnpm run build`
102-
6. **Take screenshots**: For any UI changes, capture screenshots and include them in the PR description or comments before finalizing
111+
3. `bun install --frozen-lockfile`
112+
4. `bun run dev` (hot reload on port 3000)
113+
5. Before commit: `bun run check && bun run format && bun run lint && bun run test && bun run build`
114+
6. **Take screenshots**: For any UI changes, capture screenshots and include them in the PR description or comments
115+
before finalizing
103116

104117
## Required Pre-Completion Checklist
105118

106-
**CRITICAL**: Before finishing any work or marking a task complete, agents MUST run the following commands in order and ensure all pass:
119+
**CRITICAL**: Before finishing any work or marking a task complete, agents MUST run the following commands in order and
120+
ensure all pass:
107121

108-
1. **`pnpm run format`** - Auto-fix all formatting issues
109-
2. **`pnpm run check`** - Verify TypeScript/Svelte types (must show 0 errors, 0 warnings)
110-
3. **`pnpm run lint`** - Check code style (ignore pre-existing issues in files you didn't modify)
111-
4. **`pnpm run test`** - Run all unit tests (all tests must pass)
112-
5. **`pnpm run build`** - Ensure production build succeeds
122+
1. **`bun run format`** - Auto-fix all formatting issues
123+
2. **`bun run check`** - Verify TypeScript/Svelte types (must show 0 errors, 0 warnings)
124+
3. **`bun run lint`** - Check code style (ignore pre-existing issues in files you didn't modify)
125+
4. **`bun run test`** - Run all unit tests (all tests must pass)
126+
5. **`bun run build`** - Ensure production build succeeds
113127

114128
If any command fails:
115129

116-
- **Format/Lint**: Run `pnpm run format` to auto-fix, then re-check
130+
- **Format/Lint**: Run `bun run format` to auto-fix, then re-check
117131
- **Type errors**: Fix all TypeScript errors in files you modified
118132
- **Test failures**: Fix failing tests or ensure failures are unrelated to your changes
119133
- **Build failures**: Debug and resolve build issues before proceeding
120134

121135
**Never skip these checks** - they are mandatory quality gates before any work is considered complete.
122136

123-
**Trust these instructions** - only search if incomplete/incorrect. See CONTRIBUTING.md for PR conventions. Use `--frozen-lockfile` always. Docker builds: multi-stage, final image is nginx serving static files from `/console` path.
137+
**Trust these instructions** - only search if incomplete/incorrect. See CONTRIBUTING.md for PR conventions. Use
138+
`--frozen-lockfile` always. Docker builds: multi-stage, final image is nginx serving static files from `/console` path.

CONTRIBUTING.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ If you are worried about or don't know where to start, check out the next sectio
4444
git clone https://github.com/appwrite/console.git appwrite-console
4545
```
4646

47-
### 2. Install dependencies with npm
47+
### 2. Install dependencies with Bun
4848

4949
Navigate to the Appwrite Console repository and install dependencies.
5050

5151
```bash
52-
cd appwrite-console && pnpm install
52+
cd appwrite-console && bun install
5353
```
5454

5555
### 3. Install and run Appwrite locally
5656

5757
When you run the Appwrite Console locally, it needs to point to a backend as well. The easiest way to do this is to run an Appwrite instance locally.
5858

59-
Follow the [install instructions](https://appwrite.io/docs/advanced/self-hosting) in the Appwrite docs.
59+
Follow the [installation instructions](https://appwrite.io/docs/advanced/self-hosting) in the Appwrite docs.
6060

6161
### 4. Setup environment variables
6262

@@ -68,7 +68,7 @@ Add a `.env` file by copying the `.env.example` file as a template in the projec
6868
Finally, start a development server:
6969

7070
```bash
71-
pnpm dev
71+
bun dev
7272
```
7373

7474
> **Note**
@@ -77,15 +77,15 @@ pnpm dev
7777
### Build
7878

7979
```bash
80-
pnpm build
80+
bun run build
8181
```
8282

83-
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
83+
> You can preview the built app with `bun run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
8484
8585
### Tests
8686

8787
```bash
88-
pnpm test
88+
bun tests
8989
```
9090

9191
This will run tests in the `tests/` directory.
@@ -95,13 +95,13 @@ This will run tests in the `tests/` directory.
9595
Code should be consistently formatted everywhere. Before committing code, run the code-formatter.
9696

9797
```bash
98-
pnpm run format
98+
bun format
9999
```
100100

101101
### Linter
102102

103103
```bash
104-
pnpm run lint
104+
bun run lint
105105
```
106106

107107
### Diagnostics
@@ -113,7 +113,7 @@ Diagnostic tool that checks for the following:
113113
- TypeScript compiler errors
114114

115115
```bash
116-
pnpm run check
116+
bun check
117117
```
118118

119119
## Submit a Pull Request 🚀
@@ -176,11 +176,11 @@ $ git push origin [name_of_your_new_branch]
176176
Before committing always make sure to run all available tools to improve the codebase:
177177

178178
- Formatter
179-
- `pnpm run format`
179+
- `bun format`
180180
- Tests
181-
- `pnpm test`
181+
- `bun tests`
182182
- Diagnostics
183-
- `pnpm run check`
183+
- `bun check`
184184

185185
### Performance
186186

Dockerfile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
FROM --platform=$BUILDPLATFORM node:20-alpine AS build
1+
FROM --platform=$BUILDPLATFORM oven/bun:alpine AS build
22

33
WORKDIR /app
44

5-
ENV PNPM_HOME="/pnpm"
6-
ENV PATH="$PNPM_HOME:$PATH"
7-
RUN npm i -g corepack@latest
8-
RUN corepack enable
9-
RUN corepack prepare pnpm@10.0.0 --activate
10-
115
ADD ./package.json /app/package.json
12-
ADD ./pnpm-lock.yaml /app/pnpm-lock.yaml
6+
ADD ./bun.lock /app/bun.lock
137

14-
RUN pnpm install --frozen-lockfile
8+
RUN bun install --frozen-lockfile
159

1610
ADD ./build.js /app/build.js
1711
ADD ./tsconfig.json /app/tsconfig.json
@@ -43,7 +37,7 @@ ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
4337
ENV SENTRY_RELEASE=$SENTRY_RELEASE
4438
ENV NODE_OPTIONS=--max_old_space_size=8192
4539

46-
RUN pnpm run build
40+
RUN bun run build
4741

4842
FROM nginx:1.26.3-alpine
4943

build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import kleur from 'kleur';
12
import { fileURLToPath } from 'url';
23
import { build, loadEnv } from 'vite';
3-
import kleur from 'kleur';
44

55
const { bold, yellow } = kleur;
66
const __dirname = fileURLToPath(new URL('.', import.meta.url));

0 commit comments

Comments
 (0)