Convert Figma logo to code with AI

aws-samples logoaws-serverless-ecommerce-platform

Serverless Ecommerce Platform is a sample implementation of a serverless backend for an e-commerce website. This sample is not meant to be used as an e-commerce platform as-is, but as an inspiration on how to build event-driven serverless microservices on AWS.

1,105
375
1,105
33

Top Related Projects

Airline Booking is a sample web application that provides Flight Search, Flight Payment, Flight Booking and Loyalty points including end-to-end testing, GraphQL and CI/CD. This web application was the theme of Build on Serverless Season 2 on AWS Twitch running from April 24th until end of August in 2019.

Code and walkthrough labs to set up serverless applications for Wild Rydes workshops

Quick Overview

The AWS Serverless E-Commerce Platform is a sample implementation of a serverless backend for an e-commerce website. It demonstrates how to build a scalable, resilient, and cost-effective e-commerce solution using various AWS services and serverless technologies. The project showcases best practices for developing microservices-based architectures on AWS.

Pros

  • Fully serverless architecture, leveraging AWS Lambda, API Gateway, and other managed services
  • Demonstrates real-world e-commerce scenarios and best practices
  • Modular design with separate services for different e-commerce functions
  • Includes comprehensive documentation and deployment instructions

Cons

  • Complex architecture may be overwhelming for beginners
  • Requires familiarity with multiple AWS services
  • May incur costs when deployed, even at small scale
  • Limited frontend implementation, focusing primarily on backend services

Code Examples

As this is not a code library but rather a complete serverless application, we'll skip the code examples section.

Getting Started

To get started with the AWS Serverless E-Commerce Platform:

  1. Clone the repository:

    git clone https://github.com/aws-samples/aws-serverless-ecommerce-platform.git
    cd aws-serverless-ecommerce-platform
    
  2. Install dependencies:

    npm install
    
  3. Deploy the platform:

    npm run all -- deploy
    
  4. Follow the documentation in the repository for detailed setup instructions, including AWS account configuration and environment setup.

Note: Deploying this project will create resources in your AWS account, which may incur costs. Be sure to review the architecture and understand the associated costs before deployment.

Competitor Comparisons

Airline Booking is a sample web application that provides Flight Search, Flight Payment, Flight Booking and Loyalty points including end-to-end testing, GraphQL and CI/CD. This web application was the theme of Build on Serverless Season 2 on AWS Twitch running from April 24th until end of August in 2019.

Pros of aws-serverless-airline-booking

  • Focuses on a specific industry (airline booking), providing more targeted examples and use cases
  • Includes a frontend application, offering a complete end-to-end solution
  • Demonstrates integration with third-party services like payment processing and loyalty programs

Cons of aws-serverless-airline-booking

  • Less comprehensive in terms of microservices compared to aws-serverless-ecommerce-platform
  • May have limited applicability outside the airline industry
  • Fewer infrastructure-as-code examples for deployment and management

Code Comparison

aws-serverless-airline-booking:

@app.route("/booking", methods=["POST"])
def create_booking():
    booking = Booking(request.json)
    booking.save()
    return jsonify(booking.to_dict()), 201

aws-serverless-ecommerce-platform:

def create_order(event, context):
    order = Order(event['body'])
    order.save()
    return {
        'statusCode': 201,
        'body': json.dumps(order.to_dict())
    }

Both examples show similar patterns for creating resources (bookings/orders) using serverless functions, but aws-serverless-airline-booking uses a Flask-like approach, while aws-serverless-ecommerce-platform uses a more AWS Lambda-specific structure.

Code and walkthrough labs to set up serverless applications for Wild Rydes workshops

Pros of aws-serverless-workshops

  • More comprehensive coverage of serverless concepts and services
  • Structured as hands-on workshops, providing a guided learning experience
  • Includes multiple workshops covering different aspects of serverless development

