excommerce

command module
v0.0.0-...-14d7d22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 12 Imported by: 0

README

ExCommerce

Example Commerce System

Development requirements

  • Docker
  • make

API

  • Build the server: make build
  • Start the server build on localhost:8080: make run
  • Start api doc server on localhost:8081: make redoc
Configuration via environment variables
  • COUPON_DEFAULT_LIFETIME: The default lifetime when creating a coupon and no expires at date is given. Use values like 10s, 2.5m or 1h30m to express a duration. Defaults to 10s.

Administration

  • There is a built-in administration account with the credentials admin:admin.
  • Use the enclosed postman collection and environment to create coupons using the administration account.

Frontend

Design

+--------------------------------------------+          +---------------------------------------------+
| SPA Frontend (Vue)                         |          |                        RESTful Backend (Go) |
|                                            |          |                                             |
|  +---------------------------+   +---------+--+    +--+--+  +---------------+--------------------+  |
|  | App Logic                 |   | API Client |    | API +--> Registration  | Controllers        |  |
|  |                           |   |            +---->     |  +---------------+                    |  |
|  |                           |   |            |    |     +--> Login         |                    |  |
|  |                           +--->            +---->     |  +---------------+                    |  |
|  |                           |   |            |    |     +--> Store Cart    |                    |  |
|  +---+-----------------------+   |            +---->     |  +---------------+                    |  |
|      |                           |            |    |     +--> ...           |                    |  |
|      |         +-----------------+ Auth       |    |     |  +---------------+                    |  |
|      |         |                 |            |    |     |                  |                    |  |
|      |         |          +------>            |    |     |   +------------+ |                    |  |
|      |         |          |      |            |    |     +---> Basic Auth | |                    |  |
|      |         |          |      +---------+--+    +--+--+   +----------+-+ +-------+-+-+--------+  |
|      |         |          |                |          |                 |           | | |           |
|  +---v---------v---+  +---+------------+   |          |  +--------------------------v-v-v--------+  |
|  | Persistence     |  | Server-side    |   |          |  | Models       |                        |  |
|  |                 |  |                |   |          |  |              |                        |  |
|  +-------+-+-+-----+  | +------+ +---+ |   |          |  |  +------+  +-v----+  +-------+  +---+ |  |
|          | | |        | | Cart | |...| |   |          |  |  | Cart |  | User |  | Order |  |...| |  |
|          | | +--------> +------+ +---+ |   |          |  |  +------+  +------+  +-------+  +---+ |  |
|          | |          |                |   |          |  |                                       |  |
|          | |          +----------------+   |          |  +---------------+-+-+-------------------+  |
|          | |                               |          |                  | | |                      |
|          | +-------------------+           |          |  +---------------v-v-v-------------------+  |
|          |                     |           |          |  | Persistence                           |  |
|  +-------v---------+  +--------v-------+   |          |  |                                       |  |
|  | Session Storage |  | Local Storage  |   |          |  +-----+-------------+-------------+-----+  |
|  |                 |  |                |   |          |        |             |             |        |
|  | +-------------+ |  | +------+ +---+ |   |          |  +-----v----+  +-----v-----+  +----v-----+  |
|  | | Credentials | |  | | Cart | |...| |   |          |  | Database |  | In-memory |  | ...      |  |
|  | +-------------+ |  | +------+ +---+ |   |          |  |          |  |           |  |          |  |
|  |                 |  |                |   |          |  |          |  |           |  |          |  |
|  +-----------------+  +----------------+   |          |  +----------+  +-----------+  +----------+  |
|                                            |          |                                             |
+--------------------------------------------+          +---------------------------------------------+

Guest orders a product:

+----------------------+     +----------------------+     +----------------------+
| User                 |     | Frontend             |     | Backend              |
+----------------------+     +----------------------+     +----------------------+
|                      |     |                      |     |                      |
| adds product to cart +-----> stores cart in local |     |                      |
|                      |     | storage              |     |                      |
|                      |     |                      |     |                      |
| goes to checkout     +-----> requires login       |     |                      |
|                      |     |                      |     |                      |
|                      <-----+ show login           |     |                      |
|                      |     |                      |     |                      |
| want to create acc   +----->                      |     |                      |
|                      |     |                      |     |                      |
|                      <-----+ show register        |     |                      |
|                      |     |                      |     |                      |
| register             +----------------------------------> create user          |
|                      |     |                      |     |                      |
|                      |     | store user creds     <-----+                      |
|                      |     |                      |     |                      |
|                      |     | store cart on server +-----> apply discounts &    |
|                      |     |                      |     | store cart           |
|                      |     |                      |     |                      |
|                      |     | update local cart    <-----+                      |
|                      |     |                      |     |                      |
|                      <-----+ show checkout        |     |                      |
|                      |     |                      |     |                      |
| enter coupon         +------- add cart info ------------> validate order       |
|                      |     |                      |     |                      |
|                      <-----+ show order details   <-----+ order details        |
|                      |     |                      |     |                      |
| submit payment info  +------- add cart info ------------> lock cart, validate  |
|                      |     |                      |     | and store order      |
|                      |     |                      |     |                      |
|                      |     | clear cart           <-----+ order details        |
|                      |     |                      |     |                      |
|                      <-----+ show order details   |     |                      |
|                      |     |                      |     |                      |
+----------------------+     +----------------------+     +----------------------+

Attribution

Images used:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL