Skip to content
Medium.com clone (called Conduit) built with AWS Lambda, DynamoDB, Go and Serverless
Go Other
  1. Go 99.3%
  2. Other 0.7%
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
angularjs-realworld-example-app @ 858913c Parameterize AWS region and update frontend submodule Sep 2, 2019
model Benchmark passing article by value and by pointer Sep 2, 2019
route
service Improve TransactionCanceledException comment Sep 2, 2019
util CORS Jul 23, 2019
.gitignore Clean up and deploy Jun 19, 2019
.gitmodules Add frontend submodule Jul 23, 2019
.travis.yml
Makefile Fix missing Dummy field in tag table Jul 6, 2019
go.mod Upgrade aws-sdk-go Sep 2, 2019
go.sum Upgrade aws-sdk-go Sep 2, 2019
gobuild.sh Make gobuild.sh and gomod.sh executable Nov 16, 2019
gomod.sh Make gobuild.sh and gomod.sh executable Nov 16, 2019
logo.png https://github.com/gothinkster/realworld-starter-kit Sep 4, 2019
readme.md Add build status to readme.md Nov 16, 2019
serverless.yml

readme.md

RealWorld Example App

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

Demo

Build Status

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

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

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

Getting started

Prerequisite

  • Install Go, Node.js, Serverless CLI
  • In angularjs-realworld-example-app, run npm install

Build and deploy backend

In the root directory of this project:

  • make build
  • sls deploy --stage dev

Build and serve frontend

In angularjs-realworld-example-app:

  • npx gulp

How it works

Routes and their handlers are defined in serverless.yml.

For example, the following section means POST /users is handled by bin/users-post, which is built from route/users-post/main.go.

  users-post:
    handler: bin/users-post
    events:
      - http:
          path: users
          method: post
          cors: true

Design choices

  • Scrypt-based password hasing
  • Input validation
  • Data consistency with DynamoDB transactions

These tradeoffs were made for simpler code:

  • Hardcoded secret. Cons: can't invalidate tokens
  • Shared states (like DB and RNG) are singletons, no dependency injections used. Cons: can't control their lifecycles, potential memory leak, unit-test-unfriendly
  • Usernames can't be changed
  • Usernames are case-sensitive
  • Performance bottlenecks around global secondary indices with a single hash-key value, like ArticleTable.CreatedAt and TagTable.ArticleCount
  • Performance bottlenecks around fan-in-based article feed aggregation
You can’t perform that action at this time.