nurd-commerce-core

command module
v0.0.0-...-bff178f Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

README

nurd-commerce-core

Setting up the environment

Prerequisites
Project setup
  • Checkout the project locally

    git clone https://github.com/nurdsoft/nurd-commerce-core
    
  • Change the directory to the project folder

    cd nurd-commerce-core
    
  • To install the necessary libraries & tools run the below command

    make setup
    # this will take some time. Grab a coffee ☕️
    

Application Configuration

The application configuration is in the file ./config.yaml. Please change the values appropriately based on the environment.

Environment Variables

You can override the configuration values by setting them as environment values. Below are the environment variables that can override the config.yaml values.

Copy these values in a .env file.

cp .env.sample .env

[!TIP] Ask a team member for the values of the environment variables.

After adding the correct values, use make env to export the environment variables (only for MacOS and Linux).

Running the application

Local Env

Start Environment
  • To start the services that are required for the application (e.g. database) run the below command

    make start-env
    
Build application
  • Build the application using the below command

    make nurd-commerce
    
Running application
  • Run the application locally using the below command

    make run-dev
    

    Access the application on http://localhost:8080 and you should see the OK JSON response from the application. Access the Swagger API docs on http://127.0.0.1:8080/docs/swagger/

Running the application in the docker container
  • Run the application in the docker container using the below command

    make start-app
    
Stop Environment
  • To stop all the services run the below command

    make stop-env
    

Kick-start running the whole application

  • To run all the services including the application run the below commands

    git clone https://github.com/nurdsoft/nurd-commerce-core
    cd nurd-commerce-core
    make start-all
    

Database migrations

We use sql-migrate for database migrations

  • To create a new migration

    make name=migration_script_file_name new-migration
    
  • To apply outstanding migrations

    make migrate
    
  • To roll back the last migration

    make migrate direction=down
    

Generating Mocks for Unit Testing

We use mockgen to generate mocks for unit testing. To generate mocks, run the below command

mockgen -source=internal/... -destination=internal/mocks/mock.go -package=package_name

[!TIP] Keep the mocks updated by running make mocks.

Integration Tests

This project includes integration tests that use a real PostgreSQL database to test database operations and queries.

Running Integration Tests Locally

make test-integration

Database Configuration

The integration tests use a separate test database with the following configuration:

  • Host: localhost
  • Port: 5453 (separate from the main app database on 5452)
  • Database: commerce-core
  • User: db
  • Password: 123

This ensures that integration tests don't interfere with your local development database.

Documentation

Overview

Package main is the main app

Directories

