Code Monkey home page Code Monkey logo

litecart's Introduction

litecart - shopping-cart in 1 file

CodeFactor

🛒  What is litecart?

Litecart is an open source shopping-cart in 1 file of embedded database (SQLite), convenient dashboard UI and simple site.

Warning

Current major version is zero (v0.x.x) to accommodate rapid development and fast iteration while getting early feedback from users. Please keep in mind that litecart is still under active development and therefore full backward compatibility is not guaranteed before reaching v1.0.0.

Example

🏆  Features

🚀 Simple and Fast: Enjoy a one-click installation process that gets your store up and running quickly, saving you time and effort.

💰 Support for Popular Payment Systems: Accept payments seamlessly with support for popular payment systems, ensuring a smooth checkout experience for your customers.

🔑 Sell Files and License Keys: Whether you're selling digital files or license keys, litecart has you covered, providing flexibility in the types of products you can offer.

⚙️ Lightweight and Efficient: litecart utilizes SQLite as its embedded database, eliminating the need for heavy databases like MySQL, PostgreSQL, or MongoDB. This results in a lightweight website that performs exceptionally well.

☁️ Easily Customizable: Modify and customize your litecart website effortlessly to match your branding and unique requirements, making it truly your own.

🧞‍♂️ Convenient Administration Panel: With a user-friendly dashboard UI, litecart offers a hassle-free administration panel, allowing you to manage your store, inventory, and orders with ease.

⚡️ Hardware Compatibility: Whether you're running litecart on a powerful server or a modest hardware setup, rest assured that it will work seamlessly, providing a consistent shopping experience for your customers.

🔒 Built-in HTTPS Support: Prioritizing security, litecart comes with built-in support for HTTPS, ensuring the safety of your customers' data.

⬇️  Installation

litecart is engineered for easy installation and operation, requiring just a single command from your terminal. Besides the conventional installation method, litecart can also be set up and operated via HomeBrew, Docker, or any other container orchestration tools like Docker Compose, Docker Swarm, Rancher, or Kubernetes.

 Install on macOS

The fastest method to install litecart on macOS involves using Homebrew. This will install the command-line tools and the litecart server as a combined executable. If you don't utilize Homebrew, adhere to the Linux instructions below for litecart installation.

brew install shurco/tap/litecart

Alternately, you can configure the tap and install the package separately:

$ brew tap shurco/tap
$ brew install litecart

 Install on Linux

The most straightforward and recommended method to start using litecart on Unix operating systems involves installing and utilizing the litecart command-line tool. Execute the given command in your terminal and adhere to the instructions displayed on the screen.

curl -L https://raw.githubusercontent.com/shurco/litecart/main/scripts/install | sh

 Install on Windows

The simplest and most recommended method to start using litecart on Windows is by installing and utilizing the litecart command-line tool. Execute the given command in your terminal and adhere to the instructions displayed on the screen.

curl -L https://raw.githubusercontent.com/shurco/litecart/main/scripts/install | sh

or download and unzip the latest version for Windows.

 Run using Docker

Docker enables the management and operation of a litecart instance without requiring the installation of any command-line tools. The litecart Docker container includes all necessary command-line tools or even for server execution.

For Docker Hub:

docker run \
  -v ./lc_base:/lc_base \
  -v ./lc_digitals:/lc_digitals \
  -v ./lc_uploads:/lc_uploads \
  -v ./site:/site \
  --rm shurco/litecart:latest init

docker run \
  --name litecart \
  --restart unless-stopped \
  -p '8080:8080' \
  -v ./lc_base:/lc_base \
  -v ./lc_digitals:/lc_digitals \
  -v ./lc_uploads:/lc_uploads \
  -v ./site:/site \
  shurco/litecart:latest

or if use Github Packages Hub:

docker run \
  -v ./lc_base:/lc_base \
  -v ./lc_digitals:/lc_digitals \
  -v ./lc_uploads:/lc_uploads \
  -v ./site:/site \
  --rm ghcr.io/shurco/litecart:latest init

docker run \
  --name litecart \
  --restart unless-stopped \
  -p '8080:8080' \
  -v ./lc_base:/lc_base \
  -v ./lc_digitals:/lc_digitals \
  -v ./lc_uploads:/lc_uploads \
  -v ./site:/site \
  ghcr.io/shurco/litecart:latest

⬇️  Updating

Warning

Before any update, be sure to make a backup of the ./lc_base folder and the ./site folder.

Update on macOS / Linux / Windows

The easiest way to update litecart to the latest version is to execute the command:

./litecart update

If there were changes in the database structure during the update, it is necessary to perform migration. To do this, you need to run the command from the litecart folder:

./litecart migrate

  Update using Docker

Our mantra is to make updating a seamless experience. Simply download the new image and launch the container as you normally would. For example, if use Docker Hub:

