springnext
v1.1.11
Published
Next.js with Spring-level robustness and powerful scaffolding — no Java involved.
Maintainers
Readme
🌱 About
SpringNext brings Spring/.NET architecture principles to Next.js — with full-stack scaffolding in seconds, supercharged with top-tier DX.
Not a framework — you stay inside plain Next.js, with scaffolding and lightweight runtime helpers.
Without SpringNext:
- write API routes
- write tons of DTOs
- write validation
- write types
- write query hooks to call API
- wire everything
With SpringNext:
1 command → everything generated. Try it out on StackBlitz! Best experienced in Chrome. StackBlitz support in Safari may vary.
Who is it for?
- Enterprise backend developers (.NET, Spring) moving to Next.js.
- Startups that need both speed and scalability.
- Teams tired of inconsistent architecture and code-style debates.
- Developers who want structure without heavy frameworks that feel like another language.
⚡ Try it in 30 seconds
# Install (SpringNext + required deps)
npm i inversify zod reflect-metadata springnext
# Initialize
npx sn init prismaClientPath:@/generated/prisma/client
# Scaffold CRUD and entity
npx sn crud-api user📁 Generated structure with ready-to-use scaffolded files:
# Entity
domain/entities/user/
# Controllers
server/controllers/user/
# Services
server/services/user/
# Stores (contract, in-memory, Prisma)
server/stores/user/
# API Routes
app/api/user-controller/
# React Query hooks
ui/shared/queries/user//domain/entities/user/user.entity.ts→ entity schema (static fieldschemainUserclass)/server/stores/user/user.store.ts→ store schemas (if default schemas do not fit your needs)/server/stores/user/user.store.prisma.ts→ mapUserStorecontracts to Prisma client contracts (implement existing functions inmappersobject)
→ Full backend + API + frontend hooks — ready in seconds.
Does it only work for CRUD?
No. You can scaffold modules independently and implement your own logic — React Query hooks will be generated as well. All details can be found in Guides section.
Is invalidation in queries already configured?
Yes. You can also customize queries as needed, and your changes will be preserved when code is regenerated.
How does data flow look like?
React Hooks # Client fetches
↓
API Routes
↓
Controllers
↓
Services # Server actions
↓
Stores
↓
DatabaseHow do services look like?
TestService metadata
import type { Module } from 'springnext';
export const testServiceMetadata = {
name: 'TestService',
schemas: {
testMethod: {
payload: z.object({ stringArg: z.string() }),
response: z.object({ positiveNumber: z.int().positive() })
},
}
} satisfies Module.Metadata;TestService
import { Module } from 'springnext';
import { testServiceMetadata } from './test.service.metadata';
type Methods = Module.Methods<typeof testServiceMetadata>;
export class TestService implements Methods {
private methods = Module.methods(productServiceMetadata);
testMethod = this.methods(
'testMethod',
async ({ stringArg } => {
return { positiveNumber: Number(stringArg) }
})
);
}How do controllers look like?
TestController metadata
import type { Controller } from 'springnext';
export const testControllerMetadata = {
name: 'TestController',
schemas: {
POST: {
query: z.object({ queryArg: z.string() }),
body: z.object({ bodyArg: z.string() })
response: z.object({ concatenated: z.string() })
},
}
} satisfies Controller.Metadata;TestController
import { Controller } from 'springnext';
import { testControllerMetadata } from './test.controller.metadata';
type Endpoints = Controller.EndpointList<typeof testControllerMetadata>;
export class TestController implements Endpoints {
private endpoints = Controller.endpoints(testControllerMetadata)
POST = this.endpoints(
'POST',
async ({ queryArg, bodyArg }) => ({
concatenated: `${queryArg} ${bodyArg}`
})
);
}What about Server Actions?
SpringNext modules can be seamlessly used in Server Actions.
'use server'
import { fromDI } from '@/backend/di'
const service = fromDI<TestService>('TestService')
export const testMethod = service.testMethod🔮 Core principles
Plug-and-play by default, fully tweakable when you need it.
Use it out of the box without thinking about the internals — or customize anything with complete control. Every line of code is yours.
Best practices through convenience.
We read code more than we write it — so quality matters. But best practices aren’t enforced by linters or style guides. SpringNext flips the approach: it makes enterprise-grade code the easiest option — so anything else feels wrong.
A combination of the rigor of .NET and Spring with the flexibility of TypeScript.
Sometimes Java or C# can feel clunky and verbose compared to TypeScript. At the same time, Next projects often turn into unmaintainable chaos compared to .NET or Spring. SpringNext brings together the best of both worlds — the flexibility of TypeScript within an enterprise-ready architecture.
📚 Guides and documentation
- 🚀 Quick start with Prisma
- 🧙 Implementing your own methods in server modules
- 📈 Data flow schemas
- ⚙️ CLI commands glossary
- ❓ FAQ
❓ Why not use Nest or tRPC instead?
SpringNext takes inspiration from both, but focuses on a contract-first, scaffold-driven approach inside plain Next.js.
| Feature | SpringNext | tRPC | Nest | |------------------------|-------------------------------------|--------------------------|----------------------------| | Architecture | Contract-first (schema-driven), .NET/Spring inspired | Procedure-based | Module-based | | Learning curve | Medium | Low | High | | Type safety | End-to-end + runtime validation | End-to-end | Partial | | Scaffolding | Full-stack (API + backend + hooks) | None | Partial (CLI generators) | | Boilerplate | Low (generated code) | Low | Medium | | Framework lock-in | None | None | Moderate | | Single source of truth | Yes (schemas) | Partial | Partial | | Code ownership | Full (generated, editable) | Full | Partial (framework-driven) |
🚫 When not to use
- very small projects (may not be worth it)
- you prefer runtime-driven frameworks like NestJS