Path Synopsis
Package cmd contains commands
Package cmd contains commands
Package classification Commerce Core API
Package classification Commerce Core API
internal
address/addressclient
Package addressclient is a generated GoMock package.
Package addressclient is a generated GoMock package.
address/repository
Package repository is a generated GoMock package.
Package repository is a generated GoMock package.
cart/cartclient
Package cartclient is a generated GoMock package.
Package cartclient is a generated GoMock package.
cart/repository
Package repository is a generated GoMock package.
Package repository is a generated GoMock package.
customer/customerclient
Package customerclient is a generated GoMock package.
Package customerclient is a generated GoMock package.
customer/repository
Package repository is a generated GoMock package.
Package repository is a generated GoMock package.
orders/ordersclient
Package ordersclient is a generated GoMock package.
Package ordersclient is a generated GoMock package.
orders/repository
Package repository is a generated GoMock package.
Package repository is a generated GoMock package.
product/productclient
Package productclient is a generated GoMock package.
Package productclient is a generated GoMock package.
product/repository
Package repository is a generated GoMock package.
Package repository is a generated GoMock package.
swagger
Package swagger
Package swagger
swagger/transport/http
Package http for conx.
Package http for conx.
transport
Package transport
Package transport
transport/http
Package http for transport.
Package http for transport.
transport/http/client
Package client sending requests to network services
Package client sending requests to network services
transport/http/encode
Package http for conx.
Package http for conx.
webhook/client
Package client is a generated GoMock package.
Package client is a generated GoMock package.
wishlist/repository
Package repository is a generated GoMock package.
Package repository is a generated GoMock package.
wishlist/wishlistclient
Package wishlistclient is a generated GoMock package.
Package wishlistclient is a generated GoMock package.
shared
auth
Package auth provides a way to interact with auth for different transports.
Package auth provides a way to interact with auth for different transports.
cache
Package cache is a generated GoMock package.
Package cache is a generated GoMock package.
cfg
db
Package db contains function which helps to work with PostgreSQL
Package db contains function which helps to work with PostgreSQL
db/migrate command
Package main is db/migrate app
Package main is db/migrate app
db/migrate/migrate
Package migrate
Package migrate
health
Package health allows the application to perform health checks
Package health allows the application to perform health checks
health/check
Package check provides a way to do health checks
Package check provides a way to do health checks
health/endpoint
Package endpoint contains health endpoints
Package endpoint contains health endpoints
health/service
Package service provides a way to do health checks
Package service provides a way to do health checks
health/transport/http
Package http contains health http transport
Package http contains health http transport
log
Package log is based on uber zap
Package log is based on uber zap
meta
Package meta contains metadata about request
Package meta contains metadata about request
module
Package module contains set of Uber fx modules
Package module contains set of Uber fx modules
transport
Package transport supports transports like HTTP, gRPC and AMQP
Package transport supports transports like HTTP, gRPC and AMQP
transport/http
Package http contains http client/server with all necessary interceptor for logging, tracing, etc
Package http contains http client/server with all necessary interceptor for logging, tracing, etc
transport/http/interceptors
Package interceptors for logging, tracing, etc
Package interceptors for logging, tracing, etc
transport/http/interceptors/auth
Package auth contains interceptors for auth information
Package auth contains interceptors for auth information
transport/http/interceptors/logging
Package logging contains logs interceptors
Package logging contains logs interceptors
Package maxbytesreader
transport/http/interceptors/meta
Package meta contains interceptors for meta information
Package meta contains interceptors for meta information
transport/http/interceptors/metrics
Package metrics HTTP Prometheus monitoring interceptors for server-side HTTP.
Package metrics HTTP Prometheus monitoring interceptors for server-side HTTP.
transport/http/interceptors/paths
Package paths provides ways to check specifics about HTTP request paths
Package paths provides ways to check specifics about HTTP request paths
transport/http/interceptors/retry
Package retry provides retry support for any http client or server.
Package retry provides retry support for any http client or server.
vendors/inventory
Package inventory contains function which helps to work with Inventory
Package inventory contains function which helps to work with Inventory
vendors/inventory/salesforce/client
Package client is a generated GoMock package.
Package client is a generated GoMock package.
vendors/inventory/salesforce/service
Package service is a generated GoMock package.
Package service is a generated GoMock package.
vendors/payment
Package payment contains function which helps to work with Payment
Package payment contains function which helps to work with Payment
vendors/payment/authorizenet/client
Package client is a generated GoMock package.
Package client is a generated GoMock package.
vendors/payment/authorizenet/service
Package service is a generated GoMock package.
Package service is a generated GoMock package.
vendors/payment/stripe/client
Package client is a generated GoMock package.
Package client is a generated GoMock package.
vendors/payment/stripe/service
Package service is a generated GoMock package.
Package service is a generated GoMock package.
vendors/shipping
Package shipping contains function which helps to work with Shipping
Package shipping contains function which helps to work with Shipping
vendors/shipping/client
Package client is a generated GoMock package.
Package client is a generated GoMock package.
vendors/shipping/providers/shipengine/client
Package client is a generated GoMock package.
Package client is a generated GoMock package.
vendors/shipping/providers/shipengine/service
Package service is a generated GoMock package.
Package service is a generated GoMock package.
vendors/shipping/providers/ups/client
Package client is a generated GoMock package.
Package client is a generated GoMock package.
vendors/shipping/providers/ups/service
Package service is a generated GoMock package.
Package service is a generated GoMock package.
vendors/taxes
Package taxes contains function which helps to work with Taxes
Package taxes contains function which helps to work with Taxes
vendors/taxes/stripe/client
Package client is a generated GoMock package.
Package client is a generated GoMock package.
vendors/taxes/stripe/service
Package service is a generated GoMock package.
Package service is a generated GoMock package.
vendors/taxes/taxjar/service
Package service is a generated GoMock package.
Package service is a generated GoMock package.

Jump to

Keyboard shortcuts

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