Retries from our billing provider are creating duplicate invoices. Can you review app/api/webhooks/route.ts and make the handler idempotent? We use Drizzle and Postgres 16.
Blocks
Every block renders live below — what you see is exactly what you paste.
Keystone / Inbox
Notifications
7 unreadMentions, assignments and system alerts, grouped by day.
Today5
Yesterday2
Monday3
10 active·2 snoozed
Synced just now
App Notifications
A notification center: category filters, day groups, mark-as-read, snooze and a live unread summary.
design-crit
Critique, references and the details that ship.
- Today, May 14
- LOLena OrtizLena Ortiz9:02
Morning — v3 of the onboarding pass is up. I moved the workspace step before the invite step so people see value before we ask for their team.
onboarding-v3.figFigma file · 8.4 MB - 9:03
The empty state now suggests a first project instead of a dead end. Curious whether it reads as helpful or pushy.
- NPNoah ParkNoah Park9:07
Reads helpful to me. One nit: the secondary action is doing too much in that panel — maybe demote it to a text link so the primary path stays obvious.
- PNPriya NairPriya Nair9:11
Agree with Noah. Also, can we use the same wording in the invite email? “Bring your team in” is warmer than “Add members”.
- NBNadia BelloNadia Bello9:14
Good call. I will update the copy and swap the secondary action to a link. Shipping the changes to the Figma after lunch.
- NPNoah ParkNoah Park9:16
Also dropped the empty-state illustration into the handoff file. It is built from the same grid as the product, so it will not feel like a sticker.
empty-state-grid.png2400 × 1600 · 1.2 MB - ATAiko TanakaAiko Tanaka9:20
Testing note: 4 of 6 people clicked the primary action first, so the hierarchy is working.
22 unread messages across the workspace.
App Chat
A complete team messenger: channel list with unread state, threaded replies, live reactions, typing indicator and a working composer.
Design
11Files and folders in this part of the workspace.
Folders
3Files
8Uploading 2 files
12.4 MB · 4.2 MB/s
68%launch-film-grade.mp4
248 MB · 6.8 MB/s
34%- Done
brand-tokens.json
18 KB · Uploaded
100%
App File Manager
A complete workspace drive: folder tree, grid or list view, previews, shared access, upload progress and a live storage meter.
Harden the billing webhook
2 messages · Sonnet · saved just now
Read 3 files and replayed the retry14s
- Read
route.ts,schema.tsand the last 4 deliveries inwebhook-retry.log. - Reproduced the race with two concurrent
invoice.paidrequests. - Checked the migration history for an existing unique key.
Found it. The handler does a read-then-insert: it looks for an existing invoice, then writes one if none exists. The provider can deliver the same invoice.paid event twice before either request commits, so both pass the read and you get two rows.
Smallest safe fix. Add a unique key on the provider event and turn the invoice write into an on conflict do nothing insert. No backfill needed.
- Record every provider event in a new
billing_eventstable before touching invoices. - Make
invoice.paida no-op when the event was already handled. - Return 200 on duplicate delivery so the provider stops retrying.
Here's the handler after the change:
import { headers } from "next/headers";import { db } from "@/lib/db";import { billingEvents, invoices } from "@/lib/schema";import { verifySignature } from "@/lib/billing";export async function POST(request: Request) { const signature = (await headers()).get("stripe-signature"); const event = verifySignature(await request.text(), signature); const [seen] = await db .insert(billingEvents) .values({ provider: "stripe", eventId: event.id, type: event.type }) .onConflictDoNothing() .returning({ id: billingEvents.id }); if (!seen) return Response.json({ duplicate: true }); if (event.type === "invoice.paid") { await db.insert(invoices).values(toInvoice(event)).onConflictDoNothing(); } return Response.json({ received: true });}Ship the migration first, then the handler. The duplicate path is safe to deploy without a backfill, and the new log line will tell you when a retry was collapsed.
Suggested next
Anvil can make mistakes. Review generated code before shipping.
App AI Chat
A complete AI assistant workspace: searchable conversation history, model picker, streaming answers with a tabbed code block, attachments and suggested prompts.
Atlas 2.0 launch
On trackv2.0.0Overall progress
55% · 9 open
Timeline
17 tasksProject Gantt
A full launch timeline: phased tasks with dependency arrows, milestones, week or month zoom, filters and a live task inspector.
Acme / Account
Account
Your public profile, connected services and the devices that can reach this workspace.
Nadia Bello
Verified account@nadiabello · Product designer
Product designer focused on developer tools. I turn messy workflows into quiet interfaces — currently shaping the deployment experience at Acme.
- Team
- Design systems
- Location
- Lisbon, Portugal
- Time zone
- WET · UTC+00:00
- Projects
- 14
- Reviews
- 326
- Contributions
- 1,284
Activity
Your latest work across the workspace.
Today4
You commented on Checkout latency spike
The p95 jump lines up with the connection-pool change — worth reverting while we profile it.
checkout-web·
You approved Refactor auth middleware
platform·PR #482 · 3 files·
You signed in from a new device Chrome on Windows
·Berlin, DE · 203.0.113.92·
You uploaded checkout-flow-v12.fig
design·18.4 MB·
Yesterday3
You moved Billing settings polish
growth·to In review·
You mentioned @kofi in Design system weekly
Can you take the token audit before Thursday? I'll handle the migration notes.
design-system·
You enabled two-factor authentication Authenticator app
·Recovery codes downloaded·
Nov 42
You requested changes on Onboarding checklist
growth·PR #479 · 2 comments·
You shared Pricing page copy.docx
marketing·With Lina and 2 others·
Showing 9 of 9 recent events
View full activityConnected accounts
Services that can act on your behalf.
- GH
GitHub
Connected@nadiabello · Read repositories and open pull requests
repo · read:user
Active - G
Google
Connected[email protected] · Calendar events and Drive metadata
calendar.readonly · drive.metadata
Active - S
Slack
ConnectedAcme workspace · Channels you are in, mentions and DMs
channels:read · im:read
Active - F
Figma
Not connectedAcme Design team · File comments and version history
file_comments:read
Paused
Access is limited to the scopes shown. Revoke a connection at any time, effective immediately.
App User Profile
A complete account screen: profile hero, filtered activity feed, connected services, profile strength and revocable security sessions.
Workspace / Settings / Team
Team & access
Decide who reaches Northstar Studio, what each role can do, and where every seat goes.
Seat usage
Studio plan · renews Feb 1, 2027
Seat map
3 pending- Owner1
- Admin2
- Member4
- Guest1
- Pending3
- Available1
Pending invitations reserve a seat for 7 days.
Access posture
- SSO enforcedOkta
- SCIM provisioningActive
- Domain auto-join@northstar.studio
- 2FA coverage7/8
Members8
Everyone with an active seat in this workspace.
| Member | Role | Last active | Security | Actions |
|---|---|---|---|---|
NB Nadia BelloYou Product design lead·[email protected] | Owner | Active now | 2FA | |
MD Marc Delgado Engineering manager·[email protected] | 12m ago | 2FA | ||
PS Priya Shah Operations lead·[email protected] | 2h ago | 2FA | ||
JW Jonas Weber Frontend engineer·[email protected] | Yesterday | 2FA | ||
AC Aline Costa Product manager·[email protected] | 3h ago | 2FA | ||
KM Kofi Mensah Backend engineer·[email protected] | 2d ago | SMS 2FA | ||
SI Sana Ito Brand designer·[email protected] | 5d ago | 2FA | ||
TF Tomás Ferreira Motion contractor·[email protected] | 1w ago | No 2FA |
- NB
- MD
- PS
- JW
- AC
- KM
- SI
- TF
Pending invitations
3- CRby Marc
- DPby Priya
- SMby Nadia
Invite link
No approvalAnyone with a @northstar.studio address joins as Member.
Access activity
Nadia invited [email protected] as Admin
3h ago
Marc changed Jonas Weber to Member
Yesterday
Kofi enrolled SMS two-factor
2d ago
Tomás joined through the invite link
1w ago
Roles & permissions
Capabilities apply to every member with that role. The owner column is fixed; the others can be tuned to your team.
| Permission | Owner1 person | Admin2 people | Member4 people | Guest1 person |
|---|---|---|---|---|
| Workspace | ||||
| View workspaceSee projects, files and the member directory. | ||||
| Create and edit projectsAdd files, publish changes and organise folders. | ||||
| Comment and mentionLeave feedback and notify teammates from any thread. | ||||
| Administration | ||||
| Invite membersSend invitations and share the workspace join link. | ||||
| Manage rolesChange someone's role and edit this permission matrix. | ||||
| Manage billing and seatsUpdate the plan, seats and payment method. | ||||
| Configure SSO and securityConnect identity providers and enforce two-factor. | ||||
| Delete workspacePermanently remove the workspace and all its content. | ||||
Team & Access
A working team admin screen: seat map, searchable member directory with role changes, pending invitations, invite dialog and an editable permission matrix.
Product perception survey
Seven quick questions to help us decide what to build next quarter. No sales calls, no follow-up spam.
Your name* (required)
Company* (required)
Work email* (required)
Only used to follow up on your answers.
How often do you use Acme?* (required)
Pick the closest match.
How would you rate your last experience?
One is poor, five is excellent.
Which areas matter most to you?* (required)
Choose up to three.
What is one thing we could do better?
Answers are confidential
Send feedbackThis canvas is the live preview. Every change is reflected instantly.
App Form Builder
A complete survey builder: field palette, live form canvas, selection-aware settings, reordering and a respondent preview.
Pricing page v4
draftLaunch / Plan summary · line 42
Billing unit mismatch on the plan summary
Opened by Elena Marsh·10:12 AM·6 replies
- EMElena MarshElena MarshProduct marketing10:12 AMAuthorThe plan summary still says per workspace, but checkout is built around per seat. I checked the signed order form and seats are the contract language — this is the last copy mismatch before the pricing page goes live. @Priya Nair can you confirm we fix the string, not the billing logic?pricing-order-form.pdfPDF · 240 KB · page 3pdf
- PNPriya NairPriya NairProduct manager10:18 AMCopy is wrong, not the code. The billing service meters seats and the order form is explicit. @Marcus Bell can you update the plan summary and the comparison table before the 2 pm build? I'd rather not ship two different units on the same page.
- MBMarcus BellMarcus BellFrontend engineer10:24 AMOn it. The string lives in
plan-summary.tsxand the compare table reads from the samebillingUnittoken, so one change covers both. I'll add a test so this can't drift again.- EMElena MarshElena MarshProduct marketing10:26 AMBoth surfaces, yes — the compare table is the one people screenshot for procurement.
- TSTomás SilvaTomás SilvaBrand designer10:31 AMWhile we're in there: the annual toggle says Save 20% but the actual delta is 18.4%. I can tighten the number if we want the math to survive a screenshot.
- SLSofia LindqvistSofia LindqvistContent design10:38 AM@Tomás Silva Let's round down to 18% and keep the friendly phrasing. I'll adjust the tooltip copy so the claim and the math agree.
- PNPriya NairPriya NairProduct manager10:42 AMKeeping this thread blocking until the preview reflects the change. Reopen it if the copy moves again after freeze.
Comment Thread
A complete review conversation: anchored document context, nested replies, @mentions, live reactions, resolve and reopen, plus a rich composer with formatting and attachments.