RuntimeActive

AdonisJS

Node.js web framework with controllers, routing, IoC container, and first-class TypeScript support.

Open source page ↗

Field note

What it does

AdonisJS organizes route handlers into controller classes, supports dependency injection, resourceful routes, and middleware.

Capabilities

Available capabilities

Tags

Tags

Ways to use it

Ways to use it

npm

javascript / @adonisjs/core

sdk

javascript / https://docs.adonisjs.com/views/introduction

npm

TypeScript / @adonisjs/core

npm

typescript / @vinejs/vine

npm

typescript / edge.js

cli

TypeScript / Not filed

npm

TypeScript / Not filed

npm

typescript / @adonisjs/core

Product features

Product features

Adding context to error reports

API reference

Complete API reference documentation.

Barrel file

Barrel file system for importing controllers via #generated/controllers.

listenIf / listenOnceIf

Registers signal listeners only when the condition is truthy.

Configurable view layer

Use Edge templates, Vue, React, or skip the view layer for API-first services.

Controllers

Group related route handlers into controller classes stored in app/controllers.

Controller route handlers

Delegate request handling to controller methods instead of inline callbacks.

Creating a custom exception

Custom context properties

Add custom properties to the HTTP context.

Custom exceptions

Create custom exception classes with self-contained handling logic.

Debug mode

Verbose error display with stack traces, disabled in production.

Debug mode and Youch

Domain-specific routes

Register routes for specific domains, including dynamic subdomains.

Dummy context for testing

Create a dummy context for testing.

Exception Handling

getEnvironment

Returns the current runtime environment: web, console, repl, or test.

Global exception handler

app/exceptions/handler.ts extends ExceptionHandler with handle and report methods.

Guides

Comprehensive written guides for building with AdonisJS.

Handling specific error types

How errors flow through the handler

HTTP context

A request-scoped object holding request, response, auth, logger, session and more.

HttpContext augmentation

Add custom properties to the HttpContext and augment its TypeScript type.

Ignoring errors from reports

List registered routes

View registered routes using the Ace CLI command.

listen / listenOnce

Registers POSIX signal listeners on the Node.js process object.

make:middleware command

Scaffolds a middleware class in the app/middleware directory.

Middleware

Middleware functions receive the HTTP context as their first parameter.

Middleware stacks

Server, router, and named middleware stacks executing at different request lifecycle points.

MVC architecture

Model-View-Controller pattern keeps data, logic, and presentation separate.

Named middleware with parameters

Named middleware can accept parameters for per-route customization.

Node.js 24 requirement

AdonisJS v7 requires Node.js 24 or above.

nodeEnvironment

Exposes normalized NODE_ENV values such as development, staging, production, test.

notify

Sends messages to the parent process, wrapping process.send.

ORM

An ORM is included out of the box.

Path helpers

makePath, makeURL, tmpPath, configPath, publicPath and other directory paths.

Route redirects

Redirect from a route with forwarding and overriding of params.

Reporting errors

Resourceful routes

Register resource routes mapping the seven resourceful actions.

Route handlers

Receive the HTTP context as a parameter and destructure needed properties.

Route param validation

Validate dynamic route params using built-in, custom, or global matchers.

Screencasts

Practical screencasts with real, guided video lessons.

setEnvironment

Switches the application environment before boot.

Single action controllers

Wrap a single operation into a single action controller.

State shorthands

Boolean properties: isBooted, isReady, isTerminating, isTerminated.

Status pages

Maps status codes or ranges to view templates via statusPages.

The global exception handler

Step-by-step tutorials

Hands-on tutorial from scratch after environment setup.

Tuyau Type-safe API Client

Generates a fully typed HTTP client from routes, controllers, and validators.

End-to-end type safety

Applications are written in TypeScript and run in ESM mode with type safety across the stack.

TypeScript support

Works with TypeScript 5.9/6.0 and ESLint 10.

Upgrade from v6 to v7

Documentation for upgrading from AdonisJS v6 to v7.

Validation

Validation is included out of the box.

Render views from routes

Render Edge or Inertia views directly from a route handler.

Vite integration

The Vite integration has been updated to work with Vite 7.

When to use custom exceptions