Skip to content
λ serverless backend implementation for RealWorld using AWS DynamoDB + Lambda
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src feat(Article): Add ability to update article, with tests (#48) Jul 30, 2018
.gitignore feat(async): Use async/await in handlers (#36) Jul 22, 2018 Rename API Docs to JSDoc Mar 17, 2018
.travis.yml docs(README): Add realworld badge Oct 24, 2018
serverless.yml feat(Article): Add ability to update article, with tests (#48) Jul 30, 2018 chore(ci): Kill server PIDS only if running (#46) Jul 28, 2018

RealWorld Example App

RealWorld Backend Build Status Coverage Status Greenkeeper badge Known Vulnerabilities Gitter

AWS DynamoDB + Lambda codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.


This codebase was created to demonstrate a fully fledged fullstack application built with AWS DynamoDB + Lambda including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the AWS DynamoDB + Lambda community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

Getting started

Requires Node 8 or higher

Clone this repo, and cd into it:

git clone
cd realworld-dynamodb-lambda

Starting the local server

npm install
npm run start

This should start local DynamoDB emulator and Serverless offline. You can now make API calls against http://localhost:3000/api like this:

curl http://localhost:3000/api/articles

Serverless: GET /api/articles (λ: listArticles)
Serverless: The first request might take a few extra seconds
Serverless: [200] {"statusCode":200,"headers":{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":true},"body":"{\"articles\":[]}"}

Running tests locally

npm test

See sample test run log and network traffic.

How it works


This repo uses Serverless Framework to describe, test and deploy the RealWorld REST API to AWS Lambda. AWS Lambda provides "serverless" cloud functions as a service. AWS API Gateway is used to expose the deployed Lambda functions as a HTTP REST API.

Architecture Diagram


The API is described in the serverless.yml file. For example the following snippet instructs AWS Lambda to execute the create method in src/User.js whenever a POST method is called on /api/users:


  ## Users API
    handler: src/User.create
      - http:
          method: POST
          path: /api/users
          cors: true



For storage, AWS DynamoDB a managed serverless NoSQL database is used. Tables are created to store users, articles and comments also described in serverless.yml file. For example:


      Type: 'AWS::DynamoDB::Table'
      DeletionPolicy: Retain


To deploy the code to AWS, simply execute:

npm run deploy

This will use serverless to deploy the API as described in serverless.yml.

Once deployed, you can test the deployed API by executing:

npm run test:deployed
You can’t perform that action at this time.