Most AI writing tools die in the planning stage -- not because the idea is bad, but because founders underestimate how much plumbing comes before the first AI call.
You need auth so users can log in. You need billing so they can pay. You need credits so you can control how much Claude they consume. You need streaming so the output does not look frozen for 10 seconds. And you need all of that before you write a single line of product code.
That is the actual problem. The AI part is not the bottleneck.
Strip away the product features and every AI writing tool has the same four layers:
The fifth thing most founders discover late is cost control. Claude is cheap per call, but 500 users hitting a /generate endpoint without rate limits will produce a bill that surprises you. Credit-based billing fixes this: each user pays for what they use, and you know your margin before you scale.
This Next.js SaaS boilerplate ships with the first three layers already wired:
Auth is JWT-based and live on day one. Users register, log in, and get a token. Every protected route checks it automatically -- no third-party auth service required.
Streaming AI is a POST /api/ai/chat route that connects to Claude and returns Server-Sent Events. The useAiChat hook on the client reads the stream token by token, so output appears as it generates. No waiting, no frozen UI.
Credits are tracked per user. The AI_CREDITS_PER_MESSAGE env variable controls the cost of each call. The service layer checks the balance before calling Claude and returns a 402 if it runs out, so you can gate usage without touching the AI code.
Payments run through Stripe. You can charge for a credit bundle (one-time payment) or a monthly plan (subscription), and the webhook syncs the balance to your database automatically.
What you build on top is the actual product: the prompt templates, the output editor, the history view, the export button. That is a few UI components -- not a new backend.
Building this from scratch takes four to eight weeks if you know what you are doing. Auth alone can eat a week once you add email verification, password reset, and OAuth. Stripe subscriptions take another week once you add webhooks, plan switching, and a customer portal. Streaming AI responses require understanding Server-Sent Events on both client and server.
A boilerplate that has already solved each of those problems lets you skip to the part that makes your product yours: the prompts, the templates, the specific workflow your target user actually wants.
The question is not "boilerplate or scratch" -- it is "how much do you want to pay to get to the first user interaction?"
Here is a realistic scope for 48 hours starting from the boilerplate:
By Sunday evening you have a working product that accepts payments and generates AI output. Not a demo -- an actual product with real users you can onboard.
Once you have users, AI cost becomes the question. The boilerplate includes prompt caching via the Claude API, which cuts costs by up to 90% for repeated system prompts. If your writing tool uses a shared system prompt (style guide, tone rules, output format), caching it means you only pay for the user's actual input -- not the overhead of resending the same 2000-token prompt on every call.
Transactional email via Resend is also ready from day one -- useful for welcome messages, low-credit alerts, and document delivery.
The hardest part of building an AI SaaS is not prompting Claude. It is everything around it: the user who needs to pay, the system that tracks their usage, the webhook that syncs their plan, the email that fires when they run out of credits.
Get the boilerplate and ship your AI writing tool this weekend -- the infrastructure is already there. The only thing left to build is the product.