• Stars
    star
    795
  • Rank 54,917 (Top 2 %)
  • Language
    JavaScript
  • License
    ISC License
  • Created about 9 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ”’ Secure Hapi.js authentication plugin using JSON Web Tokens (JWT) in Headers, URL or Cookies

Hapi Auth using JSON Web Tokens (JWT)

The authentication scheme/plugin for Hapi.js apps using JSON Web Tokens

hapi-auth-jwt2-diagram-verify

Known Vulnerabilities GitHub Workflow Status codecov.io Inline docs HAPI 21.1.0 Node.js Version contributions welcome HitCount npm package version

This node.js module (Hapi plugin) lets you use JSON Web Tokens (JWTs) for authentication in your Hapi.js web application.

If you are totally new to JWTs, we wrote an introductory post explaining the concepts & benefits: https://github.com/dwyl/learn-json-web-tokens

If you (or anyone on your team) are unfamiliar with Hapi.js we have a quick guide for that too: https://github.com/dwyl/learn-hapi

Other language documents:

Usage

We tried to make this plugin as user (developer) friendly as possible, but if anything is unclear, please submit any questions as issues on GitHub: https://github.com/dwyl/hapi-auth-jwt2/issues

Install from NPM

npm install hapi-auth-jwt2 --save

Example

This basic usage example should help you get started:

const Hapi = require('@hapi/hapi');

const people = { // our "users database"
    1: {
      id: 1,
      name: 'Jen Jones'
    }
};

// bring your own validation function
const validate = async function (decoded, request, h) {

    // do your checks to see if the person is valid
    if (!people[decoded.id]) {
      return { isValid: false };
    }
    else {
      return { isValid: true };
    }
};

const init = async () => {
  const server = new Hapi.server({ port: 8000 });
  // include our module here โ†“โ†“, for example, require('hapi-auth-jwt2')
  await server.register(require('../lib'));
  server.auth.strategy('jwt', 'jwt',
  { key: 'NeverShareYourSecret', // Never Share your secret key
    validate  // validate function defined above
  });

  server.auth.default('jwt');

  server.route([
    {
      method: "GET", path: "/", config: { auth: false },
      handler: function(request, h) {
        return {text: 'Token not required'};
      }
    },
    {
      method: 'GET', path: '/restricted', config: { auth: 'jwt' },
      handler: function(request, h) {
        const response = h.response({text: 'You used a Token!'});
        response.header("Authorization", request.headers.authorization);
        return response;
      }
    }
  ]);
  await server.start();
  return server;
}
init().then(server => {
  console.log('Server running at:', server.info.uri);
})
.catch(err => {
  console.log(err);
});

Quick Demo

Open your terminal and clone this repo:

git clone https://github.com/dwyl/hapi-auth-jwt2.git && cd hapi-auth-jwt2

Run the server with:

npm install && node example/server.js

Now (in a different terminal window) use cURL to access the two routes:

No Token Required

curl -v http://localhost:8000/

Token Required

Try to access the /restricted content without supplying a Token (expect to see a 401 error):

curl -v http://localhost:8000/restricted

or visit: http://localhost:8000/restricted in your web browser. (both requests will be blocked and return a 401 Unauthorized error)

Now access the url using the following format: curl -H "Authorization: <TOKEN>" http://localhost:8000/restricted

A here's a valid token you can use (copy-paste this command):

curl -v -H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwibmFtZSI6IkFudGhvbnkgVmFsaWQgVXNlciIsImlhdCI6MTQyNTQ3MzUzNX0.KA68l60mjiC8EXaC2odnjFwdIDxE__iDu5RwLdN1F2A" \
http://localhost:8000/restricted

or visit this url in your browser (passing the token in url):

http://localhost:8000/restricted?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwibmFtZSI6IkFudGhvbnkgVmFsaWQgVXNlciIsImlhdCI6MTQyNTQ3MzUzNX0.KA68l60mjiC8EXaC2odnjFwdIDxE__iDu5RwLdN1F2A

That's it.

Now write your own validate with what ever checks you want to perform on the decoded token before allowing the visitor to proceed.

Documentation

  • key - (required - unless you have a customVerify function) the secret key (or array of potential keys) used to check the signature of the token or a key lookup function with signature async function(decoded) where:
    • decoded - the decoded but unverified JWT received from client
    • Returns an object { key, extraInfo } where:
      • key - the secret key (or array of keys to try)
      • extraInfo - (optional) any additional information that you would like to use in validate which can be accessed via request.plugins['hapi-auth-jwt2'].extraInfo
    • Throws a Boom error when key lookup fails. Refer to this example implementation and its associated test for a working example.
  • validate - (required) the function which is run once the Token has been decoded with signature async function(decoded, request, h) where:
    • decoded - (required) is the decoded and verified JWT received in the request
    • request - (required) is the original request received from the client
    • h - (required) the response toolkit.
    • Returns an object { isValid, credentials, response } where:
      • isValid - true if the JWT was valid, otherwise false.
      • credentials - (optional) alternative credentials to be set instead of decoded.
      • response - (optional) If provided will be used immediately as a takeover response.
      • errorMessage - (optional defaults to 'Invalid credentials') - the error message raised to Boom if the token is invalid (passed to errorFunc as errorContext.message)

