Private & invite-only apps
Control who can open your app and register — from public launches and invite-only betas to member portals and internal team tools.
Four visibility models for Live apps
Not every published app should let anyone on the internet click Sign up and enter. Pick one clear visibility model upfront so navigation, tables, and server auth checks stay aligned from day one.
| Visibility model | Public pages | Who can register | Best fit |
|---|---|---|---|
| Public app | Anyone on the web | Open sign-up or social login | Storefronts, bookings, SaaS apps, public directories |
| Invite-only beta / waitlist | Marketing page and waitlist form only | Valid invite token or admin-approved email | Controlled betas, founder communities, cohorts |
| Member-only client portal | Branded sign-in screen (/login) only | Invited clients or paid subscribers | Agency portals, coaching hubs, B2B dashboards |
| Internal company tool | Branded sign-in screen (/login) only | Verified @company.com teammates plus invite | Ops dashboards, inventory, finance approvals |
Why server-gated access beats hiding routes in the UI
Putting a login modal over a dashboard while /api/clients still returns data leaks every record in Chrome DevTools. True private visibility enforces two layers together:
- Server-enforced route and API gates. Every non-public endpoint verifies an active session and approval status (
active, workspace membership, or invite) before querying the database, returning401 Unauthorizedwhen signed out and403 Forbiddenwhen unapproved. - Search-engine exclusion (`noindex`). Emit
<meta name="robots" content="noindex, nofollow">on private routes and omit internal URLs fromsitemap.xmlso search engines never index private screens.
Designing clean invite tokens and waitlists
Whether you are admitting 25 beta testers a week or onboarding paying agency clients, treat invite links like one-time keys — never reusable plain URLs like /signup?invited=true.
Here is a battle-tested schema blueprint for waitlists and expiring single-use invites:
waitlist_requests
id PK (uuid)
email text, unique (lowercase), not null
full_name text, not null
company text, nullable
status enum('pending', 'approved', 'declined'), default 'pending'
created_at timestamp (UTC)
invites
id PK (uuid)
email text (lowercase), not null
role enum('member', 'staff', 'admin'), default 'member'
workspace_id FK -> workspaces.id, nullable
token_hash text, unique, not null -- store hash only, never raw token
invited_by_user_id FK -> users.id, not null
expires_at timestamp (UTC), not null -- e.g. 7 days from creation
accepted_at timestamp (UTC), nullable
revoked_at timestamp (UTC), nullable
created_at timestamp (UTC)Five small rules make this invite flow rock-solid in production:
- Hash the invite token at rest. Generate a high-entropy random token on the server, email the raw token once inside
/accept-invite?token=..., and store only its cryptographic hash ininvites.token_hash. - Bind invites to the invited email. When the recipient opens the link, pre-fill and lock their invited email address (or verify that their Google/Apple login matches
invites.email) so forwarded links cannot be claimed by strangers. - Expire and consume atomically. Set
expires_atto 7 days by default, reject expired or revoked invites cleanly, and markaccepted_atinside a database transaction so the same link can never create two accounts. - Give admins full visibility. Build an Invites tab showing Pending, Accepted, Expired, and Revoked rows with one-click Resend (rotates token and extends expiry) and Revoke actions.
- Keep open registration disabled on the server. Removing the Sign up link from your header is not enough — your
POST /api/auth/registerroute itself must reject registrations that lack a valid, unconsumed invite token.
Domain allowlists and internal tool guardrails
For internal company apps, founders often ask to "allow anyone with an @acme.com email." That is convenient, but only safe when paired with strict email verification.
- Never trust an unverified email/password signup. If someone registers
fake@acme.comwith a password and your app skips email verification, an outsider walks straight into your internal dashboard. - Prefer Google Workspace or Microsoft SSO for internal tools. Corporate SSO confirms the teammate actually owns an active company mailbox — and if they leave the company and IT suspends their mailbox, they can no longer sign back in.
- Combine domain allowlist with explicit role approval for sensitive tools. For finance, payroll, or admin portals, require both a verified
@acme.comaddress and an explicit admin invite so a contractor or intern does not inherit automatic access.
Step-by-step: launching an invite-only beta or private portal
Follow these five steps to lock down your app cleanly before sharing your Live URL.
Lock registration on the server first
Configure your app so only
/login,/accept-invite, and (if using a beta waitlist)/plus/waitlistare public; every other page and API route requires an authenticated, active account.Add the invite manager and branded invite emails
Wire the
invitestable to send crisp invite links using your configured sending domain so invites land in inboxes rather than spam. See Branded email & delivery.Bootstrap your first Live admin safely
Remember that Preview accounts do not copy to Live. Allow your single owner email (or create your first Live account in Cloud → Live and promote it to
admin) before disabling open sign-up so you never lock yourself out.Verify private gates in an incognito window
Open your Live URL while signed out and test direct navigation to
/dashboard,/settings, and your main/api/...routes to confirm every private route redirects or returns401.Test the full invite lifecycle end to end
Send a real invite to a secondary email, confirm accepting works once, verify reloading the consumed link fails cleanly, and test clicking Revoke on a pending invite.
Convert this app into an invite-only client portal. Keep only `/`, `/waitlist`, `/login`, and `/accept-invite` accessible to signed-out visitors, add `noindex, nofollow` metadata on all portal routes, and reject direct `POST /api/auth/register` attempts unless backed by a valid, unexpired, unrevoked single-use invite token hashed in an `invites` table. Add an Admin-only `/admin/invites` screen where admins can approve waitlist requests, invite clients by email with a chosen role (`member` or `staff`), send a 7-day expiring invite email, and resend or revoke pending invites. Ensure every private page and API route enforces session authentication server-side and returns `401` when signed out.
Common visibility & invite pitfalls
If an invite flow stalls or a private portal behaves unexpectedly after Publish, check these five common causes.
| Issue | What went wrong | Clean fix |
|---|---|---|
| Founder locked out on Live after turning off open registration | Preview admin account does not exist in Live, and Live blocks new sign-ups | Configure an explicit founder allowlist email for first login, or create and promote your Live admin in Cloud → Live |
| Private API still returns JSON when signed out | Login check was added only to frontend router instead of server API handlers | Add server auth middleware to every non-public /api/* endpoint returning 401 |
| Invited client clicked "Continue with Google" using a personal Gmail instead of work email | Invite was bound to alex@company.com, but user authenticated with alex.personal@gmail.com | Show a clear message naming the invited email ("This invite is for alex@company.com — sign in with that address or ask your admin to re-invite") |
| Invite emails land in Promotions or Spam | Sending domain lacked verified SPF, DKIM, and DMARC records | Connect your custom domain and authenticate DNS; see Email authentication (SPF/DKIM/DMARC) |
| Private portal login or client names appear in Google Search | Missing noindex tags or client profile slugs leaked into sitemap.xml | Exclude all private routes from sitemap.xml, emit noindex, nofollow, and keep client data strictly behind auth |