AI summary by TwinMind
Is This The End Of T3 Stack? (JStack Breakdown)
Theo - t3․gg
29m 27s
J-Stack Introduction and Comparison to T3-Stack
- Josh from Josh Tried Coding released J-Stack as alternative to T3-Stack
- J-Stack inspired by T3-Stack but addresses specific limitations
- Similar TypeScript-focused approach but different architectural decisions
- Key difference: independent state management vs tRPC's tight React Query coupling
T3-Stack Background and Current Issues
- T3-Stack originally coined around Next.js, TypeScript, React, Tailwind, tRPC
- tRPC provides magical type safety between frontend/backend with function calls
- Current limitations identified:
- Deep coupling to React Query hooks
- Difficult to use React Query as standalone state manager
- Advanced use cases require tRPC-specific solutions
- Batching multiple queries requires complex workarounds
Code Rabbit Sponsor Segment
- AI code reviewer that provides useful feedback
- $15/month, free for open source projects
- Catches bugs like double-counting limits that humans might miss
- Generates flow diagrams for PR changes
- Learns from feedback and improves over time
J-Stack Technical Architecture
- Built on Hono framework instead of pure Next.js backend
- Uses SuperJSON for enhanced JSON serialization (dates, BigInt support)
- Platform agnostic deployment (Vercel, Cloudflare, etc.)
- AI-optimized documentation with llm.txt files for cursor integration
- 1,318 GitHub stars at time of recording
J-Stack Setup and File Structure
- CLI:
pnpm create jstack-app@latest - Database options: Drizzle with PostgreSQL (Neon, Vercel), SQLite
- File structure similar to T3-Stack with server directory
- Wrangler file included for Cloudflare deployment
- Yarn lock file present (criticized as outdated)
J-Stack API Implementation
- Router pattern similar to tRPC:
j.router(),publicProcedure.query() - Zod validation for input/output
- SuperJSON wrapping required:
c.superJson(data) - Type safety enforced at compile time
- WebSocket support included
Client-Side Usage Comparison
- J-Stack: Manual React Query setup with async functions
- tRPC: Built-in hooks with automatic batching
- J-Stack approach:
useQuery({ queryKey: ['get-recent-post'], queryFn: () => client.post.recent.$get() }) - tRPC approach:
api.post.hello.useQuery({ text: "value" })
State Management Philosophy Differences
- tRPC: Prefer server-side data composition, single endpoint for multiple needs
- J-Stack: Client-side composition with independent queries
- Example: Instead of separate
helloandlatestendpoints, createhelloPlus Latestendpoint - Reduces client-side state management complexity
Technical Limitations Identified
- No command-click navigation to backend code (missing in J-Stack)
- No automatic request batching (multiple separate HTTP calls)
- Manual query key management required (string-based, error-prone)
- Cache invalidation requires manual string matching
Network Performance Analysis
- J-Stack makes separate GET requests for each query (no batching)
- tRPC batches multiple queries into single request
- Refresh triggers multiple individual requests vs single batched request
- Performance implications for larger applications
Developer Experience Trade-offs
- J-Stack: More vanilla feeling, less magic, platform flexibility
- tRPC: Deeper integration, better DX features, more opinionated
- J-Stack: Simpler setup, fewer moving parts
- tRPC: More complex but more powerful features
Final Assessment and Recommendations
- J-Stack positioned as tribute/love letter to tRPC patterns
- Good option for developers wanting minimal tRPC-like experience
- Suitable for those preferring vanilla client approach
- tRPC still preferred for full-stack type safety and DX features
- Both approaches have merit depending on project needs
