Simple todo list with realtime subscriptions using VueJS + DynamoDB + AppSync + GraphQL
type Todo {
id: ID
title: String
completed: Boolean
}
type Query {
getTodos: [Todo]
}
type Mutation {
addTodo(title: String!): Todo
updateTodo(id: ID!, completed: Boolean!): Todo
deleteTodo(id: ID!): Todo
}
type Subscription {
onTodoChanged: Todo
@aws_subscribe(mutations: ["addTodo", "updateTodo", "deleteTodo"])
}
schema {
query: Query
mutation: Mutation
subscription: Subscription
}
npm install
npm run dev
npm run build
-
Adjust the
cloud_formation.yml
Parameters :GitHubOwner
,GitHubRepo
,AmplifyAppName
andBranchName
-
Prepare the github repository and set the
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
at github secret.AWS Console : - Goto AWS IAM Console - Select User name - Security Credentials - Create Access Keys - Copy Paste the value of `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` Github Settings -> Security -> Secrets and variables -> Actions Create New Repository secrets for - `AWS_ACCESS_KEY_ID` - `AWS_SECRET_ACCESS_KEY`
-
Generate (classic) Github Auth Token
Github Click Picture Profile Settings -> Developer Settings Personal Access Tokens -> Tokens (classic) Generate new token (classic) Copy Paste the value of `GITHUB_AUTH_TOKEN`
-
Create a Cloud Formation stack by provide the
GITHUB_AUTH_TOKEN
valueaws cloudformation create-stack \ --stack-name TodoListStack \ --template-body file://cloud_formation.yml \ --parameters \ ParameterKey=GitHubOAuthToken,ParameterValue=GITHUB_AUTH_TOKEN \ --capabilities CAPABILITY_IAM
-
Push your code to github. Adjust your
GitHubOwner
andGitHubRepo
git remote add origin [email protected]:<GitHubOwner>/<GitHubRepo>.git git branch -M main git push -u origin main
-
Goto
https://us-east-1.console.aws.amazon.com/amplify/apps/d2lde6f78mp8a0/overview
. Adjustment required for the region and apps id