This guide provides step-by-step instructions on setting up an Adonis.js project and running migrations. Adonis.js is a Node.js framework for building server-side applications.
Before getting started, ensure that you have the following installed on your machine:
- Node.js (v12 or later)
- npm (Node Package Manager)
-
Clone the repository or create a new directory for your project:
$ git clone <repository-url> $ cd <project-directory>
-
Install the project dependencies:
$ npm install
-
Create a
.env
file in the root directory of your project and copy the contents of.env.example
into it. Update the values of the environment variables in the.env
file to match your local environment. -
Generate an application key:
$ node ace generate:key
-
Run the application:
$ node ace serve --watch
-
Create a database for your project and update the
DB_CONNECTION
environment variable in the.env
file with the name of the database. -
Run the migrations:
$ node ace migration:run