Recommended stack · Good for startups
AI SaaS
A TypeScript-first application stack for streamed model features, retrieval, and an optional self-hosted inference path.
- Responsibilities
- 6
- Open source
- 6 choices
- Self-hostable
- 6 choices
What it is for
Start with a server-rendered product shell and provider-neutral AI SDK, add retrieval only when the product has a real data-grounding requirement, keep product state in PostgreSQL, and use a dedicated model server only when operating open models is justified.
Who should use it
Product teams building an AI feature or vertical AI application that need a pragmatic route from hosted APIs to owned model infrastructure.
From decision to first build
Start with this stack.
Choose the pieces you want, then copy the build prompt into your coding assistant. No account needed.
Optional capabilities start as “Not needed”. Hosted providers add external dependencies, including to the open-source stack.
Next.js provides the server-rendered React surface and server boundary for streaming model interactions.
Open SourceRead the source ↗AI SDK offers typed, provider-neutral streaming, structured output, and tool-call primitives for TypeScript products.
Open SourceRead the source ↗LlamaIndex adds ingestion and retrieval workflows when model responses must be grounded in product or customer data.
Open SourceRead the source ↗PostgreSQL remains the system of record for users, entitlements, jobs, and auditable product state.
Open SourceRead the source ↗vLLM is the scale-oriented option when the team has evidence that operating open models is worth the GPU complexity.
Open SourceRead the source ↗Sentry captures failures around model calls, streaming boundaries, and the rest of the application release.
Generous Free TierRead the source ↗Application-owned authentication. Mount the Next.js App Router auth handler, configure a supported database adapter, and validate sessions on the server. Use nextCookies last in the plugin list if Server Actions set cookies.
Open-source core; you operate the database, email delivery, and authentication infrastructure.Read the source ↗Add editable React component source using the official Next.js setup. Use Tailwind CSS and shared CSS-variable design tokens. Keep interactive components at client boundaries and preserve keyboard and screen-reader behavior when customizing.
Open-source components and styling; your team owns customization and upgrades.Read the source ↗Identity verification (KYC) · Not needed
Optional — add only when your product needs this capability.
Billing · Not needed
Optional — add only when your product needs this capability.
Transactional email · Not needed
Optional — add only when your product needs this capability.
File storage · Not needed
Optional — add only when your product needs this capability.
Background jobs · Not needed
Optional — add only when your product needs this capability.
Product analytics · Not needed
Optional — add only when your product needs this capability.
API contracts · Not needed
Optional — add only when your product needs this capability.
Monorepo tooling · Not needed
Optional — add only when your product needs this capability.
Agent integration · Not needed
Optional — add only when your product needs this capability.
Agent instructions · Not needed
Optional — add only when your product needs this capability.
AI example · Not needed
Optional — add only when your product needs this capability.
CRUD example · Not needed
Optional — add only when your product needs this capability.
Data access / ORM · Not needed
Optional — add only when your product needs this capability.
Database hosting · Not needed
Optional — add only when your product needs this capability.
Documentation · Not needed
Optional — add only when your product needs this capability.
Updates as you choose your technologies.
Responsibility map
One choice for each job.
- 01
Application framework
Next.js
Next.js provides the server-rendered React surface and server boundary for streaming model interactions.
Open sourceOpen SourceSelf-hostable - 02
Model integration
AI SDK
AI SDK offers typed, provider-neutral streaming, structured output, and tool-call primitives for TypeScript products.
Open sourceOpen SourceSelf-hostable - 03
Retrieval layer
LlamaIndex
LlamaIndex adds ingestion and retrieval workflows when model responses must be grounded in product or customer data.
Open sourceOpen SourceSelf-hostableAlternativesPostgreSQL — Use PostgreSQL directly when modest retrieval needs do not justify a separate framework.
- 04
Application data
PostgreSQL
PostgreSQL remains the system of record for users, entitlements, jobs, and auditable product state.
Open sourceOpen SourceSelf-hostable - 05
- 06
Error monitoring
Sentry
Sentry captures failures around model calls, streaming boundaries, and the rest of the application release.
Open sourceGenerous Free TierSelf-hostable
Open-source profile
What you can own.
The application framework, AI libraries, database, and model server are open source. Model providers and the selected deployment and monitoring services may be proprietary.
Cost profile
Where cost appears.
Early prototypes can use free tiers, but model tokens, vector or relational storage, GPU inference, observability, and abuse controls become usage-sensitive costs.
Tradeoffs
What this stack asks you to accept.
- AI model cost and latency remain product constraints no framework removes.
- A retrieval framework is unnecessary complexity for features that do not need grounded private data.
- Self-hosted inference requires GPU operations expertise and should not be adopted by default.
Editorial note
Stack choices are editorial recommendations, not an automatic popularity ranking. Pricing and capabilities can change.
Sources checked
Provider-neutral streaming and tool integration capabilitiesSep 4, 2026
High-throughput open-model serving characteristicsSep 4, 2026