docker stop litecart
docker pull shurco/litecart:latest # download new image
docker rename litecart litecart-backup # do image backup
docker run \
  --name litecart \
  --restart unless-stopped \
  -p '8080:8080' \
  -v ./lc_base:/lc_base \
  -v ./lc_digitals:/lc_digitals \
  -v ./lc_uploads:/lc_uploads \
  -v ./site:/site \
  shurco/litecart:latest

If there were changes in the database structure during the update, it is necessary to perform migration. To do this, you need to run the command from the litecart folder:

docker run \
-v ./lc_base:/lc_base \
-v ./site:/site \
--rm shurco/litecart migrate

🚀  Getting started

Getting started with litecart is as easy as starting up the litecart server

Default run for Linux/macOS:

./litecart serve

For Windows:

litecart.exe serve

When launched for the first time, necessary folders will be created in the directory with the executable file. The default links for access are:

If you need to run on a different port, use the flag --http:

./litecart serve --http 0.0.0.0:8088

Note

Ports <= 1024 are privileged ports. You can't use them unless you're root or have the explicit permission to use them. See this answer for an explanation or wikipedia or something you trust more. Use: sudo setcap 'cap_net_bind_service=+ep' /path_to/litecart

📚  Commands

Usage:

./litecart [command] [flags]

Available commands:

init        Creating the basic structure
migrate     Migrate on the latest version of database schema
serve       Starts the web server (default to 0.0.0.0:8080)
update      Updating the application to the latest version

Global flags ./litecart [flags]:

-h, --help      help for litecart
-v, --version   version for litecart

Serve flags ./litecart serve [flags]:

--http string    server address (default "0.0.0.0:8080")
--https string   https server address (auto TLS)
--no-site        disable create site

🏦  Adding payment systems

Stripe

Stripe is a popular payment system that allows you to accept online payments from customers. It provides various tools and APIs for processing payments, including the ability to accept credit and debit cards, digital wallets, and bank transfers. Stripe ensures payment security, currency processing, and support for various payment methods.

To obtain the Secret key in Stripe, follow these steps:

  1. Log in to your Stripe account on the official Stripe website. If you don't have an account, register for one.
  2. In the top right corner, select the Developers section.
  3. In the dropdown menu, choose "API Keys".
  4. In the "Standard keys" section, you will find your "Secret key".

Warning

Please note that the "Secret key" is confidential information that should be kept secure.

PayPal

PayPal is an online payment system that allows individuals and businesses to send and receive money over the internet. It enables payments for goods and services, as well as transfers between users. PayPal provides a secure and convenient way to make electronic payments.

To obtain a Client ID and Secret Key for using the PayPal API, you need to follow these steps:

  1. To use the API, you will need a PayPal business account.
  2. Go to the PayPal Developer website and sign in with your PayPal business account credentials.
  3. In the Dashboard, find the "My Apps & Credentials" section and create a new application by clicking the "Create App" button.
  4. On the application page, you will see your Client ID. It will be visible immediately after creating the application. To see the Secret Key, click on the "Show" button under the "Secret" label.

Warning

Please note that the "Secret key" is confidential information that should be kept secure.

SpectroCoin

SpectroCoin is a payment system and cryptocurrency wallet that allows users to send and receive payments in various currencies, including cryptocurrencies such as Bitcoin, Ethereum, and others. It also offers currency exchange operations between different currencies and the ability to deposit and withdraw funds to bank accounts. SpectroCoin ensures the security of payments and cryptocurrency storage, as well as offering additional features such as debit cards.

To obtain a "Merchant ID", "Project (API) ID" and "Private key" in SpectroCoin, follow these steps:

  1. Register on SpectroCoin if you don't have an account yet.
  2. Log in to your SpectroCoin account.
  3. Go to the "Business" section in the navigation menu.
  4. Navigate to the "New project" section in the navigation menu.
  5. Fill in the project name and make sure to enable the "Public key" section. A window with a "Private key" will appear, copy and save it. You can activate other options if needed.
  6. After filling in the details, you will be redirected to the projects page. Go to the created project and in the header, copy the "Merchant ID" and "Project (API) ID".

Warning

Please note that creating a project may require you to complete the verification process for your SpectroCoin account.
Please note that the "Private key" is confidential information that should be kept secure.

🧩  For developers

The backend is developed in Go language. The frontend (admin site and base site) operates on the Vue3 and TailwindCSS.

There are a number of scripts (in the ./scripts folder) that simplify development:
./scripts/golang - Installs or updates a previously installed version of go (if needed).
./scripts/migration - Helps to work with migrations. For instance, the ./scripts/migration dev up command will apply new migrations from folder ./migrations, then implement the migrations from folder ./fixtures.
./scripts/sqlite - Optimizes the existing database.
./scripts/tools - Sets up the necessary environment for development (if needed).
./scripts/webscripts - For the basic site, updates vue3 to the latest version.
./scripts/clear - Removing hung golang or vite processes.

Note

