create-snagset 0.1.5 → 0.1.7

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/dist/index.js CHANGED
@@ -22,7 +22,8 @@ catch (e) {
22
22
  const name = target.split("/").pop() || "snagset";
23
23
  process.stdout.write(`\n ✓ ${name}\n\n` +
24
24
  ` 1. Put a Postgres URL in .env as DATABASE_URL.\n` +
25
- ` A free Neon or Supabase branch works, so does a local install.\n\n` +
25
+ ` A free Supabase or Neon project works, so does a local install;\n` +
26
+ ` .env says which Supabase string goes where.\n\n` +
26
27
  ` cd ${target}\n` +
27
28
  ` pnpm install && pnpm start\n\n` +
28
29
  ` (npm, yarn and bun work the same way.)\n\n` +
@@ -6,8 +6,11 @@ review for your clients' live sites.
6
6
  ## Run it
7
7
 
8
8
  You need a Postgres and its connection string. A free
9
- [Neon](https://neon.tech) or [Supabase](https://supabase.com) branch takes a
9
+ [Supabase](https://supabase.com) or [Neon](https://neon.tech) project takes a
10
10
  minute and works from anywhere; a local `postgres` install is just as good.
11
+ On Supabase, use the **session pooler** string for `npm start` and the
12
+ **transaction pooler** string on Vercel — the comments in `.env` say which is
13
+ which. On Neon, the pooled string.
11
14
 
12
15
  Put the URL in `.env` as `DATABASE_URL`, then:
13
16
 
@@ -64,21 +67,29 @@ pnpm run env MAIL # just the ones matching MAIL
64
67
  # Node versions) and shadows the script. npm and yarn need no `run`.
65
68
  ```
66
69
 
67
- Screenshots need an S3-compatible bucket (R2, Spaces, MinIO, AWS).
68
- Notifications need a mailer. Both are optional: with no bucket you get
69
- annotation mode and the widget says screenshots are unavailable rather than
70
- offering one that fails; with no mailer, notifications are off and the
71
- dashboard says so.
70
+ Screenshots need an S3-compatible bucket (DigitalOcean Spaces, R2, MinIO,
71
+ AWS). Notifications need a mailer (Resend, or any SMTP). Both are optional:
72
+ with no bucket you get annotation mode and the widget says screenshots are
73
+ unavailable rather than offering one that fails; with no mailer, notifications
74
+ are off and the dashboard says so. `.env` carries a worked example of each,
75
+ and both can also be connected later from Studio › General without a restart.
76
+
77
+ **Row-level security.** Supabase's `postgres` role (and Neon's owner role)
78
+ can bypass the policies the server installs, and the boot log says so if
79
+ yours does. The app scopes every query itself, so that is a lost second
80
+ net rather than a hole; the self-hosting guide has the four-line SQL that
81
+ gives you a role without the bypass.
72
82
 
73
83
  ## Deploy it
74
84
 
75
85
  **Vercel.** `vercel.json` and `api/index.js` are here already. The
76
86
  `rewrites` entry is load-bearing: without it Vercel's filesystem router serves
77
87
  only `/api/index` and 404s `/`, `/snag.js` and the cron's own path. Keep the
78
- file free of comment keys — Vercel's schema rejects them. Add a Postgres
79
- from the marketplace, set `SNAGSET_SECRET_KEY` (required on serverless — the
88
+ file free of comment keys — Vercel's schema rejects them. Set `DATABASE_URL`
89
+ to the **transaction pooler** string (Supabase from the marketplace sets a
90
+ pooled one for you), set `SNAGSET_SECRET_KEY` (required on serverless — the
80
91
  filesystem is ephemeral, so a generated key would differ per instance and
81
- nothing would decrypt), and add a release command:
92
+ nothing would decrypt) and `CRON_SECRET`, and add a build command:
82
93
 
83
94
  ```
84
95
  npx snagset migrate
@@ -1,8 +1,21 @@
1
1
  # ── Required ───────────────────────────────────────────────────────────
2
- # Any Postgres 14+ — a free Neon or Supabase branch, or a local install.
3
- # Use the POOLED connection string where your provider offers one.
4
- # QUOTE IT. A managed provider appends `?sslmode=require&channel_binding=require`,
5
- # and an unquoted `&` ends the line as far as `. .env` is concerned.
2
+ # Any Postgres 14+: Supabase, Neon, RDS, or a local install. A free Supabase
3
+ # or Neon project in a region near your clients takes a minute. Neon's
4
+ # pooled string (the `-pooler` host) is the one to use and needs no notes.
5
+ #
6
+ # WHICH SUPABASE STRING. "Connect" on the project shows three:
7
+ # · Session pooler (…pooler.supabase.com:5432, user postgres.<ref>)
8
+ # — for `npm start`: a Node process on Railway, Render, Fly, a VPS or
9
+ # your laptop. Works over IPv4.
10
+ # · Transaction pooler (…pooler.supabase.com:6543, same user)
11
+ # — for Vercel and other serverless hosts.
12
+ # · Direct (db.<ref>.supabase.co:5432) — IPv6 only unless you pay for the
13
+ # IPv4 add-on. A "network unreachable" at boot usually means this one
14
+ # was pasted on a host without IPv6.
15
+ #
16
+ # TLS is on for any host that is not local (SNAGSET_DATABASE_SSL=auto), so a
17
+ # string with no `?sslmode=` in it is still encrypted. QUOTE IT regardless:
18
+ # a string that does carry `?sslmode=require&…` ends a shell line at the `&`.
6
19
  DATABASE_URL="postgres://snagset:snagset@localhost:5432/snagset"
7
20
 
8
21
  # ── Strongly recommended ───────────────────────────────────────────────
@@ -28,9 +41,16 @@ DATABASE_URL="postgres://snagset:snagset@localhost:5432/snagset"
28
41
  # Any S3-compatible bucket — DigitalOcean Spaces, Cloudflare R2, MinIO, S3.
29
42
  # Without one the widget runs in annotation mode and SAYS so, rather than
30
43
  # failing quietly at the moment somebody files their first snag.
44
+ #
45
+ # DigitalOcean Spaces, which these lines are written for: make a Space in a
46
+ # region, then API › Spaces Keys › Generate. The region is the one in the
47
+ # endpoint (ams3 with ams3, fra1 with fra1 — `auto` is for R2). The ACCESS
48
+ # KEY is the short DO00… value and the SECRET is the long one beside it; a
49
+ # DigitalOcean API token is a different credential and cannot sign S3
50
+ # requests. The bucket stays PRIVATE — the server serves every image itself.
31
51
  # SNAGSET_STORAGE_S3_ENDPOINT=https://ams3.digitaloceanspaces.com
32
52
  # SNAGSET_STORAGE_S3_BUCKET=my-bucket
33
- # SNAGSET_STORAGE_S3_REGION=auto
53
+ # SNAGSET_STORAGE_S3_REGION=ams3
34
54
  # SNAGSET_STORAGE_S3_ACCESS_KEY_ID=
35
55
  # SNAGSET_STORAGE_S3_SECRET_ACCESS_KEY=
36
56
 
@@ -38,8 +58,14 @@ DATABASE_URL="postgres://snagset:snagset@localhost:5432/snagset"
38
58
  # The URL SCHEME picks the transport: resend://, smtp://, smtps://.
39
59
  # Unset means no mail, which is a supported way to run — nothing queues up
40
60
  # waiting for a transport that never arrives.
61
+ #
62
+ # Resend: add and verify a domain at resend.com/domains FIRST (a subdomain
63
+ # such as send.yourstudio.com keeps its reputation apart from your own
64
+ # mail), then create an API key with sending access to it. The From address
65
+ # must be on that domain, or every send is refused with "domain is not
66
+ # verified" — the boot log and Studio › General both say so.
41
67
  # SNAGSET_MAIL_URL=resend://re_your_api_key
42
- # SNAGSET_MAIL_FROM=snagset@example.com
68
+ # SNAGSET_MAIL_FROM="Snagset <review@send.yourstudio.com>"
43
69
 
44
70
  # ── Everything else ────────────────────────────────────────────────────
45
71
  # `npm run env` prints every variable this build accepts, with its default —
@@ -5,3 +5,9 @@ node_modules/
5
5
  # The signing key the server generates on first boot if you did not set one.
6
6
  # Back this up; without it every session and encrypted credential is lost.
7
7
  .snagset/
8
+ # `vercel link` and `vercel dev` write the project binding here.
9
+ .vercel
10
+ # OS and editor clutter, so the first `git status` shows only the scaffold.
11
+ .DS_Store
12
+ Thumbs.db
13
+ *.log
@@ -9,7 +9,7 @@
9
9
  "crons": [
10
10
  {
11
11
  "path": "/api/jobs/run",
12
- "schedule": "* * * * *"
12
+ "schedule": "0 3 * * *"
13
13
  }
14
14
  ]
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-snagset",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Scaffold your own Snagset instance. One command, Postgres included, one variable to fill in.",