ecommerce microservice

Logo

Digota - ecommerce microservice Go Report Card Build Status Coverage Status Gitter chat

Digota is ecommerce microservice built to be the modern standard for ecommerce systems.It is based on grpc,protocol-buffers and http2 provides clean, powerful and secured RPC interface.

Our Goal is to provide the best technology that covers most of the ecommerce flows, just focus of your business logic and not on the ecommerce logic.

TLDR; scalable ecommerce microservice.

Join our community at gitter !

Getting started

Prerequisites

  • Go > 1.8
  • Database
    • mongodb > 3.2
    • redis (TBD)
    • postgresql (TBD - #2)
  • Lock server (default is in-memory locker)
    • zookeeper
    • redis !! (thanks @Gerifield)
    • etcd (TBD - #3)

Installation

From source

$ go get -u github.com/digota/digota

From docker hub

$ docker pull digota/digota:0.1

Run

$ docker run digota/digota:0.1

Or with flags

$ docker run digota/digota:0.1 bash -c "digota --version"

Check out this docker-compose for more details.

Flags: --info Set log level to info --debug Set log level to debug --help, -h show help --version, -v print the version

Cross languages

Key benefit of using grpc is the native support of major languages (C++,Java,Python,Go,Ruby,Node.js,C#,Objective-C,Android Java and PHP). Learn How to compile your client right here, You can use you Makefile as well.

Complied clients:

  1. php

Flexible payment gateways

It does not matter which payment gateway you are using, it is just matter of config to register it.

Supported gateways for now:

  1. Stripe
  2. Braintree

Are you payment provider ? Just implement the following interface and PR you changes.

Auth & Security

We take security very seriously, don't hesitate to report a security issue.

Digota is fully Encrypted (end-to-end) using TLS, That fact is leveraged also to Authenticate Clients based on their Certificate in front of the Local Certificate Authority. Basically we are creating CA and signing any certificate we want to approve with same CA.

How about revoking certificate? The CRL approch here is whitelist instead of blacklist, just remove client serial from your config.

Create CA
$ certstrap init --common-name "ca.company.com"
Create Client Certificate
$ certstrap request-cert --domain client.company.com
Sign Certificate
$ certstrap sign --CA "ca.company.com" client.company.com
Approve Certificate

Take the certificate serial and Append the serial and scopes(WRITE,READ,WILDCARD) to your config

$ openssl x509 -in out/client.com.crt -serial | grep -Po '(?<=serial=)\w+'
output: A2FF9503829A3A0DDE9CB87191A472D4

Follow these steps to create your CA and Certificates.

Money & Currencies

Floats are tricky when it comes to money, we don't want to lose money so the chosen money representation here is based on the smallest currency unit. For example: 4726 is $47.26.

Distributed lock

All the important data usage is Exclusively Guaranteed, means that you don't need to worry about any concurrent data-race across different nodes. Typical data access is as following:

Client #1 GetSomething -> TryLock -> [lock accuired] ->  DoSomething -> ReleaseLock -> Return Something 
                                                                                 \ 
Client #2 GetSomething -> TryLock -> --------- [wait for lock] -------------------*-----> [lock accuired] -> ...
                                         
Client #3 GetSomething -> TryLock -> -------------------- [wait for lock] ---> [accuire error] -> Return Error

Core Services

Payment

service Payment {
    rpc Charge  (chargeRequest) returns (charge)        {}
    rpc Refund  (refundRequest) returns (charge)        {}
    rpc Get     (getRequest)    returns (charge)        {}
    rpc List    (listRequest)   returns (chargeList)    {}
}

Full service definition.

Payment service is used for credit/debit card charge and refund, it is provides support of multiple payment providers as well. Usually there is no use in this service externally if you are using order functionality.

Order

service Order {
    rpc New     (newRequest)    returns (order)         {}
    rpc Get     (getRequest)    returns (order)         {}
    rpc Pay     (payRequest)    returns (order)         {}
    rpc Return  (returnRequest) returns (order)         {}
    rpc List    (listRequest)   returns (listResponse)  {}
}

Full service definition.

Order service helps you deal with structured purchases ie order. Naturally order is a collection of purchasable products,discounts,invoices and basic customer information.

Product

service Product {
    rpc New     (newRequest)    returns (product)       {}
    rpc Get     (getRequest)    returns (product)       {}
    rpc Update  (updateRequest) returns (product)       {}
    rpc Delete  (deleteRequest) returns (empty)         {}
    rpc List    (listRequest)   returns (productList)   {}
}

Full service definition.

Product service helps you manage your products, product represent collection of purchasable items(sku), physical or digital.

Sku

service Sku {
    rpc New     (newRequest)    returns (sku)           {}
    rpc Get     (getRequest)    returns (sku)           {}
    rpc Update  (updateRequest) returns (sku)           {}
    rpc Delete  (deleteRequest) returns (empty)         {}
    rpc List    (listRequest)   returns (skuList)       {}
}

Full service definition.

Sku service helps you manage your product Stock Keeping Units(SKU), sku represent specific product configuration such as attributes, currency and price.

For example, a product may be a football ticket, whereas a specific SKU represents the stadium section.

Sku is also used to manage its inventory and prevent oversell in case that the inventory type is Finite.

Usage example

Eventually the goal is to make life easier at the client-side, here's golang example of creating order and paying for it.. easy as that.

Create new order

order.New(context.Background(), &orderpb.NewRequest{
    Currency: paymentpb.Currency_EUR,
    Items: []*orderpb.OrderItem{
    	{
    		Parent:   "af350ecc-56c8-485f-8858-74d4faffa9cb",
    		Quantity: 2,
    		Type:     orderpb.OrderItem_sku,
    	},
    	{
    		Amount:      -1000,
    		Description: "Discount for being loyal customer",
    		Currency:    paymentpb.Currency_EUR,
    		Type:        orderpb.OrderItem_discount,
    	},
    	{
    		Amount:      1000,
    		Description: "Tax",
    		Currency:    paymentpb.Currency_EUR,
    		Type:        orderpb.OrderItem_tax,
    	},
    },
    Email: "[email protected]",
    Shipping: &orderpb.Shipping{
    	Name:  "Yaron Sumel",
    	Phone: "+972 000 000 000",
    	Address: &orderpb.Shipping_Address{
    		Line1:      "Loren ipsum",
    		City:       "San Jose",
    		Country:    "USA",
    		Line2:      "",
    		PostalCode: "12345",
    		State:      "CA",
    	},
    },
})

Pay the order

			
order.Pay(context.Background(), &orderpb.PayRequest{
    Id:                "bf350ecc-56c8-485f-8858-74d4faffa9cb",
    PaymentProviderId: paymentpb.PaymentProviderId_Stripe,
    Card: &paymentpb.Card{
        Type:        paymentpb.CardType_Visa,
    	CVC:         "123",
    	ExpireMonth: "12",
    	ExpireYear:  "2022",
    	LastName:    "Sumel",
    	FirstName:   "Yaron",
    	Number:      "4242424242424242",
    },
})			
			

Contribution

Development

Donations

License

// Digota <http://digota.com> - eCommerce microservice
// Copyright (c) 2018 Yaron Sumel <[email protected]>
//
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

You can find the complete license file here, for any questions regarding the license please contact us.

Contact

For any questions or inquiries please contact [email protected]

Owner
Digota
building the future of e-commerce.
Digota
Similar Resources

Microservice - Microservice golang & nodejs

Microservice - Microservice golang & nodejs

Microservice Gabungan service dari bahasa pemograman go, nodejs Demo API ms-auth

May 21, 2022

Customer-microservice - Microservice of customer built with golang and gRPC

🥳 Building microservices to manage customer data using Go and gRPC Command to g

Sep 8, 2022

JWT login microservice with plugable backends such as OAuth2, Google, Github, htpasswd, osiam, ..

JWT login microservice with plugable backends such as OAuth2, Google, Github, htpasswd, osiam, ..

loginsrv loginsrv is a standalone minimalistic login server providing a JWT login for multiple login backends. ** Attention: Update to v1.3.0 for Goog

Dec 24, 2022

Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing

imaginary Fast HTTP microservice written in Go for high-level image processing backed by bimg and libvips. imaginary can be used as private or public

Jan 3, 2023

A Microservice Toolkit from The New York Times

A Microservice Toolkit from The New York Times

Gizmo Microservice Toolkit This toolkit provides packages to put together server and pubsub daemons with the following features: Standardized configur

Dec 27, 2022

This library provides a simple framework of microservice, which includes a configurator, a logger, metrics, and of course the handler

Microservice The framework for the creation of microservices, written in Golang. (note: http microservice) Architecture microservice includes: handle

Dec 30, 2022

Microservice framework following best cloud practices with a focus on productivity.

patron Patron is a framework for creating microservices, originally created by Sotiris Mantzaris (https://github.com/mantzas). This fork is maintained

Dec 22, 2022

Go Todo Backend example using modular project layout for product microservice.

go-todo-backend Go Todo Backend Example Using Modular Project Layout for Product Microservice. It's suitable as starting point for a medium to larger

Dec 29, 2022

Flagr is a feature flagging, A/B testing and dynamic configuration microservice

Flagr is a feature flagging, A/B testing and dynamic configuration microservice

Introduction Flagr is an open source Go service that delivers the right experience to the right entity and monitors the impact. It provides feature fl

Dec 25, 2022

Go gRPC RabbitMQ email microservice

Go, RabbitMQ and gRPC Clean Architecture microservice 👋 👨‍💻 Full list what has been used: GRPC - gRPC RabbitMQ - RabbitMQ sqlx - Extensions to data

Dec 29, 2022

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications. Nomad is easy to operate and scale and has native Consul and Vault integrations.

Jan 5, 2023

A Microservice Toolkit from The New York Times

A Microservice Toolkit from The New York Times

Gizmo Microservice Toolkit This toolkit provides packages to put together server and pubsub daemons with the following features: Standardized configur

Jan 7, 2023

Go products microservice

Golang Kafka gRPC MongoDB microservice example 👋 👨‍💻 Full list what has been used: Kafka - Kafka library in Go gRPC - gRPC echo - Web framework vip

Dec 28, 2022

Kratos is a microservice-oriented governance framework implements by golang

Kratos is a microservice-oriented governance framework implements by golang

Kratos is a microservice-oriented governance framework implements by golang, which offers convenient capabilities to help you quickly build a bulletproof application from scratch.

Dec 27, 2022

⚡️ A dev tool for microservice developers to run local applications and/or forward others from/to Kubernetes SSH or TCP

⚡️ A dev tool for microservice developers to run local applications and/or forward others from/to Kubernetes SSH or TCP

Your new microservice development environment friend. This CLI tool allows you to define a configuration to work with both local applications (Go, Nod

Jan 4, 2023

Open Service Mesh (OSM) is a lightweight, extensible, cloud native service mesh that allows users to uniformly manage, secure, and get out-of-the-box observability features for highly dynamic microservice environments.

Open Service Mesh (OSM) is a lightweight, extensible, cloud native service mesh that allows users to uniformly manage, secure, and get out-of-the-box observability features for highly dynamic microservice environments.

Open Service Mesh (OSM) Open Service Mesh (OSM) is a lightweight, extensible, Cloud Native service mesh that allows users to uniformly manage, secure,

Jan 2, 2023

Modern microservice web framework of golang

Modern microservice web framework of golang

gogo gogo is an open source, high performance RESTful api framework for the Golang programming language. It also support RPC api, which is similar to

May 23, 2022

a microservice framework for rapid development of micro services in Go with rich eco-system

a microservice framework for rapid development of micro services in Go with rich eco-system

中文版README Go-Chassis is a microservice framework for rapid development of microservices in Go. it focus on helping developer to deliver cloud native a

Dec 27, 2022

Go microservice tutorial project using Domain Driven Design and Hexagonal Architecture!

"ToDo API" Microservice Example Introduction Welcome! 👋 This is an educational repository that includes a microservice written in Go. It is used as t

Jan 4, 2023
Comments
  • In-memory lock

    In-memory lock

    Implementing a simple in-memory locker would allow testing without dependencies as well as allow users to evaluate digota without much upfront effort.

  • Bug: multiple-value uuid.NewV4() in single-value context

    Bug: multiple-value uuid.NewV4() in single-value context

    Getting these errors when trying to install.

    $ go get -u github.com/digota/digota
    # github.com/digota/digota/storage/handlers/mongo
    src/github.com/digota/digota/storage/handlers/mongo/mongo.go:182: multiple-value uuid.NewV4() in single-value context
    # github.com/digota/digota/payment/service/providers/internalTestOnly
    src/github.com/digota/digota/payment/service/providers/internalTestOnly/internalTestOnly.go:52: multiple-value uuid.NewV4() in single-value context
    src/github.com/digota/digota/payment/service/providers/internalTestOnly/internalTestOnly.go:69: multiple-value uuid.NewV4() in single-value context
    

    Here's a Dockerfile that reproduces this error.

    FROM golang:1.9
    RUN go get -u github.com/digota/digota
    ENTRYPOINT [ "digota" ]
    
  • Glide vendoring

    Glide vendoring

    Maybe there are some tweeks needed for the travis file and I didn't pinned the versions in the glide yaml, but it's a bit easier to build if you checkout the repository.

    Issue #5

  • Storage Handler error

    Storage Handler error

    Good day,

    I am facing the below error when running setting up digota using the docker-compose.yaml file. Unable to connect to the mongo container instance running

    time="2018-12-19T10:20:30Z" level=fatal msg="Could not create storage handler => no reachable servers"

    Please assist,

    Regards

Trying to build an Ecommerce Microservice in Golang and Will try to make it Cloud Native - Learning Example extending the project of Nic Jackson

Golang Server Project Best Practices Dependency Injection :- In simple words, we want our functions and packages to receive the objects they depend on

Nov 28, 2022
Building microservice to list products of one ecommerce using golang and gRPC

Building microservice to list products of one ecommerce using golang and grpc Command for generate protobuf $ protoc -I ./protos/... file.proto --go_o

Mar 26, 2022
A fully functional Ecommerce API in GO GIN Framework and mongoDB with JWT Authentication
A fully functional Ecommerce API in GO GIN Framework and mongoDB  with JWT Authentication

Fully functional ECOMMERCE API USING GIN FRAMEWORK AND MONGODB -----Initial Release v2.30 ⚠️ Not tested the efficiency project structure Ecommerce ??

Dec 11, 2022
A checkout functionality for an ecommerce application
A checkout functionality for an ecommerce application

EcommerceApp Server A checkout functionality for an ecommerce application ?? Made with Golang ?? Installation and execution | Available Routes | How t

Nov 23, 2021
ecommerce Go, Mysql, Redis, Selenium.

ecommerce Go, Mysql, Redis, Selenium. To run locally Have docker & docker-compose installed on your operating system. cp .env.example .env && docker-c

Aug 31, 2022
Creating an API for an ecommerce with real scenarios
Creating an API for an ecommerce with real scenarios

Nagini Api Este projeto está sendo criado com a intenção de estudo e ao mesmo te

Jan 19, 2022
API desarrollada en Go (Golang) para modificar precios en una tienda eCommerce (Shopify)
API desarrollada en Go (Golang) para modificar precios en una tienda eCommerce (Shopify)

Go eCommerce API API para modificar precios de productos en una tienda eCommerce de Shopify. Instrucciones Ingresar a la tienda eCommerce. Seleccionar

Oct 1, 2021
Ecommerce-api - Rest api of e-commerce web application
Ecommerce-api - Rest api of e-commerce web application

E-commerce Rest API Swagger documentation to test api Domain diagram

Jan 2, 2023
Authentication-microservice - Microservice for user authentication built with golang and gRPC

Authentication-microservice - Microservice for user authentication built with golang and gRPC

May 30, 2022
Microservice - A sample architecture of a microservice in go

#microservice Folder structure required. service certs config config.yaml loggin

Feb 3, 2022