Netpress Laravel-inspired backend framework for Node.js
Frameworkv0.1.14 Starterv0.1.12 Docsv1.0.3
Overview Installation Architecture CLI
Architecture

Architecture Overview

Netpress keeps the backend flow simple:

Request -> Router -> Middleware -> Controller -> Service -> Response

That sequence is the core mental model of the framework.

Request Lifecycle At A Glance

  1. The router matches the incoming request.
  2. Middleware handles cross-cutting concerns like auth, validation, throttling, and request shaping.
  3. The controller receives the request and delegates work.
  4. A service performs business logic or coordinates models and external systems.
  5. Netpress turns the returned value into a response.

This keeps responsibilities separated and code easier to test.

Service Container

The service container holds shared application services behind stable keys.

Use it for things like:

  • mail transports
  • queue runtimes
  • cache drivers
  • payment clients
  • custom infrastructure services

Bindings can be eager values or lazy factories. That means you can define a service at boot time without actually creating it until the application needs it.

Providers And Lazy Loading

Providers are the framework boot layer.

Each provider can:

  • register container bindings
  • load config
  • attach middleware
  • mount routes
  • defer heavier setup until first use

This is how Netpress stays modular. Mail, queue, storage, and other optional systems do not need to boot during every request if the app is not using them yet.

Separation Of Concerns

LayerResponsibility
RouterMatch the request to an action
MiddlewareCross-cutting HTTP concerns
ControllerHTTP boundary and orchestration
ServiceBusiness logic and workflows
ModelData access and persistence
ProviderApplication bootstrapping and infrastructure wiring

Why This Structure Works

  • It is easy to explain to new developers.
  • It scales better than “everything in routes”.
  • It stays flexible because each layer is still plain JavaScript.
  • It is friendly to AI tooling because naming and flow stay consistent.

For the lower-level flow, see Request Lifecycle. For bootstrapping details, see Providers and Service Container.