The project is a web application which is a shop based on AWS. The two parts are:
- Frontend(UI) in React + TypeScript + Vite
- Backend in AWS + CDK + TypeScript
⚠️ The application will still be improved
- Cognito
- API gateway
- Step Functions
- Lambda
- Event Bridge
- DynamoDB
- RDS
- Amplify
- CodePipeline (CICD)
- The user establishes connection by websocket
- ConnectionId(websocket connection identifier) and executionName(placer order execution identifier) are saved in database "Connection Table"
- The user sends request place order by REST API with orderId(order already created) and executionName.
- AWS Step function workflow is started:
- (order case) get order
- (warehouse case) check, reserve products in warehouse
- (payment case) check user has enough money to fulfil order and charge them
- (shipment/warehouse revert case) if payment success - prepare shipment. Else if payment error - revert products to the warehouse
- (finalization case) update order status in order, handle errors when any occur
- Send result message about success or error to the event bridge
- Finding connectionId in database "Connection Table" by the executionName and send result message to the user by the websocket
- create user account
- create and manage products
- place order
- get fulfilment orders
- managing user bank account - deposit, withdraw money
1.Run app:
You can run app in two configurations for orders:
- no-sql DYNAMO db
./launch-app.sh
- sql - relation database (RDS) db
./launch-app.sh RDS
Script will:
- run db (DYNAMO/RDS)
- deploy backend
- deploy cicd pipelines
- install dependencies, build ui
- deploy ui
2.Find URL by:
- from terminal under the key FinderUrl
- in the file backend/cdk-outputs.json under the key FinderUrl
Paste it in the browser
Choose user from login screen (table) and login
Go to the login page and click "Create account"
- User (placing order)
Blocked:
- Admin (can do that what can do user + managing products).
⚠️ Don't forget to verify your email!!
1.Go to the ui
cd ui
2.Run tests
npm test
Tests based on websockets, because the main ordering mechanism is based on them
- Deploy the whole infrastructure. Check "How to run APP"
- Edit the code, commit, push, merge
- Pipelines will be triggered automatically after merge to the develop branch
- Pipelines will be triggered automatically after merge to the main branch with manual deployment
GitFlow (feature -> develop -> main). You can see the results in the AWS "CodePipeline" service.
- download source code from Github repo from develop branch
- build the code
- run integration tests
- deploy after manual approval
./delete-app.sh