I recommend running the ./scripts/migration dev up command. It will add test data to the database, which makes it easier to work with. For example, it will create products, transfer test images and create a test user for access to the admin panel:
login - [email protected]
password - Pass123

Admin panel (frontend)

To develop the web interface of the admin panel, you need to start the litepay server (for example, execute the command from the project root go run ./cmd/main.go serve). The entire code is located in the folder ./web/admin.
All the code is located in the folder ./web/admin. The command cd ./web/admin && yarn run dev will start the development server for the admin panel web interface. By default, it will be available at http://localhost:5173/_/.

Base site (frontend)

To develop the web interface of the admin panel, you need to start the litepay server (for example, execute the command from the project root go run ./cmd/main.go serve).
Run ./scripts/webscripts to download and install the necessary JavaScript libraries into the folder ./web/site/public/assets/js/. To update the styles, it is necessary to execute the command cd ./web/site && yarn run build.
If you actively change styles, you can run the command cd ./web/site && yarn run dev. It will monitor changes in files and automatically update the style file.

🗺️  ToDo

litecart has a roadmap and I try to work on issues in specific order and such PRs often come in out of nowhere and skew all initial planning with tedious back-and-forth communication.

👍  Contribute

If you want to say thank you and/or support the active development of litecart:

  1. Add a GitHub Star to the project.
  2. Tweet about the project on your Twitter.
  3. Write a review or tutorial on Medium, Dev.to or personal blog.
  4. Support the project by donating a cup of coffee.

You can learn more about how you can contribute to this project in the contribution guide.

litecart's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar msalbrain avatar shurco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

litecart's Issues

🐛 [Bug]: First step after install

Bug Description

Invalid token, after installation and authorization in the admin.

Expected Behavior

Invalid token

litecart Version

v0.1.0

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.

🚀 [Feature]: More language support and more currency support

Feature Description

I've used this program successfully and it's very clean and fast. But there are too few things that can be customized, and the homepage is a little sketchy. The shopping cart is only in English, and the currency types are only USD and EUR, I hope to add support for RMB.There is no formatting support for the description page of the product, it is suggested to add markdown support.

Additional Context (optional)

No response

Code Snippet (optional)

No response

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my suggestion prior to opening this one.
  • I understand that improperly formatted feature requests may be closed without explanation.

🐛 [Bug]: error 413 (Payload Too Large) for files over a megabyte

Bug Description

When I'm uploading a file-asset over a megabyte, the server will fail silently with: 413 (Payload Too Large) in the browser console

I guess I can just overwrite a small file with a bigger one (in the lc_digital) using scp e.g., but perhaps the upload-endpoint could accept a higher uploadsize.

How to Reproduce

Steps to reproduce the behavior:

  1. add a product
  2. upload a digital file around 10 mb

Expected Behavior

accept bigger file uploads

litecart Version

v0.1.9

Code Snippet (optional)

No response

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.

🐛 [Bug]: Cant add paymethod spectrocoin

Bug Description

ERROR:

2024/01/09 11:10:40 | stdout | {"level":"warn","latency":"603.536µs","status":404,"method":"PATCH","url":"/api/_/settings","time":1704769840,"message":"Client error"} -- | -- | --

image

How to Reproduce

Steps to reproduce the behavior:
ADD NEW PAYMETHOD

Expected Behavior

NEW PAYMETHOD

litecart Version

v0.1.9

Code Snippet (optional)

2024/01/09 11:10:40 | stdout | {"level":"warn","latency":"603.536µs","status":404,"method":"PATCH","url":"/api/_/settings","time":1704769840,"message":"Client error"}
-- | -- | --

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.

🤗 [Question]: admn credentials docker

first of all thank you for this project

Question Description

Is it possible that the docker image isn't primed with admin data?
Even after running the docker init or restarting I can't seem to login with [email protected] / Pass123

error:

🛒 litecart - open source shopping-cart in 1 file
├─ Cart UI: http://0.0.0.0:8080/
└─ Admin UI: http://0.0.0.0:8080/_/
{"level":"info","latency":"1.511822ms","status":200,"method":"GET","url":"/_/signin","time":1704103392,"message":"Success"}
{"level":"error","caller":"/home/runner/work/litecart/litecart/internal/handlers/private/auth.go:36","error":"user with the given email is not found","time":1704103400}
{"level":"error","latency":"16.248537ms","status":500,"method":"POST","url":"/api/sign/in","time":1704103400,"message":"Server error"}

shellscript to reproduce:

test -d lc_base || {
  mkdir -p lc_base lc_digitals lc_uploads site || true
  docker run \
    -v ./lc_base:/lc_base \
    -v ./lc_digitals:/lc_digitals \
    -v ./lc_uploads:/lc_uploads \
    -v ./site:/site \
    --rm shurco/litecart:latest init
}

