Code Monkey home page Code Monkey logo

adonis-api-boilerplate's Introduction

AdonisJS API Boilerplate

PRs welcome! License
Created by Caio Domingues

Features

  • โšก๏ธ AdonisJS 5.4
  • ๐Ÿ“ฅ Lucid ORM
  • ๐Ÿ” Adonis Auth (Sessions, Basic Auth, API Tokens)
  • โ›‘ TypeScript
  • ๐Ÿ“ ESLint โ€” Find and fix problems in your code
  • ๐Ÿ’– Prettier โ€” Code Formatter for consistent style
  • โš™๏ธ CORS Production-only
  • โš™๏ธ EditorConfig - Maintain consistent coding styles across editors and IDEs\
  • โš™๏ธ Resource Command - Create a resource file for your model and customize endpoint responses

Quick Start

The best way to start with this template is using cloning the repo:

git clone https://github.com/caiodomingues/adonis-api-boilerplate.git

Since this boilerplate is a quickstart, you will need to configure Lucid ORM and Auth. Please make sure to do it in that order:

# select your options and follow the instructions for each database driver.
node ace configure @adonisjs/lucid

Make sure to edit your .env file with your database connection information.

# select your options and follow the instructions
node ace configure @adonisjs/auth

node ace migration:run

Development

After installing dependencies with your favorite package manager, start the project locally by running:

yarn dev
# or
npm run dev
# or even
node ace serve --watch

Open http://localhost:3333 with your browser to see the result. If you want to use a different port, just change the PORT variable in .env file.

Having troubles with CORS?

This boilerplate defines CORS active state by a function that returns true when the application is running in production.

Check config/cors.ts file and change the function to return false or uncomment the line up above to disable CORS.

Documentation

Requirements

  • Node.js >= 14.0.0
  • Your favorite package manager (i.e: npm, yarn)

Scripts

  • yarn dev โ€” Starts the application in development mode at http://localhost:3333.
  • yarn build โ€” Creates an optimized production build of your application.
  • yarn start โ€” Starts the application in production mode.
  • yarn lint โ€” Runs ESLint.
  • yarn format โ€” Runs Prettier.

Switch to npm

By default, this starter uses Yarn, but this choice is yours. If you'd like to switch to npm, delete the yarn.lock file, install the dependencies with npm install.

Removing unwanted dependencies

You don't need to use Lucid? Or maybe you don't need to use Auth? Feel free to remove it! This boilerplate is right before the configuration commands, so any unnecessary code trails won't be left behind.

License

This project is licensed under the MIT License - see the LICENSE file for more information.

adonis-api-boilerplate's People

Contributors

caiodomingues avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.