Optional Parameters

  • verifyOptions - (optional defaults to none) settings to define how tokens are verified by the jsonwebtoken library
    • ignoreExpiration - ignore expired tokens
    • audience - do not enforce token audience
    • issuer - do not require the issuer to be valid
    • algorithms - list of allowed algorithms
  • responseFunc - (optional) function called to decorate the response with authentication headers before the response headers or payload is written where:
    • request - the request object.
    • h- the response toolkit.
  • errorFunc - (optional defaults to raising the error requested) function called when an error has been raised. It provides an extension point to allow the host the ability to customise the error messages returned. Passed in object follows the following schema:
    • errorContext - the error object.
      • errorContext.errorType - required the Boom method to call (eg. unauthorized)
      • errorContext.message - required the message passed into the Boom method call
      • errorContext.schema - the schema passed into the Boom method call
      • errorContext.attributes - the attributes passed into the Boom method call
      • The function is expected to return the modified errorContext with all above fields defined.
    • request - the request object.
    • h- the response toolkit.
  • urlKey - (optional defaults to 'token') - if you prefer to pass your token via url, simply add a token url parameter to your request or use a custom parameter by setting urlKey. To disable the url parameter set urlKey to false or ''.
  • cookieKey - (optional defaults to 'token') - if you prefer to set your own cookie key or your project has a cookie called 'token' for another purpose, you can set a custom key for your cookie by setting options.cookieKey='yourkeyhere'. To disable cookies set cookieKey to false or ''.
  • headerKey - (optional defaults to 'authorization') - The lowercase name of an HTTP header to read the token from. To disable reading the token from a header, set this to false or ''.
  • payloadKey - (optional defaults to 'token') - The lowercase name of an HTTP POST body to read the token from. To disable reading the token from a payload, set this to false or ''. Please note, this will not prevent authentication falling through to the payload method unless attemptToExtractTokenInPayload is false
  • tokenType - (optional defaults to none) - allow custom token type, e.g. Authorization: <tokenType> 12345678.
  • complete - (optional defaults to false) - set to true to receive the complete token (decoded.header, decoded.payload and decoded.signature) as decoded argument to key lookup and verify callbacks (not validate)
  • headless - (optional defaults to none) - set to an object containing the header part of the JWT token that should be added to a headless JWT token received. Token's with headers can still be used with this option activated. e.g { alg: 'HS256', typ: 'JWT' }
  • attemptToExtractTokenInPayload - (optional defaults to false) - set to true to let the authenticate method fall through to the payload method for token extraction
  • customExtractionFunc - (optional) function called to perform a custom extraction of the JWT where:
    • request - the request object.

Useful Features

  • The encoded JWT (token) is extracted from the request and made available on the request object as request.auth.token, in case you need it later on in the request lifecycle. This feature was requested by @mcortesi in hapi-auth-jwt2/issues/123

Understanding the Request Flow

At the simplest level this is the request flow through a Hapi App using hapi-auth-jwt2:

hapi auth request flow

verifyOptions let you define how to Verify the Tokens (Optional)

example:

server.auth.strategy('jwt', 'jwt', true,
{ key: 'NeverShareYourSecret', // Never Share your secret key
  validate: validate,      // validate function defined above
  verifyOptions: {
    ignoreExpiration: true,    // do not reject expired tokens
    algorithms: [ 'HS256' ]    // specify your secure algorithm
  }
});

Read more about this at: jsonwebtoken verify options

Specify Signing Algorithm (Optional but highly recommended)

For security reasons it is recommended that you specify the allowed algorithms used when signing the tokens:

server.auth.strategy('jwt', 'jwt', true,
{ key: 'YourSuperLongKeyHere', // Never Share your secret key
  validate: validate,      // validate function defined above
  verifyOptions: { algorithms: [ 'HS256' ] }  // only allow HS256 algorithm
});

If you prefer not to use any of these verifyOptions simply do not set them when registering the plugin with your app; they are all optional.

This feature was requested in: issues/29

Using Base64 encoded secret keys

Some authentication services (like Auth0) provide secret keys encoded in base64, To find out if your authentication service is one of these services, please try and experiment with the base64 encoded secret options on the validator at https://jwt.io

If your key is base64 encoded, then for JWT2 to use it you need to convert it to a Buffer. Following is an example of how to do this.

server.auth.strategy('jwt', 'jwt', true,
{ key: Buffer.from('<Your Base64 encoded secret key>', 'base64'), // Never Share your secret key
  validate: validate,      // validate function defined above
  verifyOptions: { algorithms: [ 'HS256' ] }  // only allow HS256 algorithm
});

Authentication Modes

This plugin supports authentication modes on routes.

  • required - requires JWT to be sent with every request

  • optional - if no JWT is provided, request will pass with request.auth.isAuthenticated set to false and request.auth.credentials set to null

  • try - similar to optional, but invalid JWT will pass with request.auth.isAuthenticated set to false and failed credentials provided in request.auth.credentials