docker run -d \
  --name litecart \
  --restart unless-stopped \
  -p '8090:8080' \
  -v ./lc_base:/lc_base \
  -v ./lc_digitals:/lc_digitals \
  -v ./lc_uploads:/lc_uploads \
  -v ./site:/site \
  shurco/litecart:latest

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my questions prior to opening this one.
  • I understand that improperly formatted questions may be closed without explanation.

🚀 [Feature]: sell recurring services (ie: seo for clients)

Feature Description

I'm using gumroad now but its not ideal, they actually don't officially support services only files.

Additional Context (optional)

No response

Code Snippet (optional)

package main

import "fmt"

func main() {
  fmt.Print("hello word")
}

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my suggestion prior to opening this one.
  • I understand that improperly formatted feature requests may be closed without explanation.

🐛 [Bug]: ERROR:failed to render: render: template index does not exist

Bug Description

image

I can access Admin UI,but when I setted up,I cant access Cart UI

How to Reproduce

I build it with docker
error log
2023/11/22 10:31:54 | stdout | {"level":"error","latency":"332.804µs","status":500,"method":"GET","url":"/","error":"failed to render: render: template index does not exist","time":"2023-11-22T02:31:54Z","message":"Server error"}

Expected Behavior

Cant access Cart UI

litecart Version

v0.1.5

Code Snippet (optional)

No response

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.

🤗 [Question]: How to configure the stripe?

Question Description

Hi, I had build litecart wit docker on my Nas,I access litecart by Cloudflare Tunnel,But I can’t configure the stripe Pay method.
Is there have a guide?

By the way.I want help translate litecart into Chinese,How can I do that?

Code Snippet (optional)

No response

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my questions prior to opening this one.
  • I understand that improperly formatted questions may be closed without explanation.

🚀 [Feature]: Support for payment via Webhook

Feature Description

this is the simplest payment provider: a webhook

Basically, this payment provider just returns a {payment: 'success'} status e.g.

Reason: in the broadsense a transactio/payment can also mean 'entitled to download'.
Imagine a transaction which requires a somebody starring a github project, liking a post e.g.
Or even fictional currencies like kudos per users (in a db elsewhere).
Using this generic payment webhook, various other integrations could become possible (even proxying to payment provider-integrations which run elsewhere)

Additional Context (optional)

No response

Code Snippet (optional)

No response

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my suggestion prior to opening this one.
  • I understand that improperly formatted feature requests may be closed without explanation.

Cognitive Code complexity

Bug Description

read about it here:
https://dev.to/marcello_h/solve-code-complexity-in-go-56hg
It is up to you what you want to do with this knowledge.

My report:
litecart/internal/app.go:34:1 - NewApp has complexity: 27
complexity = 1

  • 1 (found 'if' at line: 40, complexity = 2)
  • 1 (found 'if' at line: 45, complexity = 3)
  • 1 (found 'if' at line: 57, complexity = 4)
  • 1 (found 'if with lines >= 10' at line: 57, complexity = 5)
    • 2 (found 'if' at line: 59, complexity = 7)
    • 2 (found 'else' at line: 61, complexity = 9)
      • 3 (found 'if' at line: 62, complexity = 12)
  • 1 (found 'if' at line: 83, complexity = 13)
  • 1 (found 'if' at line: 97, complexity = 14)
  • 1 (found 'if' at line: 107, complexity = 15)
  • 1 (found 'if with lines >= 10' at line: 107, complexity = 16)
  • 1 (found 'if with lines >= 25' at line: 107, complexity = 17)
    • 2 (found 'if' at line: 122, complexity = 19)
    • 2 (found 'if' at line: 127, complexity = 21)
  • 1 (found 'if' at line: 133, complexity = 22)
  • 1 (found 'else' at line: 135, complexity = 23)
  • 1 (found 'else with lines >= 10' at line: 135, complexity = 24)
    • 2 (found 'go' at line: 138, complexity = 26)
    • 2 (found 'go with lines >= 10' at line: 138, complexity = 27)

litecart/internal/handlers/private/setting.go:19:1 - Version has complexity: 14
complexity = 1

  • 1 (found 'if' at line: 23, complexity = 2)
  • 1 (found 'logical operator' at line: 23, complexity = 3)
  • 1 (found 'if' at line: 28, complexity = 4)
  • 1 (found 'if with lines >= 10' at line: 28, complexity = 5)
    • 2 (found 'if' at line: 32, complexity = 7)
    • 2 (found 'if' at line: 36, complexity = 9)
    • 2 (found 'if' at line: 41, complexity = 11)
    • 2 (found 'if' at line: 47, complexity = 13)
  • 1 (found 'if' at line: 52, complexity = 14)

