Skip to content

mkpace/souk

Repository files navigation

SOUK - The Headless Microservice API for eCommerce (Alpha)

GitHub license

Overview

This project is the result of searching for an Open Source solution that would fulfill the following requirements: You can read my post on headless eCommerce on Medium.

Ideal System Requirements

  1. Headless
  2. High performance and scalable
  3. A clean, modular system that is configurable
  4. Open Source to crowdsource the best ideas from the community

Current System

Features

  • Accounts
  • Carts
  • Catalogs
  • Products / Variants / Options
  • Fulfillment
  • Orders
  • Payments / Refunds
  • Coupons
  • Slugs
  • Tags / Categories

Current System Support

The current project is a work in progress as the main end points (APIs) have been created and the system works in production for a specific set of services.

The current implementation supports an eCommerce workflow that consists of:

  1. Customer Registration
  2. Custom Login
  3. Adding/Removing Products from Shopping Cart
  4. Checkout workflow:
  • Address verification via UPS API
  • Lookup UPS Shipping Rates based on Address
  • Credit Card Payments via Elavon Payment Gateway
  1. Order Verification and Notifications
  2. Order Refunds
  3. Email Notifications for Registration, Password Reset, and Orders
  4. Product Catalog

Future System Support The work that is being done is to modularize the services further that they are configurable from an administrative console that will allow the following:

  1. Support for additional Payment Gateways
  2. Support for various Shipping fulfilment systems
  3. Support for Shipping Rates from various carriers
  4. Support for Tax/Nexus calculation for additional states

Development

This project uses the serverless-webpack plugin, Babel, serverless-offline, and Mocha.

This configuration supports:

  • ES7 syntax in your handler functions

    • Use import and export
  • Package your functions using Webpack

  • Run API Gateway locally

    • Use serverless offline start
  • Support for unit tests

    • Run npm test to run your tests
  • Sourcemaps for proper error messages

    • Error message show the correct line numbers
    • Works in production with CloudWatch
  • Automatic support for multiple handler files

    • No need to add a new entry to your webpack.config.js
  • Add environment variables for your stages


Requirements

Usage

To run unit tests on your local

npm test

To run a function on your local

serverless invoke local --function hello

To simulate API Gateway locally using serverless-offline

serverless offline start

Run your tests

export CONFIG_API_URL=XXX
npm run test

We use Jest to run our tests. You can read more about setting up your tests here.

Deploy your project

serverless deploy

Deploy a single function

serverless deploy function --function hello

To add another function as a new file to your project, simply add the new file and add the reference to serverless.yml. The webpack.config.js automatically handles functions in different files.

To add environment variables to your project

  1. Rename env.example to env.yml.
  2. Add environment variables for the various stages to env.yml.
  3. Make sure to not commit your env.yml.

About

souk is an eCommerce headless API utilizing NodeJS, Express, and AWS Services (Lambdas, AWS Gateway, and CloudFront)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages