Skip to content
A starter kit for building Koa.JS based restful api
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
bin
src
.all-contributorsrc
.dockerignore
.drone.yml
.eslintignore
.eslintrc.js
.gitattributes
.gitignore
.npmrc
AUXILIN_README.md
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile
Dockerfile.dev
LICENSE
README.md
docker-compose.yml
package-lock.json
package.json

README.md

Koa.JS REST api starter

Auxilin.com — Production ready Node, React starter kit for building products at a warp speed

All Contributors license PRs Welcome Build Status David Dependancy Status

Watch on GitHub Star on GitHub Follow Tweet @auxilin

Fully featured Koa.JS restful api starter application. The goal of this project is to solve all routine tasks and keep your focus on the product and business logic of the application, not on the common things, such logging, configuration, dev/production environments

Out of the box support following features:

  1. Config management.
  2. Configured console logger based on common-logger
  3. Automatic application restart when code changes with Nodemon
  4. MongoDB configuration
  5. Docker configuration for development and production environments.
  6. Code linting based on @auxilin/eslint-config
  7. Simplified request data validation and clean up based on joi
  8. Production ready account API resource (singup, signin, forgot password, reset password functionality)
  9. JWT based authentication.
  10. Tests for endpoints.

Start

In order to start server in the docker container you can use bash file ./bin/start.sh:

$ ./bin/start.sh

To start the project not in the docker container just run: npm run development. This command will start the application on port 3001 and will automatically restart whenever you change any file in ./src directory.

Explanations of the files structure

We try to keep things as simple as possible, so you can focus on building product instead of learning concepts.

There are two main directories within project:

  1. src/config - consist of configuration for the environment, koa server and API routes.

  2. src/config/routes - consist of public (don't require jwt token) and authenticated (require jwt token) routes and middlewares.

    • middlewares - koa middlewares which we use on every request (for example, get current user data from the database)
  3. src/resources - REST api resources and everything related to the resource:

All other files, that does not fit that structure should be placed straight in the src folder. We can always introduce more folders as we need them. Currently root folder consist following:

  1. src/app.constants.js - constant variables that are used in the application
  2. src/app.js - starting point of the node.js application. It combine application configuration and start Koa http listener.
  3. src/auth.service.js - JWT based authentication helper. Consist logic of JWT token encryption/decryption. Can consist other authentication related functions.
  4. src/db.js - handles connection to the MongoDB.
  5. src/email.service.js - fake service for sending application emails.
  6. src/logger.js - application logger.
  7. src/security.util.js - number of methods for generating secure tokens and comparing passwords with password hash.

List of improvements

  1. Implement email service.

License

Koa.JS REST api starter is released under the MIT License.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Join us and share something developers need 👌.

Contributors

Thanks goes to these wonderful people (emoji key):


Evgeny Zhivitsa

💻 📖 🤔 👀 ⚠️

Andrew Orsich

📖 🤔 👀

This project follows the all-contributors specification. Contributions of any kind welcome!

You can’t perform that action at this time.