litecart/internal/handlers/public/cart.go:17:1 - Checkout has complexity: 13
complexity = 1

  • 1 (found 'if' at line: 19, complexity = 2)
  • 1 (found 'range' at line: 24, complexity = 3)
  • 1 (found 'if' at line: 32, complexity = 4)
  • 1 (found 'if' at line: 37, complexity = 5)
  • 1 (found 'range' at line: 42, complexity = 6)
  • 1 (found 'range with lines >= 10' at line: 42, complexity = 7)
  • 1 (found 'range with lines >= 25' at line: 42, complexity = 8)
    • 2 (found 'range' at line: 44, complexity = 10)
    • 2 (found 'if' at line: 61, complexity = 12)
  • 1 (found 'if' at line: 81, complexity = 13)

litecart/internal/queries/cart.go:21:1 - Carts has complexity: 17
complexity = 1

  • 1 (found 'if' at line: 39, complexity = 2)
  • 1 (found 'defer' at line: 42, complexity = 3)
  • 1 (found 'for' at line: 44, complexity = 4)
  • 1 (found 'for with lines >= 10' at line: 44, complexity = 5)
  • 1 (found 'for with lines >= 25' at line: 44, complexity = 6)
    • 2 (found 'if' at line: 60, complexity = 8)
    • 2 (found 'if' at line: 64, complexity = 10)
    • 2 (found 'if' at line: 68, complexity = 12)
    • 2 (found 'if' at line: 72, complexity = 14)
    • 2 (found 'if' at line: 76, complexity = 16)
  • 1 (found 'if' at line: 83, complexity = 17)

litecart/internal/queries/cart.go:151:1 - CartSendMail has complexity: 74
complexity = 1

  • 1 (found 'if' at line: 158, complexity = 2)
    • 2 (found 'if' at line: 159, complexity = 4)
  • 1 (found 'if' at line: 165, complexity = 5)
  • 1 (found 'if' at line: 170, complexity = 6)
  • 1 (found 'defer' at line: 173, complexity = 7)
  • 1 (found 'defer with lines >= 5' at line: 173, complexity = 8)
    • 2 (found 'if' at line: 174, complexity = 10)
  • 1 (found 'logical operator' at line: 174, complexity = 11)
    • 2 (found 'else' at line: 176, complexity = 13)
  • 1 (found 'range' at line: 181, complexity = 14)
  • 1 (found 'range with lines >= 10' at line: 181, complexity = 15)
  • 1 (found 'range with lines >= 25' at line: 181, complexity = 16)
  • 1 (found 'range with lines >= 50' at line: 181, complexity = 17)
    • 2 (found 'if' at line: 184, complexity = 19)
      • 3 (found 'if' at line: 185, complexity = 22)
    • 2 (found 'if' at line: 191, complexity = 24)
    • 2 (found 'if with lines >= 10' at line: 191, complexity = 25)
      • 3 (found 'if' at line: 193, complexity = 28)
      • 3 (found 'defer' at line: 196, complexity = 31)
      • 3 (found 'for' at line: 198, complexity = 34)
      • 3 (found 'for with lines >= 10' at line: 198, complexity = 35)
        • 4 (found 'if' at line: 206, complexity = 39)
    • 2 (found 'if' at line: 213, complexity = 41)
    • 2 (found 'if with lines >= 10' at line: 213, complexity = 42)
      • 3 (found 'if' at line: 216, complexity = 45)
  • 1 (found 'logical operator' at line: 216, complexity = 46)
    • 3 (found 'if' at line: 219, complexity = 49)
    • 3 (found 'if with lines >= 10' at line: 219, complexity = 50)
      • 4 (found 'if' at line: 221, complexity = 54)
        • 5 (found 'if' at line: 222, complexity = 59)
      • 4 (found 'if' at line: 227, complexity = 63)
  • 1 (found 'if' at line: 236, complexity = 64)
  • 1 (found 'if' at line: 240, complexity = 65)
  • 1 (found 'if' at line: 243, complexity = 66)
  • 1 (found 'if' at line: 250, complexity = 67)
    • 2 (found 'range' at line: 252, complexity = 69)
  • 1 (found 'if' at line: 258, complexity = 70)
    • 2 (found 'range' at line: 260, complexity = 72)
  • 1 (found 'if' at line: 274, complexity = 73)
  • 1 (found 'if' at line: 278, complexity = 74)

litecart/internal/queries/install.go:19:1 - Install has complexity: 17
complexity = 1

  • 1 (found 'defer' at line: 21, complexity = 2)
  • 1 (found 'if' at line: 24, complexity = 3)
  • 1 (found 'defer' at line: 27, complexity = 4)
  • 1 (found 'defer with lines >= 5' at line: 27, complexity = 5)
    • 2 (found 'if' at line: 28, complexity = 7)
  • 1 (found 'logical operator' at line: 28, complexity = 8)
    • 2 (found 'else' at line: 30, complexity = 10)
  • 1 (found 'if' at line: 37, complexity = 11)
  • 1 (found 'if' at line: 42, complexity = 12)
  • 1 (found 'defer' at line: 45, complexity = 13)
  • 1 (found 'if' at line: 49, complexity = 14)
  • 1 (found 'range' at line: 62, complexity = 15)
    • 2 (found 'if' at line: 63, complexity = 17)

