GithubHelp home page GithubHelp logo

wendelladriel / adonis-api-skeleton Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 0.0 60 KB

Awesome AdonisJS boilerplate to create APIs using a DDD based architecture

JavaScript 100.00%
javascript api adonisjs skeleton architecture

adonis-api-skeleton's Introduction

AdonisJS API Skeleton

Awesome AdonisJS boilerplate to create APIs using a DDD based architecture

If you never worked with AdonisJS before, please give a look in its docs first

How this architecture works

The major changes were made in the app folder, so the files in bootstrap, config and database works the same way as described in the AdonisJS docs, there were only few changes in these folders, so you don't need to worry too much about them.

This boilerplate uses a DDD based architecture, so the main folders you will be working with will be: Domains and Modules folders. Below I will talk a little about the folders inside app:

  • Core: These are helper files that I created to make things simpler when working with this boilerplate, most likely that you don't need to change nothing here.

  • Domains: Here you will create the domains of your application, each domain will have one or more: models, repositories, resources (like messages), validators. Here you will put only domains that can be used and shared by your Modules.

  • Modules: Here you will create the modules of your application, think in each module as an micro service, they're independent and can use one or many Domains. Each module needs to define their own routes and will have one or more: controllers, resources (like messages), services.

  • Providers: Here you will find three files...

    • channels.js: File used to define Websocket channels that your application can use
    • events.js: File used to define Events that your application will run
    • routes.js: File used to define the Routes of your application, you only need to create an array with the modules you want to be loaded in your application.
  • Support: Here you can put helper files that can be used by any of your Modules and Domains.

How to use

  • Clone this repo and enter it

  • Install the dependencies

yarn
  • Copy the .env.example file to .env file
cp .env.example .env
  • Generate the application key
./ace key:generate
  • Run the migrations
./ace migration:run
  • Run the seeds
./ace db:seed

Commands available

  • To run the lint use
yarn lint
  • To run the app in development mode use
yarn serve:dev
  • To run the app in production mode use
yarn serve

Things that needs to be done

This boilerplate was made only for an example, so there are some things (important things) that still needs to be done like: tests, enhance the validation method, etc. Feel free to fork this repo and send some Pull Requests to help!!!

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/WendellAdriel/adonis-api-skeleton/. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

adonis-api-skeleton's People

Contributors

wendelladriel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.