create-usebecky 0.0.0-stage → 0.2.0
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.
- package/README.md +80 -2
- package/dist/create.js +842 -0
- package/dist/extension-skill/usebecky-extension/SKILL.md +181 -0
- package/dist/extension-skill/usebecky-extension/references/accounts.md +125 -0
- package/dist/extension-skill/usebecky-extension/references/dev-server.md +102 -0
- package/dist/extension-skill/usebecky-extension/references/manifest.md +104 -0
- package/dist/extension-skill/usebecky-extension/references/oauth-and-tokens.md +179 -0
- package/dist/extension-skill/usebecky-extension/references/partner-api.md +87 -0
- package/dist/extension-skill/usebecky-extension/references/submit-and-pricing.md +31 -0
- package/dist/extension-skill/usebecky-extension/references/ui.md +172 -0
- package/dist/extension-skill/usebecky-extension/references/webhooks.md +97 -0
- package/dist/index.js +10 -0
- package/dist/keys.js +72 -0
- package/dist/platform.js +104 -0
- package/dist/pm.js +69 -0
- package/dist/prompts.js +242 -0
- package/dist/scaffold.js +108 -0
- package/dist/setup.js +130 -0
- package/dist/shared/ai.js +203 -0
- package/dist/shared/extension-skill.js +107 -0
- package/dist/shared/framework.js +460 -0
- package/dist/shared/hosted.js +8 -0
- package/dist/shared/ui.js +141 -0
- package/dist/skill/usebecky/SKILL.md +339 -0
- package/dist/skill/usebecky/references/access-rules.md +307 -0
- package/dist/skill/usebecky/references/addons.md +68 -0
- package/dist/skill/usebecky/references/analytics.md +166 -0
- package/dist/skill/usebecky/references/android.md +434 -0
- package/dist/skill/usebecky/references/auth.md +379 -0
- package/dist/skill/usebecky/references/cache.md +51 -0
- package/dist/skill/usebecky/references/components.md +127 -0
- package/dist/skill/usebecky/references/emails.md +105 -0
- package/dist/skill/usebecky/references/expo.md +147 -0
- package/dist/skill/usebecky/references/functions.md +99 -0
- package/dist/skill/usebecky/references/hosting.md +119 -0
- package/dist/skill/usebecky/references/http-api.md +233 -0
- package/dist/skill/usebecky/references/ios.md +355 -0
- package/dist/skill/usebecky/references/payments.md +493 -0
- package/dist/skill/usebecky/references/realtime.md +143 -0
- package/dist/skill/usebecky/references/scheduled-jobs.md +82 -0
- package/dist/skill/usebecky/references/sdk.md +838 -0
- package/dist/skill/usebecky/references/storage.md +210 -0
- package/dist/skill/usebecky/references/templates.md +191 -0
- package/dist/skill/usebecky/references/wordpress.md +87 -0
- package/dist/templates.js +74 -0
- package/package.json +37 -4
- package/templates/expo/App.tsx +48 -0
- package/templates/expo/README.md +59 -0
- package/templates/expo/_env.example +4 -0
- package/templates/expo/_gitignore +12 -0
- package/templates/expo/app.json +25 -0
- package/templates/expo/assets/icon.png +0 -0
- package/templates/expo/brand.ts +7 -0
- package/templates/expo/components/Avatar.tsx +75 -0
- package/templates/expo/components/ui.tsx +57 -0
- package/templates/expo/index.ts +4 -0
- package/templates/expo/lib/theme.ts +43 -0
- package/templates/expo/lib/usebecky.ts +15 -0
- package/templates/expo/package.json +29 -0
- package/templates/expo/screens/Home.tsx +187 -0
- package/templates/expo/screens/SignIn.tsx +112 -0
- package/templates/expo/tsconfig.json +6 -0
- package/templates/expo/usebecky.template.json +36 -0
- package/templates/extension/README.md +128 -0
- package/templates/extension/_env.example +21 -0
- package/templates/extension/_gitignore +11 -0
- package/templates/extension/logo.svg +1 -0
- package/templates/extension/package.json +25 -0
- package/templates/extension/src/accounts.ts +90 -0
- package/templates/extension/src/app.ts +178 -0
- package/templates/extension/src/pages.ts +108 -0
- package/templates/extension/src/replay-guard.ts +17 -0
- package/templates/extension/src/server.ts +57 -0
- package/templates/extension/src/settings.ts +69 -0
- package/templates/extension/src/ui.ts +70 -0
- package/templates/extension/test/app.test.ts +222 -0
- package/templates/extension/tsconfig.json +16 -0
- package/templates/extension/usebecky-extension.json +36 -0
- package/templates/extension/usebecky.template.json +22 -0
- package/templates/landing/README.md +43 -0
- package/templates/landing/_env.example +4 -0
- package/templates/landing/_gitignore +9 -0
- package/templates/landing/index.html +16 -0
- package/templates/landing/package.json +28 -0
- package/templates/landing/public/icon.svg +1 -0
- package/templates/landing/src/App.tsx +97 -0
- package/templates/landing/src/components/Contact.tsx +43 -0
- package/templates/landing/src/components/Counter.tsx +34 -0
- package/templates/landing/src/components/Feedback.tsx +36 -0
- package/templates/landing/src/components/Logo.tsx +11 -0
- package/templates/landing/src/components/Receipt.tsx +128 -0
- package/templates/landing/src/components/Setup.tsx +20 -0
- package/templates/landing/src/components/fields.tsx +63 -0
- package/templates/landing/src/content.ts +22 -0
- package/templates/landing/src/index.css +119 -0
- package/templates/landing/src/lib/usebecky.ts +11 -0
- package/templates/landing/src/lib/waitlist.ts +46 -0
- package/templates/landing/src/main.tsx +12 -0
- package/templates/landing/src/vite-env.d.ts +6 -0
- package/templates/landing/tsconfig.json +19 -0
- package/templates/landing/usebecky.template.json +20 -0
- package/templates/landing/vite.config.ts +10 -0
- package/templates/notes/README.md +68 -0
- package/templates/notes/_env.example +4 -0
- package/templates/notes/_gitignore +9 -0
- package/templates/notes/index.html +15 -0
- package/templates/notes/package.json +28 -0
- package/templates/notes/public/icon.svg +1 -0
- package/templates/notes/src/App.tsx +35 -0
- package/templates/notes/src/brand.ts +7 -0
- package/templates/notes/src/components/Composer.tsx +113 -0
- package/templates/notes/src/components/NoteEntry.tsx +151 -0
- package/templates/notes/src/components/Notes.tsx +163 -0
- package/templates/notes/src/components/Setup.tsx +44 -0
- package/templates/notes/src/components/SignIn.tsx +112 -0
- package/templates/notes/src/components/icons.tsx +54 -0
- package/templates/notes/src/index.css +105 -0
- package/templates/notes/src/lib/notes.ts +68 -0
- package/templates/notes/src/lib/usebecky.ts +9 -0
- package/templates/notes/src/main.tsx +22 -0
- package/templates/notes/src/vite-env.d.ts +6 -0
- package/templates/notes/tsconfig.json +19 -0
- package/templates/notes/usebecky.template.json +34 -0
- package/templates/notes/vite.config.ts +10 -0
- package/templates/saas/README.md +69 -0
- package/templates/saas/_env.example +10 -0
- package/templates/saas/_gitignore +11 -0
- package/templates/saas/app/(app)/account/ManageBilling.tsx +26 -0
- package/templates/saas/app/(app)/account/page.tsx +71 -0
- package/templates/saas/app/(app)/dashboard/Projects.tsx +227 -0
- package/templates/saas/app/(app)/dashboard/page.tsx +21 -0
- package/templates/saas/app/(app)/layout.tsx +29 -0
- package/templates/saas/app/(app)/premium/page.tsx +62 -0
- package/templates/saas/app/auth/callback/page.tsx +33 -0
- package/templates/saas/app/globals.css +143 -0
- package/templates/saas/app/icon.svg +1 -0
- package/templates/saas/app/layout.tsx +20 -0
- package/templates/saas/app/page.tsx +87 -0
- package/templates/saas/app/pricing/Plans.tsx +133 -0
- package/templates/saas/app/pricing/TestCardHint.tsx +18 -0
- package/templates/saas/app/pricing/page.tsx +21 -0
- package/templates/saas/app/setup/page.tsx +34 -0
- package/templates/saas/app/sign-in/SignInForm.tsx +195 -0
- package/templates/saas/app/sign-in/page.tsx +21 -0
- package/templates/saas/brand.ts +10 -0
- package/templates/saas/components/AppNav.tsx +45 -0
- package/templates/saas/components/Logo.tsx +22 -0
- package/templates/saas/components/SiteHeader.tsx +50 -0
- package/templates/saas/components/Status.tsx +15 -0
- package/templates/saas/lib/session.ts +26 -0
- package/templates/saas/lib/usebecky.ts +11 -0
- package/templates/saas/next-env.d.ts +5 -0
- package/templates/saas/next.config.ts +5 -0
- package/templates/saas/package.json +26 -0
- package/templates/saas/postcss.config.mjs +3 -0
- package/templates/saas/tsconfig.json +21 -0
- package/templates/saas/usebecky.template.json +31 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: usebecky
|
|
3
|
+
description: "Use when building or changing backend features in an app that uses usebecky (hosted Postgres backend): web and Node apps with the `usebecky` npm package, Expo / React Native, native iOS (Swift) and Android (Kotlin) apps, or any stack over HTTP. Covers setup, auth, sign in, login, users, database tables and queries, access rules (RLS policies), storage and uploads, realtime, payments with Stripe subscriptions or one-time purchases, webhooks, push notifications, forms, newsletter, emails, scheduled jobs, functions (your own server code), hosting and deploying the app, and website visitor analytics (page views, events, goals). Load it before writing any usebecky code, SQL policy or API call, even when the request only says backend."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# usebecky
|
|
7
|
+
|
|
8
|
+
usebecky is a hosted backend: Postgres with an instant REST API, auth, file storage, realtime, Stripe payments, push notifications, forms, newsletter and emails. Pick the SDK by the app you are in:
|
|
9
|
+
|
|
10
|
+
| App (how to recognise it) | SDK | Read |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| Web, Node server, Expo / React Native (`package.json`) | npm package `usebecky`: `createClient()` from `usebecky` for browser, app and edge code (exported as `baas`); `baas` or `createServerClient()` from `usebecky/server` for Node servers | this file, `references/sdk.md` (Expo: `references/expo.md`) |
|
|
13
|
+
| iOS / macOS (`*.xcodeproj`, `*.xcworkspace`, `Package.swift`) | Swift package `UseBecky` | `references/ios.md` first |
|
|
14
|
+
| Android / Kotlin (`settings.gradle(.kts)`, `build.gradle(.kts)`) | Kotlin SDK `com.usebecky:usebecky-kotlin` | `references/android.md` first |
|
|
15
|
+
| Any other stack (Python, Go, PHP, Ruby, ...) | plain HTTP | `references/http-api.md` |
|
|
16
|
+
|
|
17
|
+
In native Swift or Kotlin apps, read `references/ios.md` or `references/android.md` first and never add npm packages or JavaScript. Sections 1, 3, 5 and 6 show the JavaScript SDK; the key rules (section 2), access rules (section 4) and dashboard steps apply to every platform.
|
|
18
|
+
|
|
19
|
+
How the JavaScript samples are written (all compile as shown): the browser client is the `baas` export of `src/lib/usebecky.ts` (`lib/usebecky.ts` without a `src/` folder), created by `npx usebecky init`; samples import it as `import { baas } from './lib/usebecky'`, the path from a file directly inside `src/` (`'../lib/usebecky'` from `src/components/`, `'@/lib/usebecky'` in Next.js). Server samples use `import { baas } from 'usebecky/server'` (secret key: server code only). A first line like `// src/Notes.tsx` names the file. A sample that starts with `// inside your component:`, `// inside an async function:`, `// inside your JSX:` or `// inside an Express route handler:` is a fragment for that spot (the route handler has `req`, `res` and the server `baas`).
|
|
20
|
+
|
|
21
|
+
It looks like Supabase, but the API differs. Use only the calls in this skill and its references. Do not write supabase-js code:
|
|
22
|
+
|
|
23
|
+
| Do not write (supabase-js) | Write (usebecky) |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `auth.signInWithPassword({ email, password })` | `auth.signIn({ email, password })` |
|
|
26
|
+
| `auth.signInWithOAuth({ provider: 'google' })` | `auth.signInWith('google', { redirectTo })` |
|
|
27
|
+
| `auth.signInWithOtp` / `auth.verifyOtp` | `auth.sendMagicLink(email, { createUser: true })` / `auth.verifyCode(email, code)` |
|
|
28
|
+
| `auth.resetPasswordForEmail(email)` | `auth.resetPassword(email, { redirectTo })` |
|
|
29
|
+
| `supabase.channel(x).on('postgres_changes', ...)` | `realtime.subscribe(table, { event, filter }, callback)` |
|
|
30
|
+
| `SUPABASE_URL`, anon key, service role key | `*USEBECKY_URL`, publishable key `ub_pk_...`, secret key `ub_sk_...` |
|
|
31
|
+
| `createServerClient` from `@supabase/ssr` with cookie adapters | `baas.auth.getUser(req)` and `baas.as(req)` from `usebecky/server` |
|
|
32
|
+
|
|
33
|
+
## 0. Check the project is connected
|
|
34
|
+
|
|
35
|
+
JavaScript (web, Node, Expo):
|
|
36
|
+
|
|
37
|
+
1. `package.json` lists `usebecky`. If not: `npm install usebecky` (Expo: `npx expo install usebecky`; ready-made components: `npm install @usebecky/ui`). usebecky is a hosted service: never clone, build or run usebecky itself.
|
|
38
|
+
2. An env file holds the variables in section 1 and a client file exists (`lib/usebecky.ts`, `src/lib/usebecky.ts`). Reuse its `baas` export; never create a second browser client.
|
|
39
|
+
3. If either is missing, ask the user to run `npx usebecky init` (interactive: signs in, picks or creates a project, writes the env file, git-ignores it, creates the client file). Never invent URLs or keys.
|
|
40
|
+
4. `npx usebecky status` checks the link and the key. `npx usebecky types` writes `usebecky.types.ts` (exports `Database`, `Tables<'x'>`, `TablesInsert<'x'>`, `TablesUpdate<'x'>`); rerun it after every schema change and type the clients with `createClient<Database>(...)` / `createServerClient<Database>()`. `npx usebecky analytics` puts the visitor analytics tag in a website's `<head>` (detects the framework; `--dry-run` previews).
|
|
41
|
+
5. Social posts (planning and posting videos): first read `npx usebecky social guide`.
|
|
42
|
+
|
|
43
|
+
Swift (iOS) and Kotlin (Android) apps never use npm:
|
|
44
|
+
|
|
45
|
+
1. Swift: Xcode → File → Add Package Dependencies… → paste `https://github.com/usebecky/usebecky-swift` → Add Package → tick the app target next to **UseBecky**.
|
|
46
|
+
2. Kotlin: `implementation("com.usebecky:usebecky-kotlin:0.2.0")` in `app/build.gradle.kts` (Maven Central) plus the kotlinx.serialization plugin. Details: "Install" in `references/ios.md` / `references/android.md`.
|
|
47
|
+
3. The client takes only the Project URL and the publishable key (Dashboard → Settings → API keys). `npx usebecky init` in the app folder prints the client code with both and writes no files.
|
|
48
|
+
|
|
49
|
+
## 1. Env vars and client file per framework
|
|
50
|
+
|
|
51
|
+
| Framework | File | Browser vars (publishable) | Server-only vars |
|
|
52
|
+
|---|---|---|---|
|
|
53
|
+
| Next.js | `.env.local` | `NEXT_PUBLIC_USEBECKY_URL`, `NEXT_PUBLIC_USEBECKY_PUBLISHABLE_KEY` | `USEBECKY_URL`, `USEBECKY_SECRET_KEY` |
|
|
54
|
+
| Vite (React/Vue/Svelte) | `.env.local` | `VITE_USEBECKY_URL`, `VITE_USEBECKY_PUBLISHABLE_KEY` | none (no server) |
|
|
55
|
+
| Remix | `.env` | `VITE_USEBECKY_URL`, `VITE_USEBECKY_PUBLISHABLE_KEY` | `USEBECKY_URL`, `USEBECKY_SECRET_KEY` |
|
|
56
|
+
| SvelteKit | `.env` | `PUBLIC_USEBECKY_URL`, `PUBLIC_USEBECKY_PUBLISHABLE_KEY` | `USEBECKY_URL`, `USEBECKY_SECRET_KEY` |
|
|
57
|
+
| Nuxt | `.env` | `NUXT_PUBLIC_USEBECKY_URL`, `NUXT_PUBLIC_USEBECKY_PUBLISHABLE_KEY` | `USEBECKY_URL`, `USEBECKY_SECRET_KEY` |
|
|
58
|
+
| Expo / React Native | `.env` | `EXPO_PUBLIC_USEBECKY_URL`, `EXPO_PUBLIC_USEBECKY_PUBLISHABLE_KEY` | none |
|
|
59
|
+
| Express / Node / Hono | `.env` | none | `USEBECKY_URL`, `USEBECKY_PUBLISHABLE_KEY`, `USEBECKY_SECRET_KEY` |
|
|
60
|
+
|
|
61
|
+
Any server that receives webhooks also needs `USEBECKY_WEBHOOK_SECRET` (`whsec_...`, Dashboard → Settings → Webhooks).
|
|
62
|
+
|
|
63
|
+
Projects with a live custom domain (Pro/Business, Dashboard → Settings → Custom domain) use it as the `*USEBECKY_URL` value, like `https://api.myapp.com`; nothing else changes (same keys, same paths, sessions survive the switch). Only that project's keys work on it (`401 wrong_project_for_domain`).
|
|
64
|
+
|
|
65
|
+
The client file `init` writes, one per framework (each is the whole file):
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
// src/lib/usebecky.ts (Vite, Remix): pass the import.meta.env values; createClient() cannot read them
|
|
69
|
+
import { createClient } from 'usebecky'
|
|
70
|
+
|
|
71
|
+
export const baas = createClient(import.meta.env.VITE_USEBECKY_URL, import.meta.env.VITE_USEBECKY_PUBLISHABLE_KEY)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
// lib/usebecky.ts (Next.js, for 'use client' components; src/lib/usebecky.ts with a src/ folder). createClient() with no arguments also reads these.
|
|
76
|
+
import { createClient } from 'usebecky'
|
|
77
|
+
|
|
78
|
+
export const baas = createClient(process.env.NEXT_PUBLIC_USEBECKY_URL!, process.env.NEXT_PUBLIC_USEBECKY_PUBLISHABLE_KEY!)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
// src/lib/usebecky.ts (SvelteKit)
|
|
83
|
+
import { createClient } from 'usebecky'
|
|
84
|
+
import { PUBLIC_USEBECKY_URL, PUBLIC_USEBECKY_PUBLISHABLE_KEY } from '$env/static/public'
|
|
85
|
+
|
|
86
|
+
export const baas = createClient(PUBLIC_USEBECKY_URL, PUBLIC_USEBECKY_PUBLISHABLE_KEY)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
// lib/usebecky.ts (Expo): keep sessions in AsyncStorage; there is no browser URL to read redirects from (more: references/expo.md)
|
|
91
|
+
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
92
|
+
import { createClient } from 'usebecky'
|
|
93
|
+
|
|
94
|
+
export const baas = createClient(process.env.EXPO_PUBLIC_USEBECKY_URL!, process.env.EXPO_PUBLIC_USEBECKY_PUBLISHABLE_KEY!, { storage: AsyncStorage, detectSessionInUrl: false })
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Nuxt: `init` writes `lib/usebecky.ts` with `useBecky()`, which reads `useRuntimeConfig().public.usebeckyUrl` / `.usebeckyPublishableKey` (declare both in `nuxt.config` `runtimeConfig.public`); call `const baas = useBecky()` in `<script setup>`.
|
|
98
|
+
|
|
99
|
+
Server code (route handlers, server actions, API servers, webhooks, scripts) never uses the browser client:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
// Server code only: the server client uses the secret key.
|
|
103
|
+
import { baas } from 'usebecky/server' // reads USEBECKY_URL + USEBECKY_SECRET_KEY on first use, never at import
|
|
104
|
+
// Typed or explicit (SvelteKit: import the values from '$env/static/private'):
|
|
105
|
+
import { createServerClient } from 'usebecky/server'
|
|
106
|
+
import type { Database } from './usebecky.types'
|
|
107
|
+
|
|
108
|
+
export const server = createServerClient<Database>({ url: process.env.USEBECKY_URL, secretKey: process.env.USEBECKY_SECRET_KEY })
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Restart the dev server after editing env files. Node does not read `.env` by itself: `node --env-file=.env server.js`.
|
|
112
|
+
|
|
113
|
+
## 2. Client vs server: hard rules
|
|
114
|
+
|
|
115
|
+
- Publishable key `ub_pk_<ref>_...`: role `anon`, or `authenticated` once a user signs in. Safe in browsers and apps; RLS policies limit everything it can do.
|
|
116
|
+
- Secret key `ub_sk_<ref>_...`: role `service_role`, bypasses every RLS policy, unlocks admin endpoints.
|
|
117
|
+
- NEVER ship the secret key: not in browser or app code (Swift, Kotlin, Expo, React Native), not in a `NEXT_PUBLIC_`, `VITE_`, `PUBLIC_`, `NUXT_PUBLIC_` or `EXPO_PUBLIC_` variable, not in a `'use client'` file, not in git, never as an argument to `createClient()`. If it leaked, tell the user to roll it in Dashboard → Settings → API keys.
|
|
118
|
+
- Enforce access in RLS policies (and server checks), never only in the UI.
|
|
119
|
+
|
|
120
|
+
| Code runs in | Use | Acts as | RLS |
|
|
121
|
+
|---|---|---|---|
|
|
122
|
+
| Browser / mobile | `baas` from `createClient` | `anon`, or the signed-in user | applies |
|
|
123
|
+
| Server, handling a request | `baas.as(req)` from `usebecky/server` | the requesting user; without one: `anon` if a publishable key is set (`USEBECKY_PUBLISHABLE_KEY` or `NEXT_PUBLIC_...`), else queries return `not_signed_in` | applies |
|
|
124
|
+
| Server, trusted job (webhook, cron, admin tool) | `baas.admin` | `service_role` | bypassed |
|
|
125
|
+
|
|
126
|
+
Reach for `baas.as(req)` first. Use `baas.admin` only after you have checked who is calling, and never to work around a missing policy.
|
|
127
|
+
|
|
128
|
+
The browser client mirrors the access token into a `ub-access-token` cookie, so same-origin requests to your own server identify the user automatically. For cross-origin APIs send `Authorization: Bearer <token>` with `baas.auth.getSession().data.session?.access_token`.
|
|
129
|
+
|
|
130
|
+
## 3. Core API (JavaScript) and errors per platform
|
|
131
|
+
|
|
132
|
+
- JavaScript: every call resolves to `{ data, error }` and never throws for API or network errors (no try/catch). Database calls also return `count` and `status`. Check `error` before using `data`. Full signatures and example return data: `references/sdk.md`.
|
|
133
|
+
- Swift: every call is `try await` and throws `UseBeckyError` (`code`, `message`, `hint`, `status`). Always wrap calls in `do { ... } catch { ... }` (`references/ios.md`).
|
|
134
|
+
- Kotlin: every call is a `suspend` function that throws `UseBeckyException` (same fields). Always wrap calls in `try { ... } catch (e: UseBeckyException) { ... }` (`references/android.md`).
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
// inside an async function:
|
|
138
|
+
const email = 'ada@example.com'
|
|
139
|
+
const password = 'a-long-password'
|
|
140
|
+
const id = '6f1c2a1e-8a43-4c6e-9d55-0b6b1c9e7a10' // a note's id
|
|
141
|
+
|
|
142
|
+
// Auth
|
|
143
|
+
await baas.auth.signUp({ email, password, data: { name: 'Ada' } }) // data: { user, session } (session null when email confirmation is on)
|
|
144
|
+
await baas.auth.signIn({ email, password }) // data: { user, session, mfaRequired? }
|
|
145
|
+
await baas.auth.signInWith('google', { redirectTo: `${location.origin}/app` }) // redirects; or 'github' | 'apple'
|
|
146
|
+
await baas.auth.sendMagicLink(email, { createUser: true }) // data: {}; emails a link and a 6-digit code
|
|
147
|
+
await baas.auth.verifyCode(email, '123456') // data: { user, session }
|
|
148
|
+
await baas.auth.signOut() // { data: null, error }
|
|
149
|
+
const session = baas.auth.getSession().data.session // sync, from memory; null when signed out
|
|
150
|
+
const stop = baas.auth.onAuthStateChange((event, session) => {}) // INITIAL_SESSION first, then SIGNED_IN, SIGNED_OUT, ...; stop() unsubscribes
|
|
151
|
+
|
|
152
|
+
// Database (PostgREST-style builder; await it)
|
|
153
|
+
const { data, error, count } = await baas.from('notes').select('id, title, created_at', { count: 'exact' })
|
|
154
|
+
.eq('archived', false).order('created_at', { ascending: false }).range(0, 19)
|
|
155
|
+
const { data: note } = await baas.from('notes').insert({ title: 'Groceries' }).select().single() // without .select(), data is null
|
|
156
|
+
await baas.from('notes').update({ title: 'Shopping' }).eq('id', id) // update/delete without a filter fails: filter_required
|
|
157
|
+
await baas.from('notes').delete().eq('id', id)
|
|
158
|
+
await baas.from('notes').upsert({ id, title: 'Shopping' }, { onConflict: 'id' })
|
|
159
|
+
const { data: row } = await baas.from('notes').select().eq('id', id).maybeSingle() // null when not found
|
|
160
|
+
await baas.rpc('increment_views', { note_id: id })
|
|
161
|
+
|
|
162
|
+
// Storage (user files live under `${userId}/`)
|
|
163
|
+
const userId = session!.user.id // signed in
|
|
164
|
+
const file = document.querySelector<HTMLInputElement>('input[type=file]')!.files![0]
|
|
165
|
+
const avatars = baas.storage.from('avatars')
|
|
166
|
+
await avatars.upload(`${userId}/avatar.png`, file, { upsert: true }) // data: { path, fullPath, id }
|
|
167
|
+
avatars.getPublicUrl(`${userId}/avatar.png`).data.publicUrl // public buckets only, no request
|
|
168
|
+
await avatars.createSignedUrl(`${userId}/report.pdf`, 3600) // data: { signedUrl, path } for private files
|
|
169
|
+
|
|
170
|
+
// Realtime (table changes respect RLS; enable realtime on the table first)
|
|
171
|
+
const roomId = 42
|
|
172
|
+
const unsubscribe = baas.realtime.subscribe('messages', { event: 'INSERT', filter: `room_id=eq.${roomId}` }, (change) => {
|
|
173
|
+
console.log(change.event, change.new, change.old, change.commit_timestamp)
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
// Payments (Stripe)
|
|
177
|
+
await baas.payments.checkout('pro_monthly', { successUrl: `${location.origin}/billing?ok=1`, cancelUrl: location.href })
|
|
178
|
+
await baas.payments.portal() // manage plan, cancel, update card
|
|
179
|
+
const { data: isPro } = await baas.payments.hasAccess('pro') // false when signed out
|
|
180
|
+
|
|
181
|
+
// Analytics: OFF per project until the owner turns it on (Dashboard → Analytics → Turn on analytics); nothing is stored while off.
|
|
182
|
+
// Websites: one tag in <head> (run `npx usebecky analytics`, it inserts it): <script defer src="<API URL>/analytics/v1/script.js" data-key="ub_pk_..."></script>
|
|
183
|
+
// Clicks without code: <button data-ub-event="signup_clicked" data-ub-prop-plan="pro">. Script API: usebecky.track(name, props).
|
|
184
|
+
baas.analytics.track('signed_up', { plan: 'free' }) // SDK: never throws; batched; user attached automatically; same visitor as the script
|
|
185
|
+
await baas.forms.submit('contact', { name: 'Ada', email, message: 'Hello!' }) // Forms (Dashboard → Forms): data: { ok, message }; inbox + email, no table needed. Plain HTML can post to /forms/v1/f/<formId>
|
|
186
|
+
await baas.newsletter.subscribe(email, { list: 'weekly', tags: ['footer'] }) // Newsletter (Dashboard → Newsletter): data: { status: 'pending' | 'subscribed', message }
|
|
187
|
+
await baas.push.register({ platform: 'android', token: '<FCM registration token>' }) // Push (after sign-in; web: baas.push.subscribeWebPush(swRegistration)); send from the server: baas.push.send({ userIds, title, body, url })
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Server (Node, secret key; never in browser or app code):
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
// server.ts (Express)
|
|
194
|
+
import express from 'express'
|
|
195
|
+
import { baas } from 'usebecky/server'
|
|
196
|
+
|
|
197
|
+
const app = express()
|
|
198
|
+
app.use(baas.auth.middleware()) // req.user = User | null
|
|
199
|
+
app.get('/api/me', baas.auth.requireUser(), (req, res) => res.json(req.user)) // 401 JSON when signed out
|
|
200
|
+
app.get('/api/notes', async (req, res) => {
|
|
201
|
+
const user = await baas.auth.getUser(req) // User | null; accepts req, Request, await cookies(), headers(), or a token
|
|
202
|
+
const { data: rows } = await baas.as(req).from('notes').select() // as that user: RLS applies
|
|
203
|
+
const allowed = await baas.payments.hasAccess(user, 'pro') // boolean, never throws
|
|
204
|
+
res.json({ rows, allowed })
|
|
205
|
+
})
|
|
206
|
+
app.post('/api/receipt', async (req, res) => {
|
|
207
|
+
// Your own email (receipts, notices); secret key only: references/emails.md
|
|
208
|
+
const { error } = await baas.emails.send({ to: 'ada@example.com', subject: 'Your receipt', text: 'Thanks for your order!' })
|
|
209
|
+
res.status(error ? 500 : 200).json({ error })
|
|
210
|
+
})
|
|
211
|
+
app.listen(3000)
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## 4. Access rules first
|
|
215
|
+
|
|
216
|
+
usebecky turns on Row Level Security automatically for every new table in `public`. A table with RLS and no policy is invisible to the app: reads return `[]`, inserts fail with `permission_denied`, and updates and deletes silently change nothing (no error). For every feature that stores data, work in this order:
|
|
217
|
+
|
|
218
|
+
1. Create the table with an owner column that defaults to the caller: `user_id uuid not null default auth.uid() references auth.users (id) on delete cascade`.
|
|
219
|
+
2. Enable RLS explicitly (harmless when already on).
|
|
220
|
+
3. Add one policy per operation the app performs: `select` and `delete` use `using`, `insert` uses `with check`, `update` uses both. Scope with `to authenticated` (or `to anon, authenticated` for public reads).
|
|
221
|
+
4. Run the SQL (see below), then `npx usebecky types`.
|
|
222
|
+
5. Write the queries. Never send `user_id` from the client; the default and the `with check` handle it.
|
|
223
|
+
6. Verify signed out, as user A and as user B.
|
|
224
|
+
|
|
225
|
+
```sql
|
|
226
|
+
create table public.notes (
|
|
227
|
+
id uuid primary key default gen_random_uuid(),
|
|
228
|
+
user_id uuid not null default auth.uid() references auth.users (id) on delete cascade,
|
|
229
|
+
title text not null,
|
|
230
|
+
body text,
|
|
231
|
+
created_at timestamptz not null default now()
|
|
232
|
+
);
|
|
233
|
+
create index on public.notes (user_id);
|
|
234
|
+
alter table public.notes enable row level security;
|
|
235
|
+
create policy "Users read their own notes" on public.notes for select to authenticated using ((select auth.uid()) = user_id);
|
|
236
|
+
create policy "Users add their own notes" on public.notes for insert to authenticated with check ((select auth.uid()) = user_id);
|
|
237
|
+
create policy "Users update their own notes" on public.notes for update to authenticated using ((select auth.uid()) = user_id) with check ((select auth.uid()) = user_id);
|
|
238
|
+
create policy "Users delete their own notes" on public.notes for delete to authenticated using ((select auth.uid()) = user_id);
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Where SQL runs:
|
|
242
|
+
|
|
243
|
+
- Tables, policies on public tables, functions, indexes: as migrations, run them yourself. `npx usebecky db new notes` creates `usebecky/migrations/<version>_notes.sql`; write the SQL there; `npx usebecky db push --dry-run` checks it, `npx usebecky db push` applies every file the project doesn't have yet (one transaction, as the project owner); then `npx usebecky types`. The user only signs in once (`npx usebecky login`). Changes someone made in the dashboard: `npx usebecky db pull` saves them as a migration first (`push` refuses until then). Never ask the user to paste SQL into the dashboard.
|
|
244
|
+
- Migrations cannot: create policies on `storage.objects`, enable realtime on a table, or create triggers on `auth.users`. No `begin`/`commit` inside a migration file. Buckets with their access presets and realtime tables go in `usebecky/config.json` instead (below).
|
|
245
|
+
- Project settings (auth site URL, redirect URLs, sign-in providers, email confirmation, captcha, email sender, languages and texts, buckets and access presets, realtime tables, analytics on/goals/hosts, payments products and prices) live in `usebecky/config.json`: `npx usebecky config pull` writes it, edit it, `npx usebecky config push --dry-run`, then `npx usebecky config push`. Only what the file names changes; nothing is deleted. Secrets as `"${NAME}"` (value in `.env`). Also `npx usebecky payments mode [live|test]`, `npx usebecky emails domains add <domain>`. Run these yourself; don't send the user to the dashboard for them. CI: a project token (`npx usebecky tokens create "GitHub Actions" --scope db,config`, saved as the CI secret `USEBECKY_ACCESS_TOKEN`) instead of a login; `npx usebecky push -y` releases migrations, config, functions and the site in one step (`push --github` writes the workflow).
|
|
246
|
+
|
|
247
|
+
Policy helpers that exist in every project:
|
|
248
|
+
|
|
249
|
+
- `auth.uid()` the signed-in user's id (uuid, null when signed out); `auth.jwt()` the token claims as jsonb (`->>'aal'`, `->'app_metadata'`); `auth.role()`; `auth.email()`.
|
|
250
|
+
- `billing.has_access('feature')` true when the user has an active, trialing or in-grace subscription, or a paid purchase, whose product key or features include it.
|
|
251
|
+
- `billing.has_purchased('product_key')` true for a paid, unrefunded purchase of that product (or an access-granting subscription to it).
|
|
252
|
+
- `storage.foldername(name)` text[] of folders (`(storage.foldername(name))[1] = auth.uid()::text`), `storage.filename(name)`, `storage.extension(name)`.
|
|
253
|
+
|
|
254
|
+
Recipes (teams, public vs private rows, paid content, admins, files, functions): `references/access-rules.md`.
|
|
255
|
+
|
|
256
|
+
## 5. Recipes
|
|
257
|
+
|
|
258
|
+
Whole-file recipes live in `references/sdk.md` section 16: the current user and Google sign-in in React (`useUser()`), own notes kept live with realtime, a Next.js server component and route handler with `baas.as()`, a paywall policy in SQL, an avatar upload, and receiving usebecky webhooks with `baas.events` (Express: mount `baas.events.handler()` before `express.json()`).
|
|
259
|
+
|
|
260
|
+
Profile rows: you cannot add a trigger on `auth.users`. Upsert the profile after `SIGNED_IN` (`upsert({ id: user.id, ... }, { onConflict: 'id', ignoreDuplicates: true })` with an insert policy `with check (id = auth.uid())`), or create it in a `user.created` webhook with `baas.admin`. Most project templates already have `profiles` filled at sign-up (see `references/templates.md`).
|
|
261
|
+
|
|
262
|
+
## 6. Errors and debugging
|
|
263
|
+
|
|
264
|
+
`error` is a `UseBeckyError` with `code`, `message`, `hint?` and `status`; `error.toJSON()`:
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"code": "permission_denied",
|
|
269
|
+
"message": "An access rule on \"notes\" blocked this insert.",
|
|
270
|
+
"hint": "Add or fix an access rule for insert in Dashboard → Database → Access rules. For per-user rows the usual rule is user_id = auth.uid(), and the row's user_id must be the signed-in user's id.",
|
|
271
|
+
"status": 403
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
`status: 0` means the request never reached usebecky (`network_error`, `timeout`, `aborted`). Branch on `error.code`, show `error.message`, log `error.hint`. Swift's thrown `UseBeckyError` and Kotlin's `UseBeckyException` carry the same codes.
|
|
276
|
+
|
|
277
|
+
| Symptom | Usual cause | Fix |
|
|
278
|
+
|---|---|---|
|
|
279
|
+
| `data` is `[]`, no error | RLS: no SELECT policy for this role, user not signed in where the query runs, or `user_id` does not match | Add or fix the SELECT policy; check the session; never switch to `baas.admin` to hide it |
|
|
280
|
+
| `permission_denied` (403) on insert/upsert/update | No INSERT policy, or a `with check` fails (row's `user_id` is not `auth.uid()`) | Add the policy; let `user_id` default to `auth.uid()` |
|
|
281
|
+
| update/delete: no error, nothing changed | No UPDATE/DELETE policy, or the row is not the user's | Add the policy; chain `.select()` to see which rows changed |
|
|
282
|
+
| `not_single_row` (406) | `.single()` matched 0 or 2+ rows (rows hidden by RLS count as missing) | Filter by id, or use `.maybeSingle()` |
|
|
283
|
+
| `table_not_found` / `column_not_found` | Typo (names are case-sensitive) or SQL not run yet | Read `hint` (suggests the closest name); rerun `npx usebecky types` |
|
|
284
|
+
| `filter_required` (400) | `update()`/`delete()` without a filter | Add `.eq('id', id)` |
|
|
285
|
+
| `not_signed_in` (401) | Call needs a user; server got no token | Sign in first; send the cookie or `Authorization: Bearer` |
|
|
286
|
+
| `invalid_api_key` / `missing_api_key` (401) | Wrong, rolled or missing key | Recopy from Dashboard → Settings → API keys; restart the dev server |
|
|
287
|
+
| `secret_key_required` (403) | Admin call made with the publishable key | Move it to the server (`usebecky/server`) |
|
|
288
|
+
| `realtime_not_enabled` (console warning) | Realtime off for the table | Add the table to `realtime.tables` in `usebecky/config.json` and run `npx usebecky config push`; pass `onError` to handle it |
|
|
289
|
+
| `missing_success_url` (400) | `checkout()` outside a browser without `successUrl` and no dashboard default (browsers default to the current page) | Pass `successUrl` |
|
|
290
|
+
| `invalid_signature` / `stale_signature` | Webhook body parsed before verification, wrong secret, clock skew | Mount the handler before body parsers; check `USEBECKY_WEBHOOK_SECRET` |
|
|
291
|
+
| `rate_limited` (429) | Too many auth attempts or emails | Wait and retry; do not loop |
|
|
292
|
+
| `quota_exceeded` (402) / `plan_required` (402) | A plan limit or a feature the plan doesn't include. For a team limit `details.scope` is `"team"`: `used` is the team's total, with `team_name`, `project_used` and the biggest `projects`. Free is for building and testing: 8 tables per project, 50 MB of files (5 MB per file), 100 monthly active users; live payments work on every plan (usebecky keeps 3% of each sale on Free, nothing on Pro and Business) | Tell the user what stopped (`message`) and that **Settings → Plan & billing** upgrades the team's plan (`details.upgrade_url`); don't work around it (no extra projects: they share the team's limits; no merging tables to dodge the table limit) |
|
|
293
|
+
| `project_paused` (402) | A Free project stayed over a Free limit for 180 days; data is kept | Same: the owner upgrades or deletes what's over, and it resumes at once. A drop to Free never deletes data; a failed renewal keeps the paid plan while Stripe retries |
|
|
294
|
+
| `captcha_required` / `captcha_failed` (400) | Bot protection is on (Dashboard → Auth → Settings) for sign-up, sign-in, magic link, reset, forms or newsletter | Show the Turnstile/hCaptcha widget and pass its token as `captchaToken` (`references/auth.md`) |
|
|
295
|
+
|
|
296
|
+
Plan limits are per team: the plan belongs to the team, and its amounts (database, files, users, requests, emails, function runs, compute time, ...) are added up across all the team's projects, so one busy project leaves less for the others. Caps of one database, function or site (tables, file size, live connections, functions, function time and memory, scheduled jobs, webhooks) are per project. Say "for the team" when you tell the user about a limit.
|
|
297
|
+
|
|
298
|
+
Debug order: (1) log the whole `error`; (2) for empty or denied results, confirm who the caller is (`baas.auth.getSession()` in the browser, `await baas.auth.getUser(req)` on the server); (3) list the table's policies in the SQL editor: `select policyname, cmd, roles, qual, with_check from pg_policies where tablename = 'notes';`; (4) confirm the rows exist in Dashboard → Database → Tables (which bypasses RLS); (5) write the missing policy. Never disable RLS or move a browser query to the secret key to make it work.
|
|
299
|
+
|
|
300
|
+
## 7. Checklist before you finish
|
|
301
|
+
|
|
302
|
+
- [ ] No secret key in browser or app code: search every file for `ub_sk_` (only git-ignored server env files may hold it) and for `SECRET_KEY` in `NEXT_PUBLIC_`/`VITE_`/`PUBLIC_`/`EXPO_PUBLIC_` variables. Swift and Kotlin apps hold only the publishable key.
|
|
303
|
+
- [ ] Every new table has RLS on and a policy for each operation the app performs; tested signed out, as the owner and as another user.
|
|
304
|
+
- [ ] Owner columns default to `auth.uid()`; the client never sends `user_id`; `with check` enforces it.
|
|
305
|
+
- [ ] Errors handled: every JavaScript `{ data, error }` is checked, every Swift call sits in `do/catch`, every Kotlin call in `try/catch`; users see the message.
|
|
306
|
+
- [ ] `.single()` only where exactly one row is guaranteed; `.maybeSingle()` otherwise.
|
|
307
|
+
- [ ] Server routes use `baas.as(req)`; `baas.admin` only in trusted code after an explicit check.
|
|
308
|
+
- [ ] Realtime: enabled for the table, filtered where possible, unsubscribed on cleanup; no secrets on broadcast channels.
|
|
309
|
+
- [ ] Storage: bucket exists, policies exist, user files live under `${user.id}/`.
|
|
310
|
+
- [ ] Payments: `successUrl`/`cancelUrl` passed; access enforced by RLS (`billing.has_access`) or `baas.payments.hasAccess` on the server, not only in the UI.
|
|
311
|
+
- [ ] Webhooks: raw body, `USEBECKY_WEBHOOK_SECRET` set, handlers idempotent by `event.id`.
|
|
312
|
+
- [ ] Ran `npx usebecky types` after schema changes; the project typechecks.
|
|
313
|
+
- [ ] Analytics added? Told the user to turn it on (Dashboard → Analytics → Turn on analytics) and to mention analytics in their privacy policy (ready-to-copy paragraph in the Analytics guide).
|
|
314
|
+
- [ ] Told the user exactly which SQL to run and which dashboard steps remain (enable a sign-in method, realtime, bucket policies, Stripe products, turning on analytics).
|
|
315
|
+
|
|
316
|
+
## 8. Reference files (load when needed)
|
|
317
|
+
|
|
318
|
+
- `references/sdk.md`: every JavaScript function and option with signatures and example return data (browser, server, events, errors, types, forms, newsletter, push notifications), vector search (AI search with `match_documents`), the CLI including `db` migrations.
|
|
319
|
+
- `references/access-rules.md`: SQL policy recipes with `auth.uid()`, `billing.has_access()`, `billing.has_purchased()`, `storage.foldername()`; functions; testing.
|
|
320
|
+
- `references/auth.md`: sign-up, sign-in methods, redirects (PKCE), sessions, MFA, SSR, mobile deep links, native ID-token sign-in (Apple, Google), bot protection (captcha), admin user management.
|
|
321
|
+
- `references/emails.md`: Dashboard → Emails (built-in emails, brand, footer, sender, own domain), email languages (`locale`, `setLocale`, `user_metadata.locale`), sending your own emails from a server (`baas.emails.send` with text, templates, attachments, `sendAt`, `batch`, `get`, `cancel`; secret key only), delivery statuses, blocked addresses, `email.*` events.
|
|
322
|
+
- `references/scheduled-jobs.md`: scheduled jobs (cron: run a database function or call your server on a schedule) and database webhooks; verifying the signed calls; platform API; plan limits.
|
|
323
|
+
- `references/functions.md`: Functions (your own code on usebecky, no server needed): `export default` handler with `ctx.baas`/`ctx.user`/`ctx.env`/`ctx.event`, `baas.functions.invoke()`, CLI `npx usebecky functions new|deploy|secrets set|logs`, triggers (HTTP, events, schedule, database changes), limits.
|
|
324
|
+
- Forms and newsletter: JavaScript `references/sdk.md` (sections 12-13), Swift `references/ios.md`, Kotlin `references/android.md`, any other stack `references/http-api.md`, ready-made UI `references/components.md`.
|
|
325
|
+
- Push notifications: JavaScript and server sending `references/sdk.md` (section 14), Swift `references/ios.md`, Kotlin `references/android.md`, Expo `references/expo.md`.
|
|
326
|
+
- `references/expo.md`: Expo / React Native: install, client with AsyncStorage, deep-link sign-in with the app's scheme (PKCE), Sign in with Apple, push tokens, Stripe return links, testing on a phone.
|
|
327
|
+
- `references/storage.md`: buckets, file policies, uploads, public vs signed URLs, resized images (image transformations).
|
|
328
|
+
- `references/hosting.md`: hosting the user's app (Business): `npx usebecky deploy` per framework (static sites, Node.js apps on `PORT`, Next.js `output`), previews and rollback, env vars and the secret-key switch, own domains, GitHub Actions with a deploy token (never commit it), limits.
|
|
329
|
+
- `references/cache.md`: the built-in cache (Business): faster reads for tables (no code), `baas.cache.get/set/delete/getOrSet/limit` on the server and in Functions, versioned public file links from Cloudflare's edge.
|
|
330
|
+
- `references/realtime.md`: table changes, filters, broadcast, presence, limits.
|
|
331
|
+
- `references/payments.md`: products, prices, checkout, portal, entitlements, paywalls, billing webhooks.
|
|
332
|
+
- `references/http-api.md`: REST and curl for non-JS stacks, webhook signature verification, platform API.
|
|
333
|
+
- `references/templates.md`: what each ready-made setup (project template) creates (tables, policies, buckets, products).
|
|
334
|
+
- `references/analytics.md`: visitor analytics: the website script tag and `npx usebecky analytics`, turning it on, custom events (`data-ub-event`, `usebecky.track`, `baas.analytics.track/page/identify`), goals, funnels, privacy policy and consent, reports from your server (`baas.analytics.overview/report/timeseries`, per hostname), HTTP ingest.
|
|
335
|
+
- `references/ios.md`: native Swift SDK for iOS/macOS apps (install from source, SwiftUI, Codable models, Keychain sessions, Sign in with Apple, Google sign-in with the bundle-ID URL scheme and PKCE, PhotosPicker uploads, realtime streams, push, forms, newsletter, Stripe in Safari View with app-link return, analytics).
|
|
336
|
+
- `references/android.md`: native Android/Kotlin apps with `com.usebecky:usebecky-kotlin`: install from Maven Central, session storage, Compose, Credential Manager Google sign-in, deep-link OAuth with PKCE, Custom Tabs, uploads, realtime, push, forms, newsletter, Stripe with deep-link return, analytics.
|
|
337
|
+
- `references/addons.md`: Redis and MongoDB add-ons (Business, server-only): connection strings, Redis key prefix and blocked commands, MongoDB quota, platform API.
|
|
338
|
+
- `references/components.md`: ready-made UI (`@usebecky/ui` React components and `<ub-...>` Web Components for any site): sign-in, user menu, contact form, newsletter, waitlist, pricing table, checkout, embedded payment form, paywall, file upload. Prefer these over hand-rolled forms unless the user asks for custom UI.
|
|
339
|
+
- `references/wordpress.md`: WordPress sites on usebecky (Hosting for WordPress): the usebecky plugin's blocks and shortcodes (contact form, newsletter, waitlist, pricing table, checkout and portal buttons, paywall), analytics events from themes, WooCommerce purchases, consent, wp_mail() through usebecky, calling usebecky from PHP, and the rules of a managed site (updates, file editor, cache, sign-in).
|