litecart/internal/queries/pages.go:26:1 - ListPages has complexity: 13
complexity = 1

  • 1 (found 'if' at line: 32, complexity = 2)
  • 1 (found 'if' at line: 37, complexity = 3)
  • 1 (found 'defer' at line: 40, complexity = 4)
  • 1 (found 'for' at line: 42, complexity = 5)
  • 1 (found 'for with lines >= 10' at line: 42, complexity = 6)
    • 2 (found 'if' at line: 48, complexity = 8)
    • 2 (found 'if' at line: 52, complexity = 10)
    • 2 (found 'if' at line: 56, complexity = 12)
  • 1 (found 'if' at line: 63, complexity = 13)

litecart/internal/queries/products.go:22:1 - ListProducts has complexity: 21
complexity = 1

  • 1 (found 'if' at line: 44, complexity = 2)
  • 1 (found 'if with lines >= 10' at line: 44, complexity = 3)
    • 2 (found 'range' at line: 51, complexity = 5)
  • 1 (found 'if' at line: 58, complexity = 6)
  • 1 (found 'if' at line: 64, complexity = 7)
  • 1 (found 'defer' at line: 67, complexity = 8)
  • 1 (found 'for' at line: 69, complexity = 9)
  • 1 (found 'for with lines >= 10' at line: 69, complexity = 10)
  • 1 (found 'for with lines >= 25' at line: 69, complexity = 11)
    • 2 (found 'if' at line: 82, complexity = 13)
    • 2 (found 'if' at line: 86, complexity = 15)
  • 1 (found 'logical operator' at line: 86, complexity = 16)
    • 2 (found 'if' at line: 90, complexity = 18)
  • 1 (found 'if' at line: 97, complexity = 19)
  • 1 (found 'if' at line: 103, complexity = 20)
  • 1 (found 'logical operator' at line: 103, complexity = 21)

litecart/internal/queries/products.go:111:1 - Product has complexity: 13
complexity = 1

  • 1 (found 'if' at line: 132, complexity = 2)
  • 1 (found 'else' at line: 134, complexity = 3)
  • 1 (found 'if' at line: 158, complexity = 4)
    • 2 (found 'if' at line: 159, complexity = 6)
  • 1 (found 'if' at line: 165, complexity = 7)
  • 1 (found 'if' at line: 169, complexity = 8)
  • 1 (found 'logical operator' at line: 169, complexity = 9)
  • 1 (found 'if' at line: 173, complexity = 10)
  • 1 (found 'if' at line: 177, complexity = 11)
  • 1 (found 'if' at line: 181, complexity = 12)
  • 1 (found 'if' at line: 185, complexity = 13)

litecart/internal/queries/products.go:350:1 - ProductDigital has complexity: 31
complexity = 1

  • 1 (found 'defer' at line: 354, complexity = 2)
  • 1 (found 'if' at line: 357, complexity = 3)
  • 1 (found 'defer' at line: 361, complexity = 4)
  • 1 (found 'defer with lines >= 5' at line: 361, complexity = 5)
    • 2 (found 'if' at line: 362, complexity = 7)
  • 1 (found 'logical operator' at line: 362, complexity = 8)
    • 2 (found 'else' at line: 364, complexity = 10)
  • 1 (found 'if' at line: 372, complexity = 11)
    • 2 (found 'if' at line: 373, complexity = 13)
  • 1 (found 'if' at line: 379, complexity = 14)
  • 1 (found 'else' at line: 381, complexity = 15)
  • 1 (found 'if' at line: 387, complexity = 16)
  • 1 (found 'defer' at line: 390, complexity = 17)
  • 1 (found 'for' at line: 392, complexity = 18)
  • 1 (found 'for with lines >= 10' at line: 392, complexity = 19)
    • 2 (found 'if' at line: 400, complexity = 21)
  • 1 (found 'if' at line: 407, complexity = 22)
  • 1 (found 'if' at line: 413, complexity = 23)
  • 1 (found 'defer' at line: 416, complexity = 24)
  • 1 (found 'for' at line: 418, complexity = 25)
  • 1 (found 'for with lines >= 10' at line: 418, complexity = 26)
    • 2 (found 'if' at line: 427, complexity = 28)
    • 2 (found 'if' at line: 431, complexity = 30)
  • 1 (found 'if' at line: 438, complexity = 31)

litecart/internal/queries/products.go:492:1 - DeleteDigital has complexity: 16
complexity = 1

  • 1 (found 'if' at line: 495, complexity = 2)
  • 1 (found 'switch' at line: 499, complexity = 3)
  • 1 (found 'case' at line: 500, complexity = 4)
    • 2 (found 'if' at line: 503, complexity = 6)
    • 2 (found 'if' at line: 507, complexity = 8)
    • 2 (found 'range' at line: 515, complexity = 10)
      • 3 (found 'if' at line: 516, complexity = 13)
  • 1 (found 'case' at line: 521, complexity = 14)
    • 2 (found 'if' at line: 522, complexity = 16)

