@supabase/lite 0.8.1-next.2 → 0.9.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/FEATURES.md +176 -0
  2. package/LIMITATIONS.md +1 -0
  3. package/README.md +1 -0
  4. package/STATUS.md +7 -1
  5. package/dist/cli/index.js +86 -86
  6. package/dist/db/postgres/pglite/PgliteConnection.js +17 -17
  7. package/dist/index.d.ts +26 -2
  8. package/dist/index.js +55 -55
  9. package/dist/vite/index.d.ts +26 -2
  10. package/docs/auth/email.mdx +214 -0
  11. package/docs/auth/not-supported.mdx +57 -0
  12. package/docs/auth/overview.mdx +52 -0
  13. package/docs/auth/supported-flows.mdx +120 -0
  14. package/docs/cli/overview.mdx +112 -0
  15. package/docs/cli/telemetry.mdx +34 -0
  16. package/docs/compatibility.mdx +115 -0
  17. package/docs/database/backends.mdx +118 -0
  18. package/docs/database/data-api.mdx +90 -0
  19. package/docs/database/functions-triggers.mdx +93 -0
  20. package/docs/database/migrations.mdx +93 -0
  21. package/docs/database/overview.mdx +66 -0
  22. package/docs/database/postgres-sqlite-translation.mdx +130 -0
  23. package/docs/database/rls.mdx +159 -0
  24. package/docs/database/schemas.mdx +58 -0
  25. package/docs/index.mdx +49 -0
  26. package/docs/integrations/embedded.mdx +83 -0
  27. package/docs/integrations/frameworks.mdx +83 -0
  28. package/docs/integrations/vite.mdx +85 -0
  29. package/docs/llms.txt +52 -0
  30. package/docs/other/edge-functions.mdx +34 -0
  31. package/docs/other/realtime.mdx +22 -0
  32. package/docs/quickstart.mdx +150 -0
  33. package/docs/running.mdx +117 -0
  34. package/docs/storage/adapters.mdx +75 -0
  35. package/docs/storage/limitations.mdx +30 -0
  36. package/docs/storage/overview.mdx +82 -0
  37. package/docs/upgrade.mdx +108 -0
  38. package/package.json +4 -1
  39. package/skills/supalite/SKILL.md +5 -3
