All Projects → zeusdeux → Jwt Example

zeusdeux / Jwt Example

Playing with user registration, login/logout, auth, etc using JWTs, serverless functions & faunadb as the data store.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Jwt Example

Vercel Builder
Vercel Builder for Nuxt.js
Stars: ✭ 437 (+1886.36%)
Mutual labels:  serverless, now, zeit
Vercel Php
▲ Vercel PHP runtime • vercel-php • now-php • 🐘+ λ = ❤
Stars: ✭ 429 (+1850%)
Mutual labels:  lambda, now, zeit
Vandium Node
AWS Lambda framework for building functions using Node.js for API Gateway, IoT applications, and other AWS events.
Stars: ✭ 377 (+1613.64%)
Mutual labels:  serverless, lambda, jwt
Now Builders
Official Now Builders created by the ZEIT team
Stars: ✭ 483 (+2095.45%)
Mutual labels:  serverless, now, zeit
Puppeteer Lambda Starter Kit
Starter Kit for running Headless-Chrome by Puppeteer on AWS Lambda.
Stars: ✭ 563 (+2459.09%)
Mutual labels:  serverless, lambda
Serverless Plugin Warmup
Keep your lambdas warm during winter. ♨
Stars: ✭ 814 (+3600%)
Mutual labels:  serverless, lambda
Aws Sam Cli
CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
Stars: ✭ 5,817 (+26340.91%)
Mutual labels:  serverless, lambda
Archive aws Lambda Go
A fast and clean way to execute Go on AWS Lambda.
Stars: ✭ 710 (+3127.27%)
Mutual labels:  serverless, lambda
Webiny Js
Enterprise open-source serverless CMS. Includes a headless CMS, page builder, form builder and file manager. Easy to customize and expand. Deploys to AWS.
Stars: ✭ 4,869 (+22031.82%)
Mutual labels:  serverless, lambda
Aws Mobile React Sample
A React Starter App that displays how web developers can integrate their front end with AWS on the backend. The App interacts with AWS Cognito, API Gateway, Lambda and DynamoDB on the backend.
Stars: ✭ 650 (+2854.55%)
Mutual labels:  serverless, lambda
Lambda Packages
Various popular python libraries, pre-compiled to be compatible with AWS Lambda
Stars: ✭ 713 (+3140.91%)
Mutual labels:  serverless, lambda
Lambdalogs
A CLI tool to trace AWS Lambda calls over multiple CloudWatch log groups.
Stars: ✭ 18 (-18.18%)
Mutual labels:  serverless, lambda
Fn
The container native, cloud agnostic serverless platform.
Stars: ✭ 5,046 (+22836.36%)
Mutual labels:  serverless, lambda
Functional Typescript
TypeScript standard for rock solid serverless functions.
Stars: ✭ 600 (+2627.27%)
Mutual labels:  serverless, lambda
Dazn Lambda Powertools
Powertools (logger, HTTP client, AWS clients, middlewares, patterns) for Lambda functions.
Stars: ✭ 501 (+2177.27%)
Mutual labels:  serverless, lambda
Jamstack Cms
Modern full stack CMS. Built with Gatsby, GraphQL, AWS Amplify, and Serverless technologies.
Stars: ✭ 702 (+3090.91%)
Mutual labels:  serverless, lambda
Dawson Cli
A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda)
Stars: ✭ 721 (+3177.27%)
Mutual labels:  serverless, lambda
Kotless
Kotlin Serverless Framework
Stars: ✭ 721 (+3177.27%)
Mutual labels:  serverless, lambda
Serverless Domain Manager
Serverless plugin for managing custom domains with API Gateways.
Stars: ✭ 783 (+3459.09%)
Mutual labels:  serverless, lambda
Mangum
AWS Lambda & API Gateway support for ASGI
Stars: ✭ 475 (+2059.09%)
Mutual labels:  serverless, lambda

jwt-example

This is an example codebase that implements user registration and supports authorization using JWTs using serverless functions and the wonderful FaunaDB.

Motivation

I wrote this to teach myself how JWTs work and also implement user registration and login/logout, etc flows serverlessly.

Implemented functionality

  • sign up as new user (or re-sign up as a deleted user which is transparent to the user)
  • login and get JWT with 1 hour expiry (multiple logged in sessions supported)
  • access protected route with only with a valid token
  • logout (kills all logged in sessions and invalidates all tokens for the user)
  • delete user
  • In-situ encrypted JWT signing/validation key pair to overcome AWS Lambda having a hard limit of 4kb on env vars when JSON-stringified

TODOs

Code structure

  • api/* holds the lambdas that map to each supported route
  • models/* holds the models for the entities in the system (User & Token) and some helpers
  • errors/* holds the custom error tooling for the codebase
  • utils/* hold code structure and type level utilties

A note on Maybe, Either and match over traditional code structure

I wanted to play with a different way of approaching authoring the code in this repository. Instead of messing with try/catch-es and lots of error handling madness, I have instead opted to push those to the edges as you can see in models/User.helpers.ts and instead wrap those values in Maybes and/or Eithers. These values are then accessed in a declarative manner using match. Their usage, imho, has greatly simplified the code as you can see in the api/*.ts. It's not everyone's ☕and I get that.

More info can be found in files with the same names under they utils/ directory.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].