litecart/internal/queries/setting.go:25:1 - Settings has complexity: 21
complexity = 1

  • 1 (found 'if' at line: 32, complexity = 2)
  • 1 (found 'if' at line: 42, complexity = 3)
  • 1 (found 'defer' at line: 45, complexity = 4)
  • 1 (found 'for' at line: 68, complexity = 5)
  • 1 (found 'for with lines >= 10' at line: 68, complexity = 6)
    • 2 (found 'if' at line: 71, complexity = 8)
    • 2 (found 'if' at line: 76, complexity = 10)
      • 3 (found 'branch' at line: 77, complexity = 13)
    • 2 (found 'type switch' at line: 80, complexity = 15)
    • 2 (found 'case' at line: 81, complexity = 16)
    • 2 (found 'case' at line: 83, complexity = 17)
      • 3 (found 'if' at line: 85, complexity = 20)
  • 1 (found 'if' at line: 92, complexity = 21)

litecart/internal/queries/setting.go:100:1 - UpdateSettings has complexity: 26
complexity = 1

  • 1 (found 'defer' at line: 102, complexity = 2)
  • 1 (found 'if' at line: 105, complexity = 3)
  • 1 (found 'defer' at line: 108, complexity = 4)
  • 1 (found 'defer with lines >= 5' at line: 108, complexity = 5)
    • 2 (found 'if' at line: 109, complexity = 7)
  • 1 (found 'logical operator' at line: 109, complexity = 8)
    • 2 (found 'else' at line: 111, complexity = 10)
  • 1 (found 'if' at line: 117, complexity = 11)
  • 1 (found 'defer' at line: 120, complexity = 12)
  • 1 (found 'switch' at line: 123, complexity = 13)
  • 1 (found 'case' at line: 124, complexity = 14)
  • 1 (found 'case' at line: 133, complexity = 15)
    • 2 (found 'if' at line: 135, complexity = 17)
    • 2 (found 'if' at line: 139, complexity = 19)
  • 1 (found 'case' at line: 147, complexity = 20)
  • 1 (found 'case' at line: 152, complexity = 21)
  • 1 (found 'case' at line: 160, complexity = 22)
  • 1 (found 'case' at line: 169, complexity = 23)
  • 1 (found 'range' at line: 173, complexity = 24)
    • 2 (found 'if' at line: 174, complexity = 26)

litecart/internal/queries/setting.go:306:1 - SettingStripe has complexity: 13
complexity = 1

  • 1 (found 'if' at line: 311, complexity = 2)
  • 1 (found 'defer' at line: 314, complexity = 3)
  • 1 (found 'for' at line: 316, complexity = 4)
  • 1 (found 'for with lines >= 10' at line: 316, complexity = 5)
    • 2 (found 'if' at line: 319, complexity = 7)
    • 2 (found 'switch' at line: 323, complexity = 9)
    • 2 (found 'case' at line: 324, complexity = 10)
    • 2 (found 'case' at line: 326, complexity = 11)
    • 2 (found 'case' at line: 328, complexity = 12)
  • 1 (found 'if' at line: 333, complexity = 13)

litecart/internal/queries/setting.go:341:1 - ListSocials has complexity: 19
complexity = 1

  • 1 (found 'if' at line: 348, complexity = 2)
  • 1 (found 'defer' at line: 351, complexity = 3)
  • 1 (found 'for' at line: 353, complexity = 4)
  • 1 (found 'for with lines >= 10' at line: 353, complexity = 5)
    • 2 (found 'if' at line: 356, complexity = 7)
    • 2 (found 'if' at line: 360, complexity = 9)
    • 2 (found 'if with lines >= 10' at line: 360, complexity = 10)
      • 3 (found 'switch' at line: 361, complexity = 13)
      • 3 (found 'case' at line: 362, complexity = 14)
      • 3 (found 'case' at line: 364, complexity = 15)
      • 3 (found 'case' at line: 366, complexity = 16)
      • 3 (found 'case' at line: 368, complexity = 17)
      • 3 (found 'case' at line: 370, complexity = 18)
  • 1 (found 'if' at line: 376, complexity = 19)

litecart/internal/queries/setting.go:384:1 - SettingMail has complexity: 18
complexity = 1

  • 1 (found 'if' at line: 390, complexity = 2)
  • 1 (found 'defer' at line: 393, complexity = 3)
  • 1 (found 'for' at line: 395, complexity = 4)
  • 1 (found 'for with lines >= 10' at line: 395, complexity = 5)
    • 2 (found 'if' at line: 398, complexity = 7)
    • 2 (found 'if' at line: 402, complexity = 9)
    • 2 (found 'if with lines >= 10' at line: 402, complexity = 10)
      • 3 (found 'switch' at line: 403, complexity = 13)
      • 3 (found 'case' at line: 404, complexity = 14)
      • 3 (found 'case' at line: 406, complexity = 15)
      • 3 (found 'case' at line: 409, complexity = 16)
      • 3 (found 'case' at line: 411, complexity = 17)
      • 3 (found 'case' at line: 413, complexity = 18)

