Prerequisites
Before installing AdonisJS Core, ensure you have the following:Node.js
Version 24.0.0 or higherDownload from nodejs.org
Package Manager
npm, yarn, or pnpmComes with Node.js or install separately
Install AdonisJS Core
Install the@adonisjs/core package using your preferred package manager:
The
@adonisjs/core package includes all the essential modules you need to build web applications, including HTTP server, routing, middleware, config management, and more.Install Optional Dependencies
Depending on your application requirements, you may want to install these optional peer dependencies:Development Tools
For hot module reloading and TypeScript compilation:Password Hashing
For secure password hashing using Argon2 or Bcrypt:- Argon2 (Recommended)
- Bcrypt
Validation
For request validation with VineJS:Template Engine
For server-side rendering with Edge templates:Error Handling
For beautiful error pages in development:Pretty Logging
For formatted console output during development:TypeScript Configuration
AdonisJS is built with TypeScript. Create atsconfig.json file in your project root:
tsconfig.json
The
@adonisjs/tsconfig package provides recommended TypeScript configurations. Install it with npm install --save-dev @adonisjs/tsconfig.Package.json Setup
Update yourpackage.json to use ES modules:
package.json
Setting
"type": "module" enables ES module syntax (import/export) in your project.Project Structure
Create a basic project structure:Verification
Verify your installation by checking the installed version:Next Steps
Now that you have AdonisJS Core installed, you’re ready to build your first application:Quick Start Guide
Create your first HTTP server with AdonisJS
Architecture Overview
Learn about the core concepts and architecture
Troubleshooting
Node.js version error
Node.js version error
If you see an error about Node.js version, ensure you’re running Node.js 24.0.0 or higher:If you need to upgrade, download the latest version from nodejs.org or use a version manager like nvm.
Native module compilation errors
Native module compilation errors
Some packages like
argon2 and bcrypt require native compilation. Ensure you have:- Python (for node-gyp)
- C++ build tools (Visual Studio Build Tools on Windows, gcc on Linux, Xcode on macOS)
Import errors with TypeScript
Import errors with TypeScript
If you encounter import errors, ensure:
- Your
tsconfig.jsonhas"module": "ESNext"or"module": "NodeNext" - Your
package.jsonhas"type": "module" - You’re using
.jsextensions in your imports (TypeScript requirement for ES modules)
Need Help?
If you encounter issues not covered here, please open an issue on GitHub.