All Projects → architect → data

architect / data

Licence: other
[deprecated] Generate a DynamoDB data access layer from an .arc file. Automatically disambiguates testing (in memory) from deployment staging and production tables

Programming Languages

javascript
184084 projects - #8 most used programming language
arc
50 projects

Projects that are alternatives of or similar to data

Aws Cognito Apigw Angular Auth
A simple/sample AngularV4-based web app that demonstrates different API authentication options using Amazon Cognito and API Gateway with an AWS Lambda and Amazon DynamoDB backend that stores user details in a complete end to end Serverless fashion.
Stars: ✭ 278 (+1290%)
Mutual labels:  api-gateway, dynamodb
Workshop Donkeytracker
Workshop to build a serverless tracking application for your mobile device with an AWS backend
Stars: ✭ 27 (+35%)
Mutual labels:  api-gateway, dynamodb
Serverless Express
Run Node.js web applications and APIs using existing application frameworks on AWS #serverless technologies such as Lambda, API Gateway, Lambda@Edge, and ALB.
Stars: ✭ 4,265 (+21225%)
Mutual labels:  api-gateway, dynamodb
api-lambda-save-dynamodb
Deploy instantly on Serverless Application Repository
Stars: ✭ 55 (+175%)
Mutual labels:  api-gateway, dynamodb
CloudFrontier
Monitor the internet attack surface of various public cloud environments. Currently supports AWS, GCP, Azure, DigitalOcean and Oracle Cloud.
Stars: ✭ 102 (+410%)
Mutual labels:  api-gateway, dynamodb
Arc.codes
The Architect web site! 🌩
Stars: ✭ 271 (+1255%)
Mutual labels:  api-gateway, dynamodb
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 (+3150%)
Mutual labels:  api-gateway, dynamodb
super-serverless-sample
Backend serverless que simula o sistema de votação do BBB
Stars: ✭ 30 (+50%)
Mutual labels:  api-gateway, dynamodb
Yoyo
A dead simple comment engine built on top of AWS lambda and React, alternative comment service to Disqus.
Stars: ✭ 210 (+950%)
Mutual labels:  api-gateway, dynamodb
Aws Mobile React Native Starter
AWS Mobile React Native Starter App https://aws.amazon.com/mobile
Stars: ✭ 2,247 (+11135%)
Mutual labels:  api-gateway, dynamodb
Hands-On-Serverless-Applications-with-Go
Hands-On Serverless Applications with Go, published by Packt.
Stars: ✭ 92 (+360%)
Mutual labels:  api-gateway, dynamodb
serverless-websockets-chat
Realtime chat app based on AWS Lambda, API Gateway, DynamoDB, Websockets, React in TS
Stars: ✭ 19 (-5%)
Mutual labels:  api-gateway, dynamodb
Serverless Stack Demo Api
Source for the demo app API in Serverless-Stack.com
Stars: ✭ 486 (+2330%)
Mutual labels:  api-gateway, dynamodb
Aws Cli Cheatsheet
☁️ AWS CLI + JQ = Make life easier
Stars: ✭ 94 (+370%)
Mutual labels:  api-gateway, dynamodb
parser
arc.app, .arc, arc.json, arc.yaml, and arc.toml support
Stars: ✭ 20 (+0%)
Mutual labels:  api-gateway, dynamodb
amazon-ivs-ugc-web-demo
This repository shows how you can build a compelling user-generated content (UGC) live streaming webapp with Amazon IVS.
Stars: ✭ 14 (-30%)
Mutual labels:  api-gateway, dynamodb
jarvis-workshop
Amazon re:Invent workshop - "Alexa, Ask Jarvis to Create a Serverless App for Me" -
Stars: ✭ 14 (-30%)
Mutual labels:  dynamodb
apex-api-gateway-boilerplate
Boilerplate for AWS Lambda and API Gateway using Apex
Stars: ✭ 19 (-5%)
Mutual labels:  api-gateway
AspNetCore.ApiGateway
Asp Net Core Api Gateway Framework
Stars: ✭ 46 (+130%)
Mutual labels:  api-gateway
aiodynamo
Asynchronous, fast, pythonic DynamoDB Client
Stars: ✭ 51 (+155%)
Mutual labels:  dynamodb

@architect/data

Build Status

Generate a DynamoDB data access layer from an .arc file. Automatically disambiguates testing (in memory) from deployment staging and production tables

Background

An .arc file can define @tables and @indexes. Generated tables follow the format:

  • appname-staging-tablename
  • appname-production-tablename

For example, given the following .arc file:

@app
testapp

@tables
ppl
  pplID *String

cats
  pplID *String
  catID **String

@indexes
ppl
  email *String

cats
  name *String

If you've setup your package.json per the quickstart then running npm run create creates the following tables:

  • testapp-staging-ppl
  • testapp-production-ppl
  • testapp-staging-cats
  • testapp-production-cats

And running npm start will kick up a local Dynalite instance with these tables prepopulated. From here its up to you to connect to the database and interact with the tables on your local machine.

Connecting to DynamoDB

var db = require('@architect/data/db')

db.listTables({}, console.log)
// logs tables

Read the Testing Guide to learn about working with the local Dynalite instance in your tests

This same code will work in the staging and production Lambdas without modification.

Full documentation of the AWS SDK DynamoDB client can be found here.

Working with DocumentClient

The lower level Dynamo client is good for precise database control. Use it for listing, creating, modifying and destroying tables. For working with records DocumentClient provides a nicer interface.

var doc = require('@architect/data/doc')

doc.put({
  TableName: 'testapp-staging-notes', 
  Item: {
    noteID: 1, 
    body: 'hi'
  }
}, console.log)
// record added to db and logs {noteID:1, body:'hi'}

doc.get({noteID:1}, console.log)
// logs {noteID:1, body:'hi'}

DocumentClient has comprehensive support for querying and mutating data.Full documentation for DocumentClient can be found here.

Convenience with @architect/data

This library bundles the db and doc connection scripts above. However it does require hard coding TableName which might not be desirable. So this module exports a single function for generating a static data access layer client that automatically resolves TableName based on NODE_ENV.

The client is a plain javscript object keyed by table name with methods from DyanamoDB.DocumentClient:

  • put
  • get
  • delete
  • query
  • scan
  • update

Example Usage

@app
testapp

@tables
accounts
  accountID *String

posts
  accountID *String
  postID **String

First we generate a client:

// reads node_modules/@architect/shared/.arc 
var data = require('@architect/data')

The app variable above looks like this:

{
  account: {put, get, delete, query, scan, update},
  posts: {put, get, delete, query, scan, update}
}

You can immediately start using the generated methods:

var data = require('@architect/data')

// create a post
await app.posts.put({
  accountID: 'fake-id',
  postID: 'fake-post-id',
  title: 'neato'
}) 

// read it back
let post = await app.posts.get({postID: 'fake-post-id'})

// update the record
await app.posts.update({
  Key: { 
    postID: 'fake-post-id' 
  },
  UpdateExpression: 'set #title = :title', 
  ExpressionAttributeNames: {
    '#title' : 'title'
  },
  ExpressionAttributeValues: {
    ':title' : 'super neato',
  }
})

// destroy it
await app.posts.destroy({
  postID: 'fake-post-id'
})

Check the tests for a detailed example!

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].