litecart/pkg/archive/tar.go:63:1 - ExtractTar has complexity: 17
complexity = 1

  • 1 (found 'if' at line: 65, complexity = 2)
  • 1 (found 'defer' at line: 68, complexity = 3)
  • 1 (found 'if' at line: 71, complexity = 4)
  • 1 (found 'defer' at line: 74, complexity = 5)
  • 1 (found 'for' at line: 77, complexity = 6)
  • 1 (found 'for with lines >= 10' at line: 77, complexity = 7)
    • 2 (found 'if' at line: 79, complexity = 9)
      • 3 (found 'if' at line: 80, complexity = 12)
    • 2 (found 'if' at line: 85, complexity = 14)
      • 3 (found 'if' at line: 88, complexity = 17)

litecart/pkg/archive/zip.go:51:1 - ExtractZip has complexity: 16
complexity = 1

  • 1 (found 'if' at line: 53, complexity = 2)
  • 1 (found 'defer' at line: 56, complexity = 3)
  • 1 (found 'if' at line: 59, complexity = 4)
  • 1 (found 'if' at line: 63, complexity = 5)
  • 1 (found 'range' at line: 67, complexity = 6)
  • 1 (found 'range with lines >= 10' at line: 67, complexity = 7)
    • 2 (found 'if' at line: 68, complexity = 9)
      • 3 (found 'branch' at line: 69, complexity = 12)
    • 2 (found 'if' at line: 73, complexity = 14)
    • 2 (found 'if' at line: 78, complexity = 16)

litecart/pkg/update/update.go:28:1 - Init has complexity: 19
complexity = 1

  • 1 (found 'defer' at line: 36, complexity = 2)
  • 1 (found 'if' at line: 39, complexity = 3)
  • 1 (found 'defer' at line: 46, complexity = 4)
  • 1 (found 'if' at line: 48, complexity = 5)
  • 1 (found 'else' at line: 52, complexity = 6)
    • 2 (found 'if' at line: 53, complexity = 8)
    • 2 (found 'if' at line: 49, complexity = 10)
  • 1 (found 'if' at line: 61, complexity = 11)
  • 1 (found 'defer' at line: 65, complexity = 12)
  • 1 (found 'if' at line: 68, complexity = 13)
    • 2 (found 'if' at line: 70, complexity = 15)
  • 1 (found 'if' at line: 75, complexity = 16)
  • 1 (found 'if' at line: 80, complexity = 17)
    • 2 (found 'if' at line: 81, complexity = 19)

54 = files
177 = functions
74 = highest complexity
4.84 = overall average complexity per function

How to Reproduce

All the code with high numbers can hide bugs because of the complex structure. These can be candidates for refactoring.

Expected Behavior

Simple code, that's easy to maintain.

litecart Version

latest on github

Code Snippet (optional)

No response

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.

🤗 [Question]: stripe return parameter_invalid_empty

Question Description

Ver.0.1.3
stripe 400 Error

"description": "", is empty,but I had add the description
ITS WORK IN VER 0.1.2

Code Snippet (optional)

parameter_invalid_empty - line_items[0][price_data][product_data][description]
You passed an empty string for 'line_items[0][price_data][product_data][description]'. We assume empty values are an attempt to unset a parameter; however 'line_items[0][price_data][product_data][description]' cannot be unset. You should remove 'line_items[0][price_data][product_data][description]' from your request or supply a non-empty value.

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my questions prior to opening this one.
  • I understand that improperly formatted questions may be closed without explanation.

🤗 [Question]: building locally

Question Description

please can you add instructions for building locally
this will help those who wish to contribute to the project
I believe npm install yarn, yarn add vite and yarn build are at least required

Code Snippet (optional)

No response

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my questions prior to opening this one.
  • I understand that improperly formatted questions may be closed without explanation.

🚀 [Feature]: Request for support for Easy Pay

Feature Description

It's heavily used in China. Requesting support. Thank you.

Official website:https://pay.cccyun.cc/
development documentation:https://pay.ivmei.cn/doc.html

Additional Context (optional)

thanks

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my suggestion prior to opening this one.
  • I understand that improperly formatted feature requests may be closed without explanation.

🚀 [Feature]: auction style bidding

Feature Description

would be nice to have this with an auction based site.

Additional Context (optional)

No response

Code Snippet (optional)

package main

import "fmt"

func main() {
  fmt.Print("hello word")
}

Checklist:

  • I agree to follow litecart's Code of Conduct.
  • I have checked for existing issues that describe my suggestion prior to opening this one.
  • I understand that improperly formatted feature requests may be closed without explanation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.