Additional notes on keys and key lookup functions

  • This option to look up a secret key was added to support "multi-tenant" environments. One use case would be companies that white label API services for their customers and cannot use a shared secret key. If the key lookup function needs to use fields from the token header (e.g. x5t header), set option completeToken to true.

  • The reason why you might want to pass back extraInfo in the callback is because you likely need to do a database call to get the key which also probably returns useful user data. This could save you another call in validate.

  • The key or value returned by the key lookup function can also be an array of keys to try. Keys will be tried until one of them successfully verifies the signature. The request will only be unauthorized if ALL of the keys fail to verify. This is useful if you want to support multiple valid keys (like continuing to accept a deprecated key while a client switches to a new key).

server.auth.strategy('jwt', 'jwt', true,
{ key: [ 'PrimareSecretKey', 'DeprecatedKeyStillAcceptableForNow' ],
  validate: validate,
  verifyOptions: { algorithms: [ 'HS256' ] }
});

URL (URI) Token

Several people requested the ability pass in JSNOWebTokens in the requested URL: dwyl/hapi-auth-jwt2/issues/19

Usage

Setup your hapi.js server as described above (no special setup for using JWT tokens in urls)

https://yoursite.co/path?token=your.jsonwebtoken.here

You will need to generate/supply a valid tokens for this to work.

const JWT   = require('jsonwebtoken');
const obj   = { id:123,"name":"Charlie" }; // object/info you want to sign
const token = JWT.sign(obj, secret);
const url   = "/path?token="+token;

