Welcome to Amazon Q Developer Code Challenge!
You are tasked to implement a backend application for managing shopping cart for e-commerce system. Target to implement and deploy the first MVP API for adding items to shopping cart and deploy on AWS.
Below is example of user stories that you got from your team.
As a customer, I want to add items to my shopping cart
So that I can collect items I intend to purchase
Acceptance Criteria:
* I can add an item with specified quantity to my cart
* The cart should display the updated item count
* The cart should show the item details (product name, price, quantity)
* The cart should calculate and display the subtotal
You will be using Amazon Q Developer to co-coding with you in this journey. You want to start slow and ensure certain software engineering practices/patterns will be applied.
Prompt Example
You can use below prompt as an initial conversation with Amazon Q Developer CLI. Please take a few minutes to review and understand the prompt.
Feel free to modify information you see fit (such as programming language, solutions, architectural patterns, etc...).
I am a developer, I want to create a service to manage shopping cart API for e-commerce system.
I want to start with "add items to cart features".
Below is the user story with acceptance criteria for this feature.
As a customer, I want to add items to my shopping cart
So that I can collect items I intend to purchase
Acceptance Criteria:
* I can add an item with specified quantity to my cart
* The cart should display the updated item count
* The cart should show the item details (product name, price, quantity)
* The cart should calculate and display the subtotal
There are some technical requirements as follows
* Programming language is Python
* Follow Clean Architecture approach.
* Follow Test-Driven Development (TDD) approach. Enforce test first and follow red, green and refactor mechanism.
* Use AWS Cloud Development Kit (CDK) to implement infrastructure as code in Python
* Separate infrastructure and application folder. Infrastructure folder will be used to host the CDK code
* Use the following AWS solutions for build APIs: API Gateway, Lambda and DynamoDB
Please only do 1 feature at a time, start with add item to cart.
Also note the plan and update progress on scratchboard.md
After successfully build and deploy application on AWS. You may try applying additional practices such as continuous integration and delivery, or add new features as well
Useful Prompts
Build and Deploy
In case you don't know the commands to build, run or deploy application, you can try with the following prompt
Could you help building and deploying this application? Please also update progress on scratchboard.md.
Run API Test
Similar to building and deploying, you can ask Amazon Q Developer to run API test for you.
Could you help running the API test? Please also update progress on scratchboard.md.
Document Generation
Sometimes there is no document generate. You can ask Amazon Q Developer to generate a README file for your project as well.
Could you create a README file for this application? Please also update progress on scratchboard.md.
Adding a New Feature
Based on current code, I would like to add additional feature to shopping cart API.
Below is the user story for this feature
As a customer, I want to remove items from my shopping cart
So that I can adjust my intended purchases
Acceptance Criteria:
* I can remove a specific item completely from the cart
* The cart should update the total item count
* The cart should recalculate and display the updated subtotal
Remember to keep the technical requirements as previously mentioned.
, only do 1 feature at a time.
Also note the plan and update progress on scratchboard.md
Tips and Tricks
- Start slow, focus on certain task, understand the response from Amazon Q Developer. Stop, verify and response to polish the result if you feel not right :).
- Provide detailed contexts to Amazon Q Developer. The more you provide, the accurate result you will get.
- Keep the plan and progress updated, ensure you tell Amazon Q Developer to note down the plan and progress on scratchboard.md. This will help both you and Amazon Q Developer to be able to track the progress and get more accurate result.
Troubleshooting
If you encounter problem inside the project like misconfiguration, packages or dependencies mismatch, etc... , feel free to startover by deleting the code and type `/clear` on CLI to restart the session.
Note that if you got error after deploying application to AWS, you may need to delete CloudFormation stack or apply terraform plan to startover again.
Raise your hand to get the prize!
Please raise your hand to get the prize!!!
Thank you for completing this workshop!