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,62 @@
|
|
|
1
|
+
// A page only Premium customers can open. Two checks, both on the server:
|
|
2
|
+
// 1. baas.payments.hasAccess(user, 'premium') decides what to show.
|
|
3
|
+
// 2. The premium_content table's access rule (billing.has_access('premium')) means the rows can't be
|
|
4
|
+
// read without Premium anyway, even by someone who calls the API directly.
|
|
5
|
+
import Link from 'next/link'
|
|
6
|
+
import { baas } from 'usebecky/server'
|
|
7
|
+
import { requireUser } from '@/lib/session'
|
|
8
|
+
|
|
9
|
+
export const metadata = { title: 'Premium guides' }
|
|
10
|
+
|
|
11
|
+
export default async function PremiumPage() {
|
|
12
|
+
const { user, db } = await requireUser('/premium')
|
|
13
|
+
const pro = await baas.payments.hasAccess(user, 'premium')
|
|
14
|
+
|
|
15
|
+
if (!pro) {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<h1 className="headline text-[clamp(2.4rem,6vw,3rem)]">Premium guides</h1>
|
|
19
|
+
<div className="mt-8 rounded-3xl border border-line bg-surface p-8 sm:p-10">
|
|
20
|
+
<span className="inline-flex items-center gap-2 rounded-full bg-accent-soft px-3 py-1 text-sm font-semibold text-accent">
|
|
21
|
+
<LockIcon /> Premium
|
|
22
|
+
</span>
|
|
23
|
+
<h2 className="mt-5 text-2xl font-semibold tracking-[-0.02em] text-balance">Guides and templates for people who ship a lot</h2>
|
|
24
|
+
<p className="mt-3 max-w-lg leading-relaxed text-muted">This page opens with a Premium subscription. Try it free for 14 days: you won’t be charged if you cancel before the trial ends.</p>
|
|
25
|
+
<Link href="/pricing" className="btn btn-primary mt-7">
|
|
26
|
+
See Premium plans
|
|
27
|
+
</Link>
|
|
28
|
+
</div>
|
|
29
|
+
</>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { data: items, error } = await db.from('premium_content').select('id, title, body, created_at').order('created_at')
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
<div className="flex items-center gap-3">
|
|
37
|
+
<h1 className="headline text-[clamp(2.4rem,6vw,3rem)]">Premium guides</h1>
|
|
38
|
+
<span className="mt-2 rounded-full bg-accent px-2.5 py-0.5 text-sm font-semibold text-accent-ink">Premium</span>
|
|
39
|
+
</div>
|
|
40
|
+
<p className="mt-3 text-muted">Thanks for being a Premium member. New guides appear here first.</p>
|
|
41
|
+
{error && <p className="mt-6 text-danger">{error.message}</p>}
|
|
42
|
+
<div className="mt-8 grid gap-4">
|
|
43
|
+
{(items ?? []).map((item) => (
|
|
44
|
+
<article key={item.id} className="rounded-2xl border border-line bg-surface p-6">
|
|
45
|
+
<h2 className="text-xl font-semibold tracking-[-0.015em]">{item.title}</h2>
|
|
46
|
+
{item.body && <p className="mt-2 max-w-[65ch] leading-relaxed text-muted">{item.body}</p>}
|
|
47
|
+
</article>
|
|
48
|
+
))}
|
|
49
|
+
{items?.length === 0 && <p className="text-muted">No guides yet. Add rows to the premium_content table in the dashboard.</p>}
|
|
50
|
+
</div>
|
|
51
|
+
</>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function LockIcon() {
|
|
56
|
+
return (
|
|
57
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" aria-hidden="true">
|
|
58
|
+
<rect x="5" y="11" width="14" height="10" rx="2" />
|
|
59
|
+
<path d="M8 11V8a4 4 0 0 1 8 0v3" />
|
|
60
|
+
</svg>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
// Google, sign-in links and confirmation emails come back here. The browser client reads the
|
|
3
|
+
// session from the address as soon as it loads; we wait for that, then move on.
|
|
4
|
+
import { useRouter } from 'next/navigation'
|
|
5
|
+
import { useEffect, useState } from 'react'
|
|
6
|
+
import { Logo } from '@/components/Logo'
|
|
7
|
+
import { baas } from '@/lib/usebecky'
|
|
8
|
+
|
|
9
|
+
export default function AuthCallbackPage() {
|
|
10
|
+
const router = useRouter()
|
|
11
|
+
const [message, setMessage] = useState('Signing you in…')
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
baas.auth.ready.then(() => {
|
|
15
|
+
const { data, error } = baas.auth.getSession()
|
|
16
|
+
const next = new URLSearchParams(window.location.search).get('next') ?? '/dashboard'
|
|
17
|
+
if (error) setMessage(`${error.message} ${error.hint ?? ''}`)
|
|
18
|
+
else if (data.session) {
|
|
19
|
+
router.replace(next.startsWith('/') && !next.startsWith('//') ? next : '/dashboard')
|
|
20
|
+
router.refresh()
|
|
21
|
+
} else setMessage('That sign-in link didn’t work. Go back and try again.')
|
|
22
|
+
})
|
|
23
|
+
}, [router])
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<main className="mx-auto flex min-h-dvh max-w-md flex-col items-start justify-center gap-6 px-6">
|
|
27
|
+
<Logo />
|
|
28
|
+
<p className="text-lg" role="status">
|
|
29
|
+
{message}
|
|
30
|
+
</p>
|
|
31
|
+
</main>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Your brand colour. Change this one value and the whole app follows,
|
|
5
|
+
in light and dark mode. Pick a colour dark enough for white text on it.
|
|
6
|
+
*/
|
|
7
|
+
:root {
|
|
8
|
+
--brand: #c2410c;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Light theme */
|
|
12
|
+
:root {
|
|
13
|
+
color-scheme: light;
|
|
14
|
+
--page: #f3f4f6;
|
|
15
|
+
--surface: #ffffff;
|
|
16
|
+
--sunken: #eceef1;
|
|
17
|
+
--ink: #15171c;
|
|
18
|
+
--muted: #5d6370;
|
|
19
|
+
--line: #e0e2e7;
|
|
20
|
+
--accent: var(--brand);
|
|
21
|
+
--accent-ink: #ffffff;
|
|
22
|
+
--accent-soft: color-mix(in oklab, var(--brand) 10%, var(--surface));
|
|
23
|
+
--good: #1d7a4f;
|
|
24
|
+
--danger: #b42318;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Dark theme (follows your computer's setting) */
|
|
28
|
+
@media (prefers-color-scheme: dark) {
|
|
29
|
+
:root {
|
|
30
|
+
color-scheme: dark;
|
|
31
|
+
--page: #101114;
|
|
32
|
+
--surface: #18191d;
|
|
33
|
+
--sunken: #0c0d10;
|
|
34
|
+
--ink: #eceef1;
|
|
35
|
+
--muted: #9a9fab;
|
|
36
|
+
--line: #2a2c33;
|
|
37
|
+
--accent: color-mix(in oklab, var(--brand) 62%, white);
|
|
38
|
+
--accent-ink: #160b05;
|
|
39
|
+
--accent-soft: color-mix(in oklab, var(--brand) 24%, var(--surface));
|
|
40
|
+
--good: #5fd39a;
|
|
41
|
+
--danger: #ff8b7e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@theme inline {
|
|
46
|
+
--color-page: var(--page);
|
|
47
|
+
--color-surface: var(--surface);
|
|
48
|
+
--color-sunken: var(--sunken);
|
|
49
|
+
--color-ink: var(--ink);
|
|
50
|
+
--color-muted: var(--muted);
|
|
51
|
+
--color-line: var(--line);
|
|
52
|
+
--color-brand: var(--brand);
|
|
53
|
+
--color-accent: var(--accent);
|
|
54
|
+
--color-accent-ink: var(--accent-ink);
|
|
55
|
+
--color-accent-soft: var(--accent-soft);
|
|
56
|
+
--color-good: var(--good);
|
|
57
|
+
--color-danger: var(--danger);
|
|
58
|
+
--font-sans: var(--font-bricolage), ui-sans-serif, system-ui, sans-serif;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@layer base {
|
|
62
|
+
html {
|
|
63
|
+
background: var(--page);
|
|
64
|
+
color: var(--ink);
|
|
65
|
+
-webkit-font-smoothing: antialiased;
|
|
66
|
+
}
|
|
67
|
+
body {
|
|
68
|
+
min-height: 100dvh;
|
|
69
|
+
font-family: var(--font-sans);
|
|
70
|
+
font-variation-settings: 'opsz' 14;
|
|
71
|
+
}
|
|
72
|
+
:focus-visible {
|
|
73
|
+
outline: 2px solid var(--accent);
|
|
74
|
+
outline-offset: 2px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Big headlines: Bricolage at its display optical size, slightly condensed. */
|
|
79
|
+
@utility headline {
|
|
80
|
+
font-variation-settings: 'opsz' 96, 'wdth' 92;
|
|
81
|
+
font-weight: 750;
|
|
82
|
+
letter-spacing: -0.028em;
|
|
83
|
+
line-height: 0.95;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Buttons */
|
|
87
|
+
@utility btn {
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
gap: 0.5rem;
|
|
92
|
+
height: 2.75rem;
|
|
93
|
+
padding-inline: 1.15rem;
|
|
94
|
+
border-radius: 0.7rem;
|
|
95
|
+
font-weight: 600;
|
|
96
|
+
font-size: 0.95rem;
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
transition: filter 150ms, background-color 150ms, opacity 150ms;
|
|
99
|
+
&:disabled {
|
|
100
|
+
opacity: 0.55;
|
|
101
|
+
cursor: not-allowed;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
@utility btn-primary {
|
|
105
|
+
background: var(--accent);
|
|
106
|
+
color: var(--accent-ink);
|
|
107
|
+
&:hover:not(:disabled) {
|
|
108
|
+
filter: brightness(1.08);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
@utility btn-ghost {
|
|
112
|
+
border: 1px solid var(--line);
|
|
113
|
+
background: var(--surface);
|
|
114
|
+
color: var(--ink);
|
|
115
|
+
&:hover:not(:disabled) {
|
|
116
|
+
background: var(--sunken);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@utility input {
|
|
121
|
+
height: 2.75rem;
|
|
122
|
+
width: 100%;
|
|
123
|
+
border-radius: 0.7rem;
|
|
124
|
+
border: 1px solid var(--line);
|
|
125
|
+
background: var(--surface);
|
|
126
|
+
padding-inline: 0.9rem;
|
|
127
|
+
font-size: 1rem;
|
|
128
|
+
color: var(--ink);
|
|
129
|
+
outline: none;
|
|
130
|
+
transition: border-color 150ms, box-shadow 150ms;
|
|
131
|
+
&::placeholder {
|
|
132
|
+
color: color-mix(in oklab, var(--muted) 75%, transparent);
|
|
133
|
+
}
|
|
134
|
+
&:focus {
|
|
135
|
+
border-color: var(--accent);
|
|
136
|
+
box-shadow: 0 0 0 3px var(--accent-soft);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* The brand-coloured block that sits behind the product preview. */
|
|
141
|
+
@utility offset-block {
|
|
142
|
+
box-shadow: 14px 14px 0 0 var(--accent);
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="9" fill="#c2410c"/><path d="M7 22.5 13 16l4.5 3.5L25 10" fill="none" stroke="#fff" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"/><circle cx="25" cy="10" r="2.6" fill="#fff"/></svg>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Metadata } from 'next'
|
|
2
|
+
import { Bricolage_Grotesque } from 'next/font/google'
|
|
3
|
+
import { brand } from '@/brand'
|
|
4
|
+
import './globals.css'
|
|
5
|
+
|
|
6
|
+
// One typeface for everything. Its optical-size axis makes headlines tight and small text open.
|
|
7
|
+
const bricolage = Bricolage_Grotesque({ subsets: ['latin'], variable: '--font-bricolage', axes: ['opsz', 'wdth'], display: 'swap' })
|
|
8
|
+
|
|
9
|
+
export const metadata: Metadata = {
|
|
10
|
+
title: { default: `${brand.name}: ${brand.tagline}`, template: `%s · ${brand.name}` },
|
|
11
|
+
description: brand.description,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
15
|
+
return (
|
|
16
|
+
<html lang="en" className={bricolage.variable}>
|
|
17
|
+
<body>{children}</body>
|
|
18
|
+
</html>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// The marketing page. A server component: it renders on the server, no JavaScript needed.
|
|
2
|
+
import Link from 'next/link'
|
|
3
|
+
import { brand } from '@/brand'
|
|
4
|
+
import { SiteFooter, SiteHeader } from '@/components/SiteHeader'
|
|
5
|
+
import { StatusDot } from '@/components/Status'
|
|
6
|
+
|
|
7
|
+
const FEATURES = [
|
|
8
|
+
{ title: 'One list for everything in flight', text: 'Each project gets a name, a short description and a status. Change it in one click when things move.' },
|
|
9
|
+
{ title: 'Private by default', text: 'Your projects are yours. The database itself makes sure nobody else can read them, not just the app.' },
|
|
10
|
+
{ title: 'Premium when you outgrow Free', text: 'Upgrade for guides and templates that only paying members can open. Try it free for 14 days.' },
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
// Sample rows for the product preview in the hero.
|
|
14
|
+
const PREVIEW = [
|
|
15
|
+
{ name: 'Spring launch site', note: 'Copy review with Mia on Thursday', status: 'active', when: 'Today' },
|
|
16
|
+
{ name: 'Onboarding emails', note: 'Three of five written', status: 'active', when: 'Yesterday' },
|
|
17
|
+
{ name: 'Podcast season two', note: 'Waiting on guest dates', status: 'paused', when: 'Mon' },
|
|
18
|
+
{ name: 'Pricing page refresh', note: 'Live since last week', status: 'done', when: 'Oct 28' },
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
export default function Home() {
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<SiteHeader />
|
|
25
|
+
<main>
|
|
26
|
+
<section className="mx-auto max-w-6xl px-5 pt-12 pb-20 sm:px-8 sm:pt-20 lg:pb-28">
|
|
27
|
+
<h1 className="headline max-w-[13ch] text-[clamp(3rem,8vw,6.5rem)] text-balance">{brand.tagline}</h1>
|
|
28
|
+
<div className="mt-8 grid items-end gap-10 lg:grid-cols-[1fr_auto]">
|
|
29
|
+
<p className="max-w-xl text-lg leading-relaxed text-muted sm:text-xl">{brand.description}</p>
|
|
30
|
+
<div className="flex flex-wrap gap-3">
|
|
31
|
+
<Link href="/sign-in?mode=sign-up" className="btn btn-primary h-12 px-6 text-base">
|
|
32
|
+
Start free
|
|
33
|
+
</Link>
|
|
34
|
+
<Link href="/pricing" className="btn btn-ghost h-12 px-6 text-base">
|
|
35
|
+
See pricing
|
|
36
|
+
</Link>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
{/* A preview of the dashboard, drawn with HTML so it stays sharp and matches your colours. */}
|
|
41
|
+
<div className="mt-16 sm:mt-20" aria-hidden="true">
|
|
42
|
+
<div className="offset-block overflow-hidden rounded-2xl border border-line bg-surface">
|
|
43
|
+
<div className="flex items-center justify-between border-b border-line px-5 py-4 sm:px-7">
|
|
44
|
+
<p className="text-lg font-semibold tracking-[-0.01em]">Your projects</p>
|
|
45
|
+
<span className="btn btn-primary h-9 px-3.5 text-sm">New project</span>
|
|
46
|
+
</div>
|
|
47
|
+
<ul>
|
|
48
|
+
{PREVIEW.map((p) => (
|
|
49
|
+
<li key={p.name} className="grid grid-cols-[auto_1fr_auto] items-center gap-x-4 border-b border-line px-5 py-4 last:border-0 sm:grid-cols-[auto_1.2fr_1.5fr_auto] sm:px-7">
|
|
50
|
+
<StatusDot status={p.status} />
|
|
51
|
+
<span className="truncate font-medium">{p.name}</span>
|
|
52
|
+
<span className="hidden truncate text-muted sm:block">{p.note}</span>
|
|
53
|
+
<span className="text-sm text-muted tabular-nums">{p.when}</span>
|
|
54
|
+
</li>
|
|
55
|
+
))}
|
|
56
|
+
</ul>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</section>
|
|
60
|
+
|
|
61
|
+
<section className="border-t border-line bg-surface">
|
|
62
|
+
<div className="mx-auto grid max-w-6xl gap-10 px-5 py-20 sm:px-8 md:grid-cols-3 md:gap-12">
|
|
63
|
+
{FEATURES.map((f) => (
|
|
64
|
+
<div key={f.title}>
|
|
65
|
+
<h2 className="text-xl font-semibold tracking-[-0.015em] text-balance">{f.title}</h2>
|
|
66
|
+
<p className="mt-3 leading-relaxed text-muted">{f.text}</p>
|
|
67
|
+
</div>
|
|
68
|
+
))}
|
|
69
|
+
</div>
|
|
70
|
+
</section>
|
|
71
|
+
|
|
72
|
+
<section className="mx-auto max-w-6xl px-5 py-20 sm:px-8 sm:py-28">
|
|
73
|
+
<div className="flex flex-col items-start justify-between gap-8 rounded-3xl bg-ink px-8 py-12 text-page sm:px-12 md:flex-row md:items-center">
|
|
74
|
+
<div>
|
|
75
|
+
<h2 className="headline text-[clamp(2rem,4.5vw,3.25rem)]">Free to start. Premium when you’re ready.</h2>
|
|
76
|
+
<p className="mt-3 max-w-lg text-page/70">No card needed for Free. Premium comes with a 14-day trial, and you can cancel from your account page any time.</p>
|
|
77
|
+
</div>
|
|
78
|
+
<Link href="/sign-in?mode=sign-up" className="btn btn-primary h-12 shrink-0 px-6 text-base">
|
|
79
|
+
Create your account
|
|
80
|
+
</Link>
|
|
81
|
+
</div>
|
|
82
|
+
</section>
|
|
83
|
+
</main>
|
|
84
|
+
<SiteFooter />
|
|
85
|
+
</>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
// The plans, with real prices from Dashboard → Payments (the SaaS template made a "premium" product
|
|
3
|
+
// with the prices premium_monthly and premium_yearly). "Start free trial" opens Stripe Checkout.
|
|
4
|
+
import Link from 'next/link'
|
|
5
|
+
import { useRouter } from 'next/navigation'
|
|
6
|
+
import { useEffect, useState } from 'react'
|
|
7
|
+
import type { Price } from 'usebecky'
|
|
8
|
+
import { brand } from '@/brand'
|
|
9
|
+
import { baas } from '@/lib/usebecky'
|
|
10
|
+
|
|
11
|
+
type Interval = 'month' | 'year'
|
|
12
|
+
// Shown until the real prices have loaded (and if Payments isn't set up yet).
|
|
13
|
+
const FALLBACK: Record<Interval, Pick<Price, 'amount' | 'currency' | 'trial_days'>> = {
|
|
14
|
+
month: { amount: 900, currency: 'usd', trial_days: 14 },
|
|
15
|
+
year: { amount: 9000, currency: 'usd', trial_days: 14 },
|
|
16
|
+
}
|
|
17
|
+
const PRICE_KEYS: Record<Interval, string> = { month: 'premium_monthly', year: 'premium_yearly' }
|
|
18
|
+
|
|
19
|
+
function money(amount: number, currency: string) {
|
|
20
|
+
return new Intl.NumberFormat('en-US', { style: 'currency', currency, minimumFractionDigits: amount % 100 ? 2 : 0 }).format(amount / 100)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function Plans() {
|
|
24
|
+
const router = useRouter()
|
|
25
|
+
const [interval, setInterval] = useState<Interval>('year')
|
|
26
|
+
const [prices, setPrices] = useState<Partial<Record<Interval, Price>>>({})
|
|
27
|
+
const [signedIn, setSignedIn] = useState(false)
|
|
28
|
+
const [busy, setBusy] = useState(false)
|
|
29
|
+
const [error, setError] = useState('')
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
baas.payments.products().then(({ data }) => {
|
|
33
|
+
const pro = data?.find((p) => p.key === 'premium')
|
|
34
|
+
setPrices({ month: pro?.prices.find((p) => p.key === PRICE_KEYS.month), year: pro?.prices.find((p) => p.key === PRICE_KEYS.year) })
|
|
35
|
+
})
|
|
36
|
+
return baas.auth.onAuthStateChange((_e, session) => setSignedIn(!!session))
|
|
37
|
+
}, [])
|
|
38
|
+
|
|
39
|
+
const price = prices[interval] ?? FALLBACK[interval]
|
|
40
|
+
const monthly = prices.month ?? FALLBACK.month
|
|
41
|
+
const yearlySaving = Math.max(0, monthly.amount * 12 - (prices.year ?? FALLBACK.year).amount)
|
|
42
|
+
const trial = price.trial_days ?? 0
|
|
43
|
+
|
|
44
|
+
async function startTrial() {
|
|
45
|
+
if (!signedIn) return router.push(`/sign-in?mode=sign-up&next=${encodeURIComponent('/pricing')}`)
|
|
46
|
+
setBusy(true)
|
|
47
|
+
setError('')
|
|
48
|
+
const { error } = await baas.payments.checkout(PRICE_KEYS[interval], {
|
|
49
|
+
successUrl: `${window.location.origin}/account?checkout=success`,
|
|
50
|
+
cancelUrl: window.location.href,
|
|
51
|
+
})
|
|
52
|
+
// On success the browser is already on its way to Stripe.
|
|
53
|
+
if (error) {
|
|
54
|
+
setBusy(false)
|
|
55
|
+
if (error.code === 'already_subscribed') setError('You already have Premium. Manage it from your account page.')
|
|
56
|
+
else if (error.code === 'stripe_not_configured' || error.code === 'stripe_not_connected') setError('Payments aren’t switched on for this app yet. Connect Stripe in Dashboard → Payments (test mode is fine), then try again.')
|
|
57
|
+
else setError(error.message)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className="mt-12">
|
|
63
|
+
<div role="radiogroup" aria-label="Billing period" className="inline-grid grid-cols-2 rounded-xl bg-sunken p-1 text-sm font-semibold">
|
|
64
|
+
{(['month', 'year'] as const).map((i) => (
|
|
65
|
+
<button
|
|
66
|
+
key={i}
|
|
67
|
+
role="radio"
|
|
68
|
+
aria-checked={interval === i}
|
|
69
|
+
onClick={() => setInterval(i)}
|
|
70
|
+
className={`h-10 rounded-lg px-4 transition-colors ${interval === i ? 'bg-surface text-ink shadow-sm' : 'text-muted hover:text-ink'}`}
|
|
71
|
+
>
|
|
72
|
+
{i === 'month' ? 'Monthly' : 'Yearly'}
|
|
73
|
+
{i === 'year' && yearlySaving > 0 && <span className="ml-1.5 text-accent">save {money(yearlySaving, monthly.currency)}</span>}
|
|
74
|
+
</button>
|
|
75
|
+
))}
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div className="mt-8 grid max-w-4xl gap-6 md:grid-cols-2">
|
|
79
|
+
<section aria-labelledby="free-plan" className="flex flex-col rounded-3xl border border-line bg-surface p-7 sm:p-8">
|
|
80
|
+
<h2 id="free-plan" className="text-xl font-semibold">
|
|
81
|
+
Free
|
|
82
|
+
</h2>
|
|
83
|
+
<p className="mt-4 flex items-baseline gap-1.5">
|
|
84
|
+
<span className="headline text-5xl">{money(0, price.currency)}</span>
|
|
85
|
+
<span className="text-muted">forever</span>
|
|
86
|
+
</p>
|
|
87
|
+
<Features items={brand.freeFeatures} />
|
|
88
|
+
<Link href={signedIn ? '/dashboard' : '/sign-in?mode=sign-up'} className="btn btn-ghost mt-auto h-12">
|
|
89
|
+
{signedIn ? 'Go to your projects' : 'Start free'}
|
|
90
|
+
</Link>
|
|
91
|
+
</section>
|
|
92
|
+
|
|
93
|
+
<section aria-labelledby="pro-plan" className="offset-block flex flex-col rounded-3xl border border-accent bg-surface p-7 sm:p-8">
|
|
94
|
+
<div className="flex items-center justify-between gap-3">
|
|
95
|
+
<h2 id="pro-plan" className="text-xl font-semibold">
|
|
96
|
+
Premium
|
|
97
|
+
</h2>
|
|
98
|
+
{trial > 0 && <span className="rounded-full bg-accent-soft px-3 py-1 text-sm font-semibold text-accent">{trial}-day free trial</span>}
|
|
99
|
+
</div>
|
|
100
|
+
<p className="mt-4 flex items-baseline gap-1.5">
|
|
101
|
+
<span className="headline text-5xl">{money(price.amount, price.currency)}</span>
|
|
102
|
+
<span className="text-muted">/ {interval}</span>
|
|
103
|
+
</p>
|
|
104
|
+
<p className="mt-1 h-5 text-sm text-muted">{interval === 'year' ? `${money(Math.round(price.amount / 12), price.currency)} a month, billed once a year` : 'Billed monthly'}</p>
|
|
105
|
+
<Features items={brand.proFeatures} />
|
|
106
|
+
<button onClick={startTrial} disabled={busy} className="btn btn-primary mt-auto h-12">
|
|
107
|
+
{busy ? 'Opening Stripe…' : trial > 0 ? `Start ${trial}-day free trial` : 'Upgrade to Premium'}
|
|
108
|
+
</button>
|
|
109
|
+
{error && (
|
|
110
|
+
<p role="alert" className="mt-4 text-sm leading-relaxed text-danger">
|
|
111
|
+
{error}
|
|
112
|
+
</p>
|
|
113
|
+
)}
|
|
114
|
+
</section>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function Features({ items }: { items: string[] }) {
|
|
121
|
+
return (
|
|
122
|
+
<ul className="my-7 space-y-3">
|
|
123
|
+
{items.map((f) => (
|
|
124
|
+
<li key={f} className="flex gap-3 leading-snug">
|
|
125
|
+
<svg className="mt-0.5 shrink-0 text-accent" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
126
|
+
<path d="m5 12.5 4.5 4.5L19 7.5" />
|
|
127
|
+
</svg>
|
|
128
|
+
{f}
|
|
129
|
+
</li>
|
|
130
|
+
))}
|
|
131
|
+
</ul>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
// Stripe's test card, shown only while payments are in test mode. After you switch to live
|
|
3
|
+
// (Dashboard → Payments → Go live), real cards work and this hint disappears by itself.
|
|
4
|
+
import { useEffect, useState } from 'react'
|
|
5
|
+
import { baas } from '@/lib/usebecky'
|
|
6
|
+
|
|
7
|
+
export function TestCardHint() {
|
|
8
|
+
const [testMode, setTestMode] = useState(false)
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
baas.payments.mode().then(({ data }) => setTestMode(data === 'test'))
|
|
11
|
+
}, [])
|
|
12
|
+
if (!testMode) return null
|
|
13
|
+
return (
|
|
14
|
+
<p className="mt-3 max-w-xl text-sm leading-relaxed text-muted">
|
|
15
|
+
Test mode: pay with the card number 4242 4242 4242 4242, any future date and any CVC. Nothing is charged.
|
|
16
|
+
</p>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SiteFooter, SiteHeader } from '@/components/SiteHeader'
|
|
2
|
+
import { Plans } from './Plans'
|
|
3
|
+
import { TestCardHint } from './TestCardHint'
|
|
4
|
+
|
|
5
|
+
export const metadata = { title: 'Pricing' }
|
|
6
|
+
|
|
7
|
+
export default function PricingPage() {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<SiteHeader />
|
|
11
|
+
<main className="mx-auto max-w-6xl px-5 pt-12 pb-24 sm:px-8 sm:pt-16">
|
|
12
|
+
<h1 className="headline max-w-[14ch] text-[clamp(2.75rem,6vw,4.75rem)] text-balance">Simple plans. Cancel any time.</h1>
|
|
13
|
+
<p className="mt-5 max-w-xl text-lg leading-relaxed text-muted">Start free. When you want the Premium guides, try Premium for 14 days before you pay anything.</p>
|
|
14
|
+
<Plans />
|
|
15
|
+
<p className="mt-10 max-w-xl text-sm leading-relaxed text-muted">Payments are handled by Stripe.</p>
|
|
16
|
+
<TestCardHint />
|
|
17
|
+
</main>
|
|
18
|
+
<SiteFooter />
|
|
19
|
+
</>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Shown until .env.local has your project's keys.
|
|
2
|
+
import { Logo } from '@/components/Logo'
|
|
3
|
+
|
|
4
|
+
export const metadata = { title: 'Connect your project' }
|
|
5
|
+
|
|
6
|
+
export default function SetupPage() {
|
|
7
|
+
return (
|
|
8
|
+
<main className="mx-auto max-w-xl px-6 py-16">
|
|
9
|
+
<Logo />
|
|
10
|
+
<h1 className="headline mt-12 text-5xl">Connect your project</h1>
|
|
11
|
+
<p className="mt-5 text-lg leading-relaxed text-muted">
|
|
12
|
+
This app needs your usebecky project’s keys in a file called <code className="text-ink">.env.local</code>. Three steps:
|
|
13
|
+
</p>
|
|
14
|
+
<ol className="mt-8 space-y-3">
|
|
15
|
+
{[
|
|
16
|
+
<>
|
|
17
|
+
In this folder, run <code className="rounded bg-sunken px-1.5 py-0.5 text-ink">npx usebecky init</code> and pick a project made from the <strong>SaaS</strong> template.
|
|
18
|
+
</>,
|
|
19
|
+
<>
|
|
20
|
+
Check that <code className="rounded bg-sunken px-1.5 py-0.5 text-ink">.env.local</code> now has four lines starting with <code>NEXT_PUBLIC_USEBECKY_</code> and <code>USEBECKY_</code>.
|
|
21
|
+
</>,
|
|
22
|
+
<>
|
|
23
|
+
Stop <code className="rounded bg-sunken px-1.5 py-0.5 text-ink">npm run dev</code> with Ctrl+C and start it again.
|
|
24
|
+
</>,
|
|
25
|
+
].map((step, i) => (
|
|
26
|
+
<li key={i} className="grid grid-cols-[2rem_1fr] gap-3 rounded-2xl border border-line bg-surface p-5 leading-relaxed">
|
|
27
|
+
<span className="grid size-7 place-items-center rounded-full bg-accent-soft text-sm font-bold text-accent">{i + 1}</span>
|
|
28
|
+
<span>{step}</span>
|
|
29
|
+
</li>
|
|
30
|
+
))}
|
|
31
|
+
</ol>
|
|
32
|
+
</main>
|
|
33
|
+
)
|
|
34
|
+
}
|