Introduction
Blitz.js is a full-stack React framework that extends Next.js with a zero-API data layer, authentication, and code scaffolding. It lets you write server-side logic and import it directly into React components as if calling a local function, removing the need for REST or GraphQL endpoints.
What Blitz.js Does
- Provides RPC-style server functions that are callable directly from React components
- Includes built-in authentication with session management and multiple strategies
- Scaffolds models, queries, mutations, and pages with a single CLI command
- Extends Next.js with conventions for organizing full-stack code in one repo
- Ships a recipe system for installing third-party integrations like Tailwind or Material UI
Architecture Overview
Blitz compiles server-side query and mutation functions into API endpoints at build time. When a component imports a server function, the bundler replaces the import with an HTTP call, keeping the developer experience of direct function calls while maintaining a clean client-server boundary. Prisma is the default ORM.
Self-Hosting & Configuration
- Install globally with npm or use npx to scaffold a new project interactively
- Configure the database via DATABASE_URL in .env — PostgreSQL and SQLite work out of the box
- Run blitz prisma migrate dev to apply schema changes during development
- Deploy to Vercel, Render, Railway, or any Node.js-compatible platform
- Customize the auth setup in app/blitz-server.ts and app/blitz-client.ts
Key Features
- Zero-API data layer that turns server functions into typesafe RPC calls
- Built-in auth with login, signup, password reset, and session management
- Code scaffolding CLI that generates models, queries, mutations, and forms
- Full TypeScript support with end-to-end type inference from database to UI
- Recipe system for one-command installation of common libraries and patterns
Comparison with Similar Tools
- Next.js — UI framework without opinions on data or auth; Blitz adds the full-stack layer
- RedwoodJS — full-stack React with GraphQL; Blitz uses direct RPC instead
- Create T3 App — scaffolds a Next.js + tRPC stack; Blitz provides its own zero-API abstraction
- Remix — focuses on web fundamentals and loaders; Blitz emphasizes RPC and code generation
FAQ
Q: Is Blitz.js still actively maintained? A: Yes. The project evolved from a monolithic framework into a toolkit of packages that can be used with any Next.js app.
Q: Can I use Blitz with an existing Next.js project? A: Yes. Blitz provides an adapter package that adds the zero-API layer and auth to existing Next.js apps.
Q: Which databases are supported? A: Any database supported by Prisma, including PostgreSQL, MySQL, SQLite, SQL Server, and CockroachDB.
Q: How does it compare to tRPC? A: Both provide typesafe RPC. Blitz bundles auth and scaffolding into a complete framework, while tRPC is a standalone library.