@@ -0,0 +1,82 @@
1
+ ---
2
+ title: "Storage overview"
3
+ description: "Storage API for @supabase/lite: experimental flag, endpoint coverage, and supabase-js parity."
4
+ ---
5
+
6
+ import { Aside, Card, CardGrid, Steps } from '@astrojs/starlight/components';
7
+
8
+ Supabase Lite ships a Storage API at `/storage/v1/*` covering all 20 endpoints upstream Supabase Storage exposes to `supabase-js`: bucket CRUD, object upload/download/list/remove/move/copy, signed URLs, and image transformations. For the shipped surface, `@supabase/supabase-js`'s `storage` client works unchanged.
9
+
10
+ <Aside type="caution">
11
+ Storage is **experimental** and disabled by default. It is gated behind the `EXPERIMENTAL_STORAGE` environment variable and requires you to wire a storage adapter explicitly. Don't rely on it in production.
12
+ </Aside>
13
+
14
+ ## Enabling it
15
+
16
+ Storage requires three things to be true at once:
17
+
18
+ <Steps>
19
+
20
+ 1. **Set the experimental flag**
21
+
22
+ ```bash
23
+ EXPERIMENTAL_STORAGE=1 lite dev
24
+ ```
25
+
26
+ Without this, `/storage/v1/*` returns 404 and no storage schema is applied, even if `storage.enabled` is set.
27
+
28
+ 1. **Enable storage in config**
29
+
30
+ ```toml
31
+ [storage]
32
+ enabled = true
33
+ file_size_limit = "50MiB"
34
+ ```
35
+
36
+ 1. **Attach a storage adapter**
37
+
38
+ If you construct the `App` programmatically, set an adapter before calling `init()`:
39
+
40
+ ```ts
41
+ import { App } from "@supabase/lite";
42
+ import { FilesystemStorageAdapter } from "@supabase/lite/storage/adapters/FilesystemStorageAdapter";
43
+
44
+ const app = new App({ connection, storage: { enabled: true } });
45
+ app._storageAdapter = new FilesystemStorageAdapter({ basePath: "./supabase/.temp/storage" });
46
+ await app.init();
47
+ ```
48
+
49
+ The `lite` CLI (`lite dev` / `lite start`) auto-wires a `FilesystemStorageAdapter` under `.temp/storage` for you when `EXPERIMENTAL_STORAGE=1` and `storage.enabled` are both set, so CLI users only need steps 1 and 2.
50
+
51
+ </Steps>
52
+
53
+ <Aside type="note">
54
+ The explicit-adapter requirement is a stopgap while storage is experimental. Once stable, an adapter will be required outright (error instead of silent no-op) rather than auto-wired by the CLI. Confirm current behavior against the `EXPERIMENTAL_STORAGE` handling in your installed version if you're embedding the `App` class directly.
55
+ </Aside>
56
+
57
+ ## What's implemented
58
+
59
+ All 20 supabase-js storage methods map to real endpoints: `upload`, `download`, `list`, `remove`, `move`, `copy`, `info`, `exists`, `update`, `getPublicUrl`, `createSignedUrl`, `createSignedUrls`, `createSignedUploadUrl`, `uploadToSignedUrl`, `listBuckets`, `getBucket`, `createBucket`, `updateBucket`, `deleteBucket`, `emptyBucket`.
60
+
61
+ `/storage/v1` is transform-only for API keys, like upstream self-hosted Kong: a missing or invalid `apikey` never 401s at the gateway, so public objects, signed URLs, and S3 presigned flows stay keyless. When a key is present, it resolves to a role — a secret key satisfies storage's own authed routes as `service_role`. See [API keys](/auth/overview#api-keys).
62
+
63
+ ```ts
64
+ const { data, error } = await supabase.storage
65
+ .from("avatars")
66
+ .upload("public/avatar1.png", file);
67
+
68
+ const { data: url } = supabase.storage
69
+ .from("avatars")
70
+ .getPublicUrl("public/avatar1.png");
71
+ ```
72
+
73
+ <CardGrid>
74
+ <Card title="Storage adapters">
75
+ Filesystem, S3-compatible, and image transformation backends, and how to configure each. [Read more →](/storage/adapters/)
76
+ </Card>
77
+ <Card title="Storage limitations">
78
+ What's not implemented yet: RLS on objects, role-based access, TUS uploads, webhooks. [Read more →](/storage/limitations/)
79
+ </Card>
80
+ </CardGrid>
81
+
82
+ For the Storage concepts that behave the same as upstream (bucket/object model, public vs. private buckets, MIME allow-lists), see the [Supabase Storage docs](https://supabase.com/docs/guides/storage).
@@ -0,0 +1,108 @@
1
+ ---
2
+ title: "Upgrading to Supabase"
3
+ description: "Migrate a Supabase Lite project to hosted or local Supabase with lite upgrade."
4
+ ---
5
+
6
+ import { Aside, Tabs, TabItem } from '@astrojs/starlight/components';
7
+
8
+ Supabase Lite is a starting point, not an end state. `lite upgrade` migrates a local Supabase Lite project (schema, `auth.users`/`auth.identities`, application table data, optionally sessions) to a hosted or local Supabase project.
9
+
10
+ <Aside type="caution">
11
+ Storage and Realtime migration are not implemented yet. If either is enabled, the command warns and continues with schema/auth/data migration only.
12
+ </Aside>
13
+
14
+ ## Quick start
15
+
16
+ Hosted Supabase is the default target:
17
+
18
+ ```bash
19
+ lite upgrade
20
+ lite upgrade --target hosted
21
+ ```
22
+
23
+ Rehearse first, with no changes to any target:
24
+
25
+ ```bash
26
+ lite upgrade --dry-run
27
+ ```
28
+
29
+ ```bash
30
+ lite upgrade --dry-run --json # machine-readable output
31
+ ```
32
+
33
+ Skip the interactive confirmation:
34
+
35
+ ```bash
36
+ lite upgrade --force
37
+ ```
38
+
39
+ ## Targets
40
+
41
+ <Tabs>
42
+ <TabItem label="Hosted (default)">
43
+ `--target hosted` creates a new hosted Supabase project through the Supabase Management API, waits for it to become healthy, applies schema/auth/data, fetches API keys, and prints the new project details.
44
+
45
+ ```bash
46
+ lite upgrade \
47
+ --target hosted \
48
+ --org-id <organization-id-or-slug> \
49
+ --region <region-key> \
50
+ --project-name <name> \
51
+ --supabase-token <personal-access-token>
52
+ ```
53
+
54
+ If `--supabase-token` is omitted, `SUPABASE_ACCESS_TOKEN` is used. Missing required values are prompted for interactively. Only `--mode user` is currently supported; `--mode platform` is reserved for future work.
55
+ </TabItem>
56
+ <TabItem label="Local">
57
+ `--target local` upgrades into a local [Supabase CLI](https://supabase.com/docs/guides/local-development) workdir. By default that's the current directory, so the command rewrites `./supabase/config.toml` in place, stripping the Supabase Lite-only `[db].driver`/`[db].url` keys and repointing at the Supabase CLI stack. **This breaks the Supabase Lite dev server until the config is restored.**
58
+
59
+ The original config is backed up first to `./supabase/config.toml.bak`:
60
+
61
+ ```bash
62
+ cp supabase/config.toml.bak supabase/config.toml # or: git checkout supabase/config.toml
63
+ ```
64
+
65
+ Use `--local-dir` to target a separate directory instead and leave the project's own `config.toml` untouched:
66
+
67
+ ```bash
68
+ lite upgrade --target local --local-dir ../my-local-supabase --force --no-migrate-sessions
69
+ ```
70
+
71
+ The local target drives the Supabase CLI via `bunx supabase@2.98.1` (override with `LITE_SUPABASE_CLI`), pins `db.major_version = 15`, enables Studio, and disables services not needed for verification (mailpit, realtime, storage, imgproxy, edge runtime, analytics, supavisor). It leaves the local stack running after a successful upgrade; stop it with `bunx supabase@2.98.1 stop --workdir <dir> --no-backup`.
72
+ </TabItem>
73
+ </Tabs>
74
+
75
+ ## The SQLite-shim audit
76
+
77
+ Every non-dry-run upgrade first runs readiness checks and an in-memory PGlite rehearsal of the generated schema/auth/data SQL, and only proceeds to the real target if that rehearsal succeeds.
78
+
79
+ `--dry-run` runs that readiness/rehearsal phase and stops there: no target is created or changed. Part of readiness is a scan of **SQLite-shim-backed fields**: columns whose SQLite representation depends on an application-layer shim (UUID validation, JSON-domain casts, boolean-as-integer, enum `CHECK` constraints, and similar) rather than a native Postgres type. The audit reports affected column counts, sample raw values, and sample row IDs so you can review anything that needs attention before it's translated into real Postgres data.
80
+
81
+ ```bash
82
+ lite upgrade --dry-run # readiness + rehearsal + shim audit, human-readable
83
+ lite upgrade --dry-run --json # same, as structured JSON
84
+ ```
85
+
86
+ See [Postgres/SQLite translation](/database/postgres-sqlite-translation) for what each shim represents and why it exists.
87
+
88
+ ## What doesn't carry over cleanly
89
+
90
+ - **Storage and Realtime**: not migrated. The command warns and continues.
91
+ - **SQLite-only RLS behavior**: SQLite enforces RLS by rewriting the PostgREST query AST at the application layer (see [RLS](/database/rls)); Postgres uses native RLS. Policies that only work because of the SQLite rewrite (or that hit a [known SQLite RLS limitation](/database/rls)) need re-checking against native Postgres semantics after upgrade.
92
+ - **Unsupported SQLite-side features**: range types, quantified comparisons (`eq(any)`, etc.), `rpc()`, multi-schema access, and full regex all behave differently or not at all on SQLite (see [Compatibility](/compatibility)). Code written around those gaps may now have real Postgres equivalents available and worth adopting.
93
+ - **Sessions**: preserved on hosted targets only, via `--migrate-sessions`, by importing `auth.jwt_secret` as a Supabase HS256 signing key. The local target does not support this yet; users re-authenticate after a local upgrade.
94
+ - **Weak JWT secrets**: session migration is blocked non-interactively unless you pass `--allow-weak-jwt-secret`.
95
+
96
+ ## Session migration
97
+
98
+ ```bash
99
+ lite upgrade --migrate-sessions
100
+ ```
101
+
102
+ If `auth.jwt_secret` is missing, hosted session migration fails and the CLI asks you to rerun with `--no-migrate-sessions`. Without session migration, existing tokens become invalid and users must sign in again.
103
+
104
+ ## Related
105
+
106
+ - [Postgres/SQLite translation](/database/postgres-sqlite-translation): what the shim audit is checking for.
107
+ - [Database backends](/database/backends): running against PGlite/Postgres directly instead of upgrading.
108
+ - Upstream: [Supabase local development](https://supabase.com/docs/guides/local-development) and [Database migrations](https://supabase.com/docs/guides/deployment/database-migrations).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/lite",
3
- "version": "0.8.1-next.2",
3
+ "version": "0.9.1-next.1",
4
4
  "description": "Lightweight TypeScript-native Supabase implementation on SQLite (alpha). PostgREST + GoTrue compatible — use @supabase/supabase-js as-is.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -74,7 +74,9 @@
74
74
  "UPGRADE.md",
75
75
  "LIMITATIONS.md",
76
76
  "PATTERNS.md",
77
+ "FEATURES.md",
77
78
  "skills",
79
+ "docs",
78
80
  "!dist/*.tsbuildinfo",
79
81
  "!dist/*.map",
80
82
  "!dist/**/*.map",
@@ -125,6 +127,7 @@
125
127
  "debug:node": "tsx --watch dev/debug.ts",
126
128
  "cli": "LOCAL=1 bun src/cli/index.ts",
127
129
  "docs:generate": "bun run internal/extract.ts",
130
+ "docs:index": "bun run internal/package-docs.ts",
128
131
  "smoke:pack": "bun run internal/smoke-pack.ts",
129
132
  "prepack": "bun run internal/package-readme.ts prepare",
130
133
  "postpack": "bun run internal/package-readme.ts cleanup",
@@ -7,7 +7,7 @@ description: Use when building or debugging an app that uses `@supabase/lite` (a
7
7
 
8
8
  `@supabase/lite` (a.k.a. supalite) is a lightweight TypeScript implementation of the Supabase REST + Auth APIs over SQLite (with PGlite / Postgres as alternative drivers). `@supabase/supabase-js` works against it unchanged.
9
9
 
10
- The package is pre-1.0 and changes fast. **Do not rely on this skill's specifics — fetch the installed package's docs first.** Authoritative content (limitations, anti-patterns, patterns, full status) ships inside the package and updates with every `npm install`.
10
+ The package is pre-1.0 and changes fast. **Do not rely on this skill's specifics — fetch the installed package's docs first.** Authoritative content (limitations, anti-patterns, patterns, full status) ships inside the package and updates with every `npm install`. The full product documentation ships too, at `node_modules/@supabase/lite/docs/` (MDX, matching the installed version), and is published at https://docs.lite.dev.
11
11
 
12
12
  ## Cold start (do this before writing code)
13
13
 
@@ -15,8 +15,9 @@ The package is pre-1.0 and changes fast. **Do not rely on this skill's specifics
15
15
  2. `cat node_modules/@supabase/lite/LIMITATIONS.md` — agent-facing cheat sheet of what's not supported and what to avoid (anti-patterns). One-line bullets, links into STATUS.md for detail. Read this **first**.
16
16
  3. `cat node_modules/@supabase/lite/PATTERNS.md` — canonical recipes (per-user RLS, embedded filters, custom server logic, Vite cold start, triggers).
17
17
  4. `cat node_modules/@supabase/lite/README.md` — install, quick start, CLI, Vite plugin, project layout.
18
- 5. `cat node_modules/@supabase/lite/STATUS.md` only when you need detail behind a LIMITATIONS bullet, or when planning a feature that touches RLS / embedding / auth.
19
- 6. Pick the right runtime path (see decision rule below) before writing the dev server / client.
18
+ 5. `cat node_modules/@supabase/lite/docs/llms.txt` index of the full product docs (database, auth, storage, integrations, CLI). Read the page for the area you're touching, e.g. `docs/database/rls.mdx`, `docs/integrations/vite.mdx`.
19
+ 6. `cat node_modules/@supabase/lite/STATUS.md` only when you need detail behind a LIMITATIONS bullet, or when planning a feature that touches RLS / embedding / auth.
20
+ 7. Pick the right runtime path (see decision rule below) before writing the dev server / client.
20
21
 
21
22
  ## Decision rule
22
23
 
@@ -34,5 +35,6 @@ The skill deliberately does not duplicate these. They live in the installed pack
34
35
 
35
36
  - **What's limited / what to avoid** → `node_modules/@supabase/lite/LIMITATIONS.md`
36
37
  - **How to do common things** → `node_modules/@supabase/lite/PATTERNS.md`
38
+ - **Per-area product docs** → `node_modules/@supabase/lite/docs/` (index: `llms.txt`), or https://docs.lite.dev
37
39
 
38
40
  Re-read both when starting work on a supalite project, or when the user reports an unexpected behavior — they may already be documented.