Cons of aws-serverless-workshops

  • Less focused on a specific use case or application type
  • May not provide as deep insights into building a complete e-commerce solution
  • Could be overwhelming for developers looking for a specific implementation example

Code Comparison

aws-serverless-workshops:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Serverless web application example
Resources:
  GetHelloWorld:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.get
      Runtime: nodejs14.x
      Events:
        GetEvent:
          Type: Api
          Properties:
            Path: /hello
            Method: get

aws-serverless-ecommerce-platform:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Products service
Resources:
  Api:
    Type: AWS::Serverless::Api
    Properties:
      StageName: Prod
  GetProductsFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: get_products.handler
      Runtime: python3.8
      Events:
        Api:
          Type: Api
          Properties:
            RestApiId: !Ref Api
            Path: /products
            Method: GET

The code snippets show that both repositories use AWS SAM templates, but aws-serverless-ecommerce-platform is more focused on e-commerce-specific functionality, while aws-serverless-workshops provides a more general example.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

AWS Serverless Ecommerce Platform

Status: Work-in-progress. Please create issues or pull requests if you have ideas for improvement.

The Serverless Ecommerce Platform is a sample implementation of a serverless backend for an e-commerce website. Functionalities are split across multiple micro-services that communicate either through asynchronous messages over Amazon EventBridge or over synchronous APIs.

This sample is not meant to be used as an e-commerce platform as-is, but as an inspiration on how to build event-driven serverless microservices on AWS. This makes lots of assumptions on the order flow that might not be suitable for most e-commerce platform and doesn't include many of the features that you might need for this.

Please note that you may incure AWS charges for deploying the ecommerce platform into your AWS account as not all services used are part of the free tier and you might exceed the free tier usage limit. To track costs in your AWS account, consider using AWS Cost Explorer and AWS Billing and Cost Management. You can also set up a billing alarm to get notified of unexpected charges.

High-level flow across microservices

Getting started

To install the necessary tools and deploy this in your own AWS account, see the getting started guide in the documentation section.

Architecture

High-level architecture

This is a high-level view of how the different microservices interact with each other. Each service folder contains anarchitecture diagram with more details for that specific service.

High-level architecture diagram

Technologies used

Communication/Messaging:

  • AWS AppSync for interactions between users and the ecommerce platform.
  • Amazon API Gateway for service-to-service synchronous communication (request/response).
  • Amazon EventBridge for service-to-service asynchronous communication (emitting and reacting to events).

Authentication/Authorization:

  • Amazon Cognito for managing and authenticating users, and providing JSON web tokens used by services.
  • AWS Identity and Access Management for service-to-service authorization, either between microservices (e.g. authorize to call an Amazon API Gateway REST endpoint), or within a microservice (e.g. granting a Lambda function the permission to read from a DynamoDB table).

Compute:

  • AWS Lambda as serverless compute either behind APIs or to react to asynchronous events.

Storage:

  • Amazon DynamoDB as a scalable NoSQL database for persisting informations.

CI/CD:

Monitoring:

Backend services

ServicesDescription
usersProvides user management, authentication and authorization.
productsSource of truth for products information.
ordersManages order creation and status.
warehouseManages inventory and packaging orders.
deliveryManages shipping and tracking packages.
delivery-pricingPricing calculator for deliveries.
paymentManages payment collection and refunds.
payment-3pSimulates a third party payment system.

Frontend service

ServicesDescription
frontend-apiUser-facing API for interacting with the services.

Infrastructure services

ServicesDescription
pipelineCI/CD pipeline for deploying the resources in production.
platformCore platform resources for deploying backend services.

Shared resources

NameDescription
docsDocumentation application for all services.
sharedShared resources accessible for all services, such as common CloudFormation templates and OpenAPI schemas.
toolsTools used to build services.

Documentation

See the docs folder for the documentation.

Contributing

See the contributing and getting started documents to learn how to contribute to this project.

License

This library is licensed under the MIT-0 License. See the LICENSE file.