This repo contains an AdonisJS application tailored for building an API server that responds with JSON.
- TypeScript setup with commands to run developments server using
ts-node + swcand create production build. - ESLint and Prettier setup extending the AdonisJS tooling config presets.
- Ace command line framework.
- Everything else you get with the core of AdonisJS.
On top of the framework core and dev-tooling, the following features are enabled by the API starter kit.
- Lucid ORM ( Installed, but not configured )
- Auth module ( Installed, but not configured )
- CORS
- VineJS for validations
You can create a new app using the api boilerplate by executing the following command. The command will perform the following steps.
- Clone the repo
- Install dependencies
- Copy
.env.exampleto.env - Set app key using
node ace generate:keycommand. - Configure
@adonisjs/lucidpackage. - Install and configure
@adonisjs/sessionpackage (if using auth session guard). - Configure
@adonisjs/authpackage.
npm init adonisjs -- -K=apiBy default, the npm init adonisjs command configures Lucid to use sqlite. However, you can define a custom database dialect as follows.
npm init adonisjs -- -K=api --db=postgresAvailable options for the --db flag.
- sqlite
- postgres
- mysql
- mssql
By default, the npm init adonisjs command configures the Auth package to use session guard. However, you can define a custom auth guard as follows.
npm init adonisjs -- -K=api --auth-guard=access_tokensAvailable options for the --auth-guard flag.
- session
- basic_auth
- access_tokens