GithubHelp home page GithubHelp logo

beenion's Introduction

Blog references

A list of links pointing to a source when a specific blog post is written:

User Interface

Requirements

Deployment

Adjust .env to your AWS_REGION - you can optionally change the application name.

npm install	
sls deploy	

will create a cloudformation stack with lambda functions and other required AWS resources.

sls info -v will show information about the stack including api endpoints.

Creating a Cognito User

The command and queries use a Cognito Api Gateway authorizer for authentication. A cognito user needs to be created in the user pool in order to test the apis.

  • In the AWS console navigate to Cognito -> Manage User Pools -> beenion-dev (default name)

  • Take note of the following

    • "Pool Id" under General Settings <POOL_ID>
    • "App Client ID" under app client <APPCLIENT_ID>

As a cognito user needs to go through a signup and confirmation process typically done from a website - its easiest to create and confirm the cognito user using the awscli with admin credentials.

  • Create and confirm User with temp password
aws cognito-idp admin-create-user \	
 --user-pool-id <POOL_ID> \	
 --username <USER_EMAIL> \	
 --temporary-password 'TempPassword123!' \	
 --message-action SUPPRESS  	
aws cognito-idp admin-initiate-auth \	
--user-pool-id <POOL_ID> \	
--client-id <APPCLIENT_ID> \	
--auth-flow ADMIN_NO_SRP_AUTH \	
--auth-parameters USERNAME='<YOUR_EMAIL>',PASSWORD='TempPassword123!'	

Take note of the long session string in the response

  • Reset the users password
aws cognito-idp admin-respond-to-auth-challenge \	
 --challenge-name 'NEW_PASSWORD_REQUIRED' \	
 --user-pool-id <POOL_ID> \	
 --client-id <APPCLIENT_ID> \	
 --challenge-responses USERNAME='<YOUR_EMAIL>',NEW_PASSWORD='<YOUR_PASSWORD>' \	
 --session '<REPLACE_WITH_SESSION_STRING_FROM_PREVIOUS_COMMAND'   	
  • Get an ID Token
aws cognito-idp admin-initiate-auth \	
 --user-pool-id <POOL_ID> \	
 --client-id <APPCLIENT_ID> \	
 --auth-flow ADMIN_NO_SRP_AUTH \	
 --auth-parameters USERNAME='<YOUR_EMAIL>',PASSWORD='<YOUR_PASSWORD>'	
  • Testing the apis

Use the idtoken above in the Authorization header. Example of posting to the linkCommand handler

curl --request POST \	
  --url https://<YOUR_API_GW_ENDPOINT>/dev/linkCommand \	
  --header 'Authorization: <REPLACE_WITH_ID_TOKEN>' \	
  --header 'Content-Type: application/json' \	
  --data '{"type": "rate",\n "payload": {\n"linkUrl": "https://www.github.com",\n"rating": 10\n}\n}'	

beenion's People

Contributors

domagojk avatar vyper avatar yk-matsu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beenion's Issues

Version lookup of events

KeyConditionExpression: 'streamId = :a AND version >= :v',

Hi,

Thanks for the blog post was a good, using some of your design to influence my c# eventsoucing on lambda.

Just noticed the above property and the lookup is >= version.

I can't really see exactly where use this in your code base but i'd assume you be doing <= version? as you'd want to pin the aggregate at that version correct?
Just going of how I have previously done things.

Cheers,
Elijah

Generalise serverless.yml + environment variables

Hi there,

First off - this is a really cool project! We're using it as a starting point for our event sourcing Proof of Concept.

Wondering if you would consider a PR to generalise / create more of the supporting AWS infra in serverless.yml? There's quite a few references to your AWS account ID with various resources created outside the stack

Would include.

  • Create the Dynamo Eventstore and Link tables.
  • Create SQS queues.
  • Create the Cognito User pool and postsignup lambda trigger
  • Create the Dynamo Event stream lambda trigger automatically via serverless dynamo events.
  • Use Cloudformation references for lambda environment variables rather than hardcoded queue names.
  • Various permission tweaks for lambda IAMRoles.

Start the demo

Hi,

I am new to typescript and ddd.

I really want to start to learn about your design pattern.

Anyway the problem is that I want to make the project run but got some error.

Could you help with README so that I can run the project successful?

Thanks

rebuildDatabase.ts usage

Do you have any guidance on how rebuildDatabase.ts can be used / invoked to recreate the Link table from the EventStore?

Questions

@domagojk Thanks for publishing the blog posting and the code, they have been very helpful. I have a bunch of questions about your implementation.

  1. Tracking time of events. You have in the event record commitedAt, but then you also add a timestamp to the events before your stringify them. But then again when you retrieve them you add commitedAt to the events . Is there a reason for all of these timestamps that are the same time?
  2. I am a bit confused by the linkId for the events vs the streamId for the events vs the linkHash for the view model. It looks like there is a stream of event for each user/link, which makes sense.
  3. The event types are very confusing. Is there a reason that they are not separted per domain model? Each domain model will have its own set of domain events. Would it not make sense to keep them organized together? I could see a large application a list of all events in one place get out of control.

I am doing a big refactor of your example and I will post it when it is complete.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.