MCPcopy Index your code
hub / github.com/anishkny/realworld-dynamodb-lambda

github.com/anishkny/realworld-dynamodb-lambda @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
37 symbols 64 edges 12 files 18 documented · 49%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

RealWorld Example App

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.

Demo

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 https://github.com/anishkny/realworld-dynamodb-lambda
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

Overview

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

API

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:

functions:

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

  ...

Storage

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:

resources:
  Resources:

    UsersDynamoDBTable:
      Type: 'AWS::DynamoDB::Table'
      DeletionPolicy: Retain
      Properties:
        AttributeDefinitions:
        ...

Deployment

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

Core symbols most depended-on inside this repo

transformRetrievedArticle
called by 4
src/Article.js
getUserByUsername
called by 4
src/User.js
authenticateAndGetUser
called by 4
src/User.js
assertUserEquals
called by 3
test/test.User.js
purgeTable
called by 3
src/Util.js
getUserByEmail
called by 3
src/User.js
getTokenFromEvent
called by 3
src/User.js
envelop
called by 2
src/Util.js

Shape

Function 37

Languages

TypeScript100%

Modules by API surface

src/User.js13 symbols
src/Article.js10 symbols
src/Util.js5 symbols
test/TestUtil.js4 symbols
src/Comment.js3 symbols
test/test.User.js1 symbols
test/mocha-axios-reporter.js1 symbols

For agents

$ claude mcp add realworld-dynamodb-lambda \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page