What if I want to disable the ability to pass JWTs in via the URL? Set your urlKey to false or ''. (added by @bitcloud: issue #146)

Generating Your Secret Key

@skota asked "How to generate secret key?" in: dwyl/hapi-auth-jwt2/issues/48

There are several options for generating secret keys. The easiest way is to run Node's crypto hash in your terminal:

node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"

and copy the resulting base64 key and use it as your JWT secret.

Want to access the JWT token after validation?

@mcortesi requested the ability to access the (raw) JWT token used for authentication. dwyl/hapi-auth-jwt2/issues/123

You can access the extracted JWT token in your handler or any other function within the request lifecycle with the request.auth.token property.

Note that this is the encoded token, and it's only useful if you want to use to make request to other servers using the user's token.

The decoded version of the token, accessible via request.auth.credentials

Want to send/store your JWT in a Cookie?

@benjaminlees requested the ability to send/receive tokens as cookies: dwyl/hapi-auth-jwt2/issues/55 So we added the ability to optionally send/store your tokens in cookies to simplify building your web app.

To enable cookie support in your application all you need to do is add a few lines to your code:

Cookie Options

Firstly set the options you want to apply to your cookie:

const cookie_options = {
  ttl: 365 * 24 * 60 * 60 * 1000, // expires a year from today
  encoding: 'none',    // we already used JWT to encode
  isSecure: true,      // warm & fuzzy feelings
  isHttpOnly: true,    // prevent client alteration
  clearInvalid: false, // remove invalid cookies
  strictHeader: true   // don't allow violations of RFC 6265
}

Set the Cookie on your reply

Then, in your authorisation handler

reply({text: 'You have been authenticated!'})
.header("Authorization", token)        // where token is the JWT
.state("token", token, cookie_options) // set the cookie with options

For a detailed example please see: https://github.com/nelsonic/hapi-auth-jwt2-cookie-example

Background Reading (Cookies)


Frequently Asked Questions (FAQ)

Do I need to include jsonwebtoken in my project?

Q: Must I include the jsonwebtoken package in my project [given that hapi-auth-jwt2 plugin already includes it] ? asked in hapi-auth-jwt2/issues/32
A: Yes, you need to manually install the jsonwebtoken node module from NPM with npm install jsonwebtoken --save if you want to sign JWTs in your app. Even though hapi-auth-jwt2 includes it as a dependency your app does not know where to find it in the node_modules tree for your project. Unless you include it via relative path e.g: const JWT = require('./node_modules/hapi-auth-jwt2/node_modules/jsonwebtoken'); we recommend including it in your package.json explicitly as a dependency for your project.

Custom Verification ?

Can we supply a Custom Verification function instead of using the JWT.verify method?
asked by both Marcus Stong & Kevin Stewart in issue #120 and issue #130 respectively. Q: Does this module support custom verification function or disabling verification? A: Yes, it does now! (see: "Advanced Usage" below) the inclusion of a verify gives you complete control over the verification of the incoming JWT.


Can I use hapi-auth-jwt2 with glue

Several people asked us if this plugin is compatible with Hapi's "Server Composer" glue

The answer is Yes! For an example of how to do this, see @avanslaars code example: #151 (comment)


How do I invalidate an existing token?

Asked by @SanderElias in hapi-auth-jwt2/issues/126

We store our JWT-based sessions in a Redis datastore and lookup the session (jti) for the given JWT during the validate (validation function) see: https://github.com/dwyl/hapi-auth-jwt2-example/blob/791b0d3906d4deb256daf23fcf8f5021905abe9e/index.js#L25 This means we can invalidate the session in Redis and then reject a request that uses an "old" or invalid JWT. see: https://github.com/dwyl/hapi-auth-jwt2-example/blob/791b0d3906d4deb256daf23fcf8f5021905abe9e/index.js#L25


How do I set JWT Auth to All Routes?

@abeninskibede asked how to set all routes to use JWT Auth in hapi-auth-jwt2/issues/149

We tend to enable hapi-auth-jwt2 for all routes by setting the default strategy to 'jwt' (so its required for all endpoints) because most of the endpoints in our app require the person/user to be authenticated e.g:

server.auth.strategy('jwt', 'jwt', {
  ...
});
server.auth.default('jwt'); // so JWT auth is required for all routes

When you want a particular route to not require JWT auth you simply set config: { auth: false } e.g:

server.route({
  method: 'GET',
  path: '/login',
  handler: login_handler,  // display login/registration form/page
  options: { auth: false } // don't require people to be logged in to see the login page! (duh!)
});

The best place to *understand* everything about Hapi Auth is in the docs: [https://hapi.dev/tutorials/auth/#default](https://hapi.dev/tutorials/auth/#default) But if you have any questions which are not answered there, feel free to [ask!](https://github.com/dwyl/hapi-auth-jwt2/issues)

How to redirect if a token has expired?

@traducer & @goncalvesr2 both requested how to redirect after failed Auth in hapi-auth-jwt2/issues/161 and hapi-auth-jwt2/issues/148 respectively

The hapi-error lets you easily redirect to any url you define if the Auth check fails (i.e. statusCode 401) see: https://github.com/dwyl/hapi-error#redirectredirecting-to-another-endpoint (code examples there.)


How do I change my token and re-state it without becoming unauthenticated?

For example:

If the request.auth.credentials object initially added to your / endpoint initial was:

{
  userId: 1,
  permission: 'ADMIN'
}

And you want to change the user's permission to SUPER_ADMIN.

Retrieve the initial session object added as a token to /

const session  = request.auth.credentials;

Change the object

session.permission = 'SUPER_ADMIN';

Sign as a JWT token again

const token = JWT.sign(session, process.env.JWT_SECRET);

Reply as usual whilst re-adding the token to your original endpoint /

reply().state('token', token, { path: '/' }).redirect('/wherever');

How do I support users with JS disabled

An issue can arise when supporting users with JavaScript disabled when JWTs are too large to pass on query strings.

With JS disabled, tokens cannot be added to headers by using redirects from OAuth providers in to the consuming service.

Cloud providers will place limitations on URI lengths

OAuth services may not always sit on a sibling subdomain of the protected service negating the use of a secure cookie

The only way to pass a token in this case is to use either an HTML form with the token in a hidden field and a button with instructions for users to press the button if they have JS disabled and some JS that will submit the form automatically if it is enabled

To configure hapi-auth-jwt to support this scenario, you will need to adapt the following sample configuration

server.auth.strategy('jwt', 'jwt', {
  key: 'NeverShareYourSecret',
  // defining our own validate function lets us do something
  // useful/custom with the decodedToken before reply(ing)
  validate: (decoded, request) => true,
  verifyOptions: { algorithms: [ 'HS256' ] }, // only allow HS256 algorithm
  attemptToExtractTokenInPayload: true,
  // using yar as a session cache to store tokens, see: https://github.com/hapijs/yar
  customExtractionFunc: request => {
    if (request.auth && request.auth.token) {
      request.yar.set('token', request.auth.token)
      return request.auth.token;
    }
    const token = request.yar.get('token');
    if (token) {
      return token;
    }
  }
});

The configuration above will still run the normal token extraction attempts for headers, cookies, query string parameters and custom extraction. However, if there is no token successfully extracted, it will attempt to extract one from POST request bodies

As the authentication phase of a HAPI request will apply scope protection before POST bodies are parsed, you will need to also define the route on which you will handle JWTs with no scope applied or the POST requests with JWT payloads will fail when you globally apply scope as part of your application

server.route([
      {
        method: 'POST',
        path: '/',
        handler: (request, response) => response.redirect('/home'),
        config: {
            auth: {
              strategies: ['jwt'],
              payload: 'required'
            }
          }
        }
      ]);

This route will, when a JWT is posted failover from the authentication phase to the payload authentication phase, extract a JWT, store it in the YAR session cache and redirect the user to the /home path using a standard 302 response. When the handler for /home is JWT protected, the customExtractionFunc defined in the auth strategy will read the JWT from the users session cache and use it for authentication

Advanced/Alternative Usage => Bring Your Own verify

While most people using hapi-auth-jwt2 will opt for the simpler use case (using a Validation Function validate - see: Basic Usage example above - which validates the JWT payload after it has been verified...) others may need more control over the verify step.

The internals of hapi-auth-jwt2 use the jsonwebtoken.verify method to verify if the JWT was signed using the JWT_SECRET (secret key).

If you prefer specifying your own verification logic instead of having a validate, simply define a verify instead when initializing the plugin.

  • verify - (optional) the function which is run once the Token has been decoded (instead of a validate) with signature async function(decoded, request) where:
    • decoded - (required) is the decoded but unverified JWT received in the request.
    • request - (required) is the original request received from the client
    • Returns an object { isValid, credentials } where:
      • isValid - true if the JWT was valid, otherwise false.
      • credentials - (optional) alternative credentials to be set instead of decoded.

The advantage of this approach is that it allows people to write a custom verification function or to bypass the JWT.verify completely. For more detail, see: use-case discussion in #120

Note: nobody has requested the ability to use both a validate and verify. This should not be necessary because with a verify you can incorporate your own custom-logic.


Compatibility

hapi-auth-jwt2 version 10.x.x is an optional upgrade that includes a breaking change. Several users of the plugin requested that the artifacts returned on successful authentication be an Object instead of a String. Sadly this is a breaking change, hence the new major release.

hapi-auth-jwt2 version 9.x.x is compatible with Hapi.js 19.x.x which only supports Node.js 12+. While hapi-auth-jwt2 version 9.0.0 does not have any code changes from v8.8.1 (so there should not be any need to update your code that uses this plugin), we felt it was prudent to make it clear to people that Hapi.js (the core framework) has dropped support for Node.js 10 and people should treat this package as no longer supporting the older versions of Node.

hapi-auth-jwt2 version 8.x.x is compatible with Hapi.js version 17.x.x - 19.x.x

hapi-auth-jwt2 version 7.x.x is compatible with 16.x.x 15.x.x 14.x.x 13.x.x 12.x.x 11.x.x 10.x.x 9.x.x and 8.x.x Hapi 17.x.x is a major rewrite that's why version 8.x.x of the plugin is not backward compatible!

However in the interest of security/performance we recommend using the latest version of Hapi.

If you have a question, or need help getting started please post an issue/question on GitHub: https://github.com/dwyl/hapi-auth-jwt2/issues



Production-ready Examples?

Using PostgreSQL?

See: https://github.com/dwyl/hapi-login-example-postgres

Using Redis

Redis is perfect for storing session data that needs to be checked on every authenticated request.

If you are unfamiliar with Redis or anyone on your team needs a refresher, please checkout: https://github.com/dwyl/learn-redis

The code is at: https://github.com/dwyl/hapi-auth-jwt2-example and with tests. please ask additional questions if unclear!

Having a more real-world example was seconded by @manonthemat see: hapi-auth-jwt2/issues/9

Real World Example ?

If you would like to see a "real world example" of this plugin in use in a production web app (API) please see: https://github.com/dwyl/time/tree/main/api/lib

If you have any questions on this please post an issue/question on GitHub: https://github.com/dwyl/hapi-auth-jwt2/issues (we are here to help get you started on your journey to hapiness!)



Contributing contributions welcome

If you spot an area for improvement, please raise an issue: https://github.com/dwyl/hapi-auth-jwt2/issues
Someone in the dwyl team is always online so we will usually answer within a few hours.

Motivation

While making Time we want to ensure our app (and API) is as simple as possible to use. This lead us to using JSON Web Tokens for Stateless Authentication.

We did a extensive research into existing modules that might solve our problem; there are many on NPM: npm search for hapi+jwt

but they were invariably too complicated, poorly documented and had useless (non-real-world) "examples"!

Also, none of the existing modules exposed the request object to the validate which we thought might be handy.

So we decided to write our own module addressing all these issues.

Don't take our word for it, do your own homework and decide which module you prefer.

Why hapi-auth-jwt2 ?

The name we wanted was taken. Think of our module as the "new, simplified and actively maintained version"

Useful Links

Hapi.js Auth

We borrowed code from the following:

(Ryan made a good start - however, when we tried to submit a pull request to improve (security) it was ignored for weeks ... an authentication plugin that ignores security updates in dependencies is a no-go for us; security matters!) If you spot any issue in hapi-auth-jwt2 please create an issue: https://github.com/dwyl/hapi-auth-jwt2/issues so we can get it resolved ASAP!

Aparently, .some people like it...:

https://nodei.co/npm/hapi-auth-jwt2.png?downloads=true&downloadRank=true&stars=true

More Repositories

1

english-words

๐Ÿ“ A text file containing 479k English words for all your dictionary/word-based projects e.g: auto-completion / autosuggestion
Python
9,337
star
2

learn-json-web-tokens

๐Ÿ” Learn how to use JSON Web Token (JWT) to secure your next Web App! (Tutorial/Example with Tests!!)
JavaScript
4,178
star
3

learn-to-send-email-via-google-script-html-no-server

๐Ÿ“ง An Example of using an HTML form (e.g: "Contact Us" on a website) to send Email without a Backend Server (using a Google Script) perfect for static websites that need to collect data.
HTML
3,047
star
4

repo-badges

โญ Use repo badges (build passing, coverage, etc) in your readme/markdown file to signal code quality in a project.
HTML
2,831
star
5

learn-tdd

โœ… A brief introduction to Test Driven Development (TDD) in JavaScript (Complete Beginner's Step-by-Step Tutorial)
JavaScript
2,698
star
6

start-here

๐Ÿ’ก A Quick-start Guide for People who want to dwyl โค๏ธ โœ…
1,725
star
7

learn-elixir

๐Ÿ’ง Learn the Elixir programming language to build functional, fast, scalable and maintainable web applications!
Elixir
1,586
star
8

learn-travis

๐Ÿ˜Ž A quick Travis CI (Continuous Integration) Tutorial for Node.js developers
JavaScript
1,251
star
9

Javascript-the-Good-Parts-notes

๐Ÿ“– Notes on the seminal "JavaScript the Good Parts: by Douglas Crockford
1,173
star
10

aws-sdk-mock

๐ŸŒˆ AWSomocks for Javascript/Node.js aws-sdk tested, documented & maintained. Contributions welcome!
JavaScript
1,079
star
11

learn-aws-lambda

โœจ Learn how to use AWS Lambda to easily create infinitely scalable web services
JavaScript
1,035
star
12

book

๐Ÿ“— Our Book on Full-Stack Web Application Development covering User Experience (UX) Design, Mobile/Offline/Security First, Progressive Enhancement, Continuous Integration/Deployment, Testing (UX/TDD/BDD), Performance-Driven-Development and much more!
Rust
816
star
13

learn-hapi

โ˜€๏ธ Learn to use Hapi.js (Node.js) web framework to build scalable apps in less time
HTML
794
star
14

phoenix-chat-example

๐Ÿ’ฌ The Step-by-Step Beginners Tutorial for Building, Testing & Deploying a Chat app in Phoenix 1.7 [Latest] ๐Ÿš€
Elixir
721
star
15

learn-tachyons

๐Ÿ˜ Learn how to use Tachyons to craft beautiful, responsive and fast UI with functional CSS!
HTML
670
star
16

learn-phoenix-framework

๐Ÿ”ฅ Phoenix is the web framework without compromise on speed, reliability or maintainability! Don't settle for less. ๐Ÿš€
Elixir
639
star
17

learn-nightwatch

๐ŸŒœ Learn how to use Nightwatch.js to easily & automatically test your web apps in *real* web browsers.
JavaScript
585
star
18

javascript-todo-list-tutorial

โœ… A step-by-step complete beginner example/tutorial for building a Todo List App (TodoMVC) from scratch in JavaScript following Test Driven Development (TDD) best practice. ๐ŸŒฑ
JavaScript
565
star
19

learn-elm

๐ŸŒˆ discover the beautiful programming language that makes front-end web apps a joy to build and maintain!
HTML
472
star
20

learn-redux

๐Ÿ’ฅ Comprehensive Notes for Learning (how to use) Redux to manage state in your Web/Mobile (React.js) Apps.
HTML
446
star
21

learn-devops

๐Ÿšง Learn the craft of "DevOps" (Developer Operations) to Deploy your App and Monitor it so it stays "Up"!
Shell
411
star
22

hits

๐Ÿ“ˆ General purpose hits (page views) counter
Elixir
397
star
23

hapi-socketio-redis-chat-example

๐Ÿ’ฌ Real-time Chat using Hapi.js + Socket.io + Redis Pub/Sub (example with tests!!)
Elm
363
star
24

hapi-typescript-example

โšก Hapi.Js + Typescript = Awesomeness
TypeScript
351
star
25

phoenix-liveview-counter-tutorial

๐Ÿคฏ beginners tutorial building a real time counter in Phoenix 1.7.7 + LiveView 0.19 โšก๏ธ Learn the fundamentals from first principals so you can make something amazing! ๐Ÿš€
Elixir
345
star
26

learn-istanbul

๐Ÿ Learn how to use the Istanbul JavaScript Code Coverage Tool
JavaScript
339
star
27

learn-redis

๐Ÿ“• Need to store/access your data as fast as possible? Learn Redis! Beginners Tutorial using Node.js ๐Ÿš€
JavaScript
291
star
28

technology-stack

๐Ÿš€ Detailed description + diagram of the Open Source Technology Stack we use for dwyl projects.
JavaScript
281
star
29

phoenix-ecto-encryption-example

๐Ÿ” A detailed example for how to encrypt data in an Elixir (Phoenix v1.7) App before inserting into a database using Ecto Types
Elixir
269
star
30

learn-elasticsearch

๐Ÿ” Learn how to use ElasticSearch to power a great search experience for your project/product/website.
Elixir
265
star
31

home

๐Ÿก ๐Ÿ‘ฉโ€๐Ÿ’ป ๐Ÿ’ก home is where you can [learn to] build the future surrounded by like-minded creative, friendly and [intrinsically] motivated people focussed on health, fitness and making things people and the world need!
245
star
32

elixir-auth-google

๐Ÿ‘คMinimalist Google OAuth Authentication for Elixir Apps. Tested, Documented & Maintained. Setup in 5 mins. ๐Ÿš€
Elixir
228
star
33

learn-docker

๐Ÿšข Learn how to use docker.io containers to consistently deploy your apps on any infrastructure.
Dockerfile
220
star
34

learn-elm-architecture-in-javascript

๐Ÿฆ„ Learn how to build web apps using the Elm Architecture in "vanilla" JavaScript (step-by-step TDD tutorial)!
JavaScript
207
star
35

learn-environment-variables

๐Ÿ“Learn how to use Environment Variables to keep your passwords and API keys secret. ๐Ÿ”
JavaScript
201
star
36

learn-postgresql

๐Ÿ˜ Learn how to use PostgreSQL and Structured Query Language (SQL) to store and query your relational data. ๐Ÿ”
JavaScript
195
star
37

learn-tape

โœ… Learn how to use Tape for JavaScript/Node.js Test Driven Development (TDD) - Ten-Minute Testing Tutorial
JavaScript
185
star
38

sendemail

๐Ÿ’Œ Simplifies reliably sending emails from your node.js apps using AWS Simple Email Service (SES)
JavaScript
181
star
39

phoenix-todo-list-tutorial

โœ… Complete beginners tutorial building a todo list from scratch in Phoenix 1.7 (latest)
Elixir
171
star
40

decache

:shipit: Delete Cached node_modules useful when you need to "un-require" during testing for a fresh state.
JavaScript
151
star
41

quotes

๐Ÿ’ฌ a curated list of quotes that inspire action + code that returns quotes by tag/author/etc. ๐Ÿ’ก
Elixir
150
star
42

learn-heroku

๐Ÿ Learn how to deploy your web application to Heroku from scratch step-by-step in 7 minutes!
Python
149
star
43

learn-chrome-extensions

๐ŸŒ Discover how to build and deploy a Google Chrome Extension for your Project!
139
star
44

labels

๐Ÿท Sync GitHub Labels from any Source to Target Repositories for Consistency across all your projects!
Elixir
136
star
45

ISO-27001-2013-information-technology-security

๐Ÿ” Probably the most boring-but-necessary repo on GitHub. If you care about the security/privacy of your data...! โœ…
136
star
46

learn-ab-and-multivariate-testing

๐Ÿ†Ž Tutorial on A/B and multivariate testing โœ”๏ธ
135
star
47

web-form-to-google-sheet

A simple example of sending data from an ordinary web form straight to a Google Spreadsheet without a server.
HTML
133
star
48

app

Clear your mind. Organise your life. Ignore distractions. Focus on what matters.
Dart
133
star
49

auth

๐Ÿšช ๐Ÿ” UX-focussed Turnkey Authentication Solution for Web Apps/APIs (Documented, Tested & Maintained)
Elixir
124
star
50

learn-circleci

โœ… A quick intro to Circle CI (Continuous Integration) for JavaScript developers.
121
star
51

learn-regex

โ‰๏ธ A simple REGular EXpression tutorial in JavaScript
120
star
52

learn-react

"The possibilities are numerous once we decide to act and not react." ~ George Bernard Shaw
HTML
108
star
53

learn-aws-iot

๐Ÿ’ก Learn how to use Amazon Web Services Internet of Things (IoT) service to build connected applications.
JavaScript
101
star
54

env2

๐Ÿ’ป Simple environment variable (from config file) loader for your node.js app
JavaScript
100
star
55

phoenix-liveview-chat-example

๐Ÿ’ฌ Step-by-step tutorial creates a Chat App using Phoenix LiveView including Presence, Authentication and Style with Tailwind CSS
Elixir
98
star
56

how-to-choose-a-database

How to choose the right dabase
93
star
57

imgup

๐ŸŒ… Effortless image uploads to AWS S3 with automatic resizing including REST API.
Elixir
88
star
58

contributing

๐Ÿ“‹ Guidelines & Workflow for people contributing to our project(s) on GitHub. Please โญ to confirm you've read & understood! โœ…
85
star
59

javascript-best-practice

A collection of JavaScript Best Practices
83
star
60

learn-amazon-web-services

โญ Amazing Guide to using Amazon Web Services (AWS)! โ˜๏ธ
83
star
61

range-touch

๐Ÿ“ฑ Use HTML5 range input on touch devices (iPhone, iPad & Android) without bloatware!
JavaScript
83
star
62

learn-pre-commit

โœ… Pre-commit hooks let you run checks before allowing a commit (e.g. JSLint or check Test Coverage).
JavaScript
80
star
63

product-owner-guide

๐Ÿš€ A rough guide for people working with dwyl as Product Owners
78
star
64

phoenix-ecto-append-only-log-example

๐Ÿ“ A step-by-step example/tutorial showing how to build a Phoenix (Elixir) App where all data is immutable (append only). Precursor to Blockchain, IPFS or Solid!
Elixir
78
star
65

mvp

๐Ÿ“ฒ simplest version of the @dwyl app
Elixir
78
star
66

goodparts

๐Ÿ™ˆ An ESLint Style that only allows JavaScript the Good Parts (and "Better Parts") in your code.
JavaScript
77
star
67

hapi-error

โ˜” Intercept errors in your Hapi Web App/API and send a *useful* message to the client OR redirect to the desired endpoint.
JavaScript
76
star
68

flutter-todo-list-tutorial

โœ… A detailed example/tutorial building a cross-platform Todo List App using Flutter ๐Ÿฆ‹
Dart
75
star
69

process-handbook

๐Ÿ“— Contains our processes, questions and journey to creating a team
HTML
75
star
70

dev-setup

โœˆ๏ธ A quick-start guide for new engineers on how to set up their Dev environment
73
star
71

aws-lambda-deploy

โ˜๏ธ ๐Ÿš€ Effortlessly deploy Amazon Web Services Lambda function(s) with a single command. Less to configure. Latest AWS SDK and Node.js v20!
JavaScript
72
star
72

terminate

โ™ป๏ธ Terminate a Node.js Process (and all Child Processes) based on the Process ID
JavaScript
71
star
73

fields

๐ŸŒป fields is a collection of useful field definitions (Custom Ecto Types) that helps you easily define an Ecto Schema with validation, encryption and hashing functions so that you can ship your Elixir/Phoenix App much faster!
Elixir
69
star
74

learn-flutter

๐Ÿฆ‹ Learn how to use Flutter to Build Cross-platform Native Mobile Apps
JavaScript
69
star
75

hapi-login-example-postgres

๐Ÿฐ A simple registration + login form example using hapi-register, hapi-login & hapi-auth-jwt2 with a PostgreSQL DB
JavaScript
69
star
76

phoenix-liveview-todo-list-tutorial

โœ… Beginners tutorial building a Realtime Todo List in Phoenix 1.6.10 + LiveView 0.17.10 โšก๏ธ Feedback very welcome!
Elixir
64
star
77

learn-security

๐Ÿ” For most technology projects Security is an "after thought", it does not have to be that way; let's be proactive!
64
star
78

learn-javascript

A Series of Simple Steps in JavaScript :-)
HTML
63
star
79

chat

๐Ÿ’ฌ Probably the fastest, most reliable/scalable chat system on the internet.
Elixir
62
star
80

learn-jsdoc

๐Ÿ“˜ Use JSDoc and a few carefully crafted comments to document your JavaScript code!
CSS
60
star
81

ampl

๐Ÿ“ฑ โšก Ampl transforms Markdown into AMP-compliant html so it loads super-fast!
JavaScript
57
star
82

aguid

โ„๏ธ A Globally Unique IDentifier (GUID) generator in JS. (deterministic or random - you chose!)
JavaScript
56
star
83

tudo

โœ… Want to see where you could help on an open dwyl issue?
Elixir
56
star
84

learn-apple-watch-development

๐Ÿ“— Learn how to build Native Apple Watch (+iPhone) apps from scratch!
Swift
55
star
85

learn-qunit

โœ… A quick introduction to JavaScript unit testing with QUnit
JavaScript
51
star
86

learn-ngrok

โ˜๏ธ Learn how to use ngrok to share access to a Web App/Site running on your "localhost" with the world!
HTML
50
star
87

hapi-auth-jwt2-example

๐Ÿ”’ A functional example Hapi.js app using hapi-auth-jwt2 & Redis (hosted on Heroku) with tests!
JavaScript
49
star
88

learn-jshint

๐Ÿ’ฉ Learn how to use the ~~jshint~~ code quality/consistency tool.
JavaScript
49
star
89

tachyons-bootstrap

๐Ÿ‘ขBootstrap recreated using tachyons functional css
HTML
49
star
90

esta

๐Ÿ” Simple + Fast ElasticSearch Node.js client. Beginner-friendly defaults & Heroku support โœ… ๐Ÿš€
JavaScript
48
star
91

learn-node-js-by-example

โ˜๏ธ Practical node.js examples.
HTML
47
star
92

product-roadmap

๐ŸŒ Because why wouldn't you make your company's product roadmap Public on GitHub?
46
star
93

redis-connection

โšก Single Redis Connection that can be used anywhere in your node.js app and closed once (e.g in tests)
JavaScript
45
star
94

aws-lambda-test-utils

Mock event and context objects without fluff.
JavaScript
44
star
95

learn-graphQL

โ“Learn to use GraphQL - A query language that allows client applications to specify their data fetching requirements
JavaScript
44
star
96

elixir-pre-commit

โœ… Pre-commit hooks for Elixir projects
Elixir
43
star
97

hapi-login

๐Ÿšช The Simplest Possible (Email + Password) Login for Hapi.js Apps โœ…
JavaScript
43
star
98

learn-riot

๐ŸŽ Riot.js lets you build apps that are simpler and load/run faster than any other JS framework/library.
HTML
43
star
99

github-reference

โญ GitHub reference for *non-technical* people following a project's progress
42
star
100

learn-codeclimate

๐ŸŒˆ Learn how to use CodeClimate to track the quality of your JavaScript/Node.js code.
41
star