synqauth
v0.3.0
Published
Synq's command line: npx synqauth init gives your Next.js app a working sign-in, with no account until you claim it.
Readme
synqauth
Synq's command line. npx synqauth init gives your Next.js app a working sign-in, with no account: try Synq on your laptop first, and claim it when you sign up.
Synq is customer identity for businesses: an OpenID Connect issuer for each of your brands, with social, email, passkey and Solana wallet sign-in. The documentation is at docs.synq.build.
This package is at 0.x: its commands can change in any release until Synq's first customer depends on it.
npx synqauth init
Run it in a Next.js App Router project (an app/ or src/app/ folder):
npx synqauth initIt asks Synq for a development sign-in: an org of your own with one app, on https://localhost:<your dev port> only, named after your package (@acme/web is acme-web). Then it:
- writes the app's keys to
.env.local(SYNQ_ISSUER,SYNQ_CLIENT_ID,SYNQ_CLIENT_SECRET,SYNQ_APP_URL,SYNQ_SESSION_SECRETandSYNQ_CLAIM_TOKEN), and makes sure git ignores it: it adds.env*.localto your app's.gitignoreonly where git doesn't ignore the file already (outside a git repo, where.gitignoredoesn't say so) - adds
@synqauth/nextjswith your package manager - adds
synq.config.ts,lib/synq.ts, the route mount atapp/api/auth/[...synq]/route.ts, and a page at/synqthat signs you in and shows who - makes your
devscript serve https (next dev --experimental-https), which Synq's development redirect URIs need
It never overwrites a file you have, and stops before making anything when .env.local already has Synq's values (--force makes another).
Start your app and open https://localhost:3000/synq to sign in. Its first start may ask for your computer's password, once, to trust a local certificate: Next.js makes its https certificate with mkcert. Accept it, since sign-in needs the https address. Where the prompt can't be answered (a shell with no terminal, an agent, CI), Next.js serves http://localhost:3000 instead, and the /synq page says to restart dev in a terminal and accept the prompt. To keep the sign-in, open the claim link it prints (it's also in .env.local) within 7 days and sign up: the org is yours, with no limits but your plan's. Until then it signs in up to 25 people, on localhost only, and Synq deletes it if nobody claims it.
npm create synq does the same.
Options:
--force: make another development sign-in, even where.env.localhas Synq's values--no-install: don't add@synqauth/nextjs--stage preview|local: for working on Synq itself;localreadsSYNQ_API_URLandSYNQ_WEBSITE_URL
License
MIT
