Skip to content

datkanber/go-stripe-payment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Stripe Project

Installations

go get github.com/go-chi/cors
go get -u github.com/stripe/stripe-go/v72
go get github.com/joho/godotenv
go install github.com/air-verse/air@latest
go get github.com/go-chi/chi/v5
go mod init myapp

Windows Setup

choco install mariadb
Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = `
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Extensions

  • Go
  • Go Template Support
  • gotemplate-syntax
  • Makefile Tools
choco install make
make start_back

Makefile Overview

SHELL=cmd
STRIPE_SECRET=
STRIPE_KEY=
GOSTRIPE_PORT=4000
API_PORT=4001
DSN="root@(localhost:3306)/widgets?parseTime=true&tls=false"

build: clean build_front build_back
	@echo All binaries built!

clean:
	@echo Cleaning...
	@echo y | DEL /S dist
	@go clean
	@echo Cleaned and deleted binaries

build_front:
	@echo Building front end...
	@go build -o dist/gostripe.exe ./cmd/web
	@echo Front end built!

build_back:
	@echo Building back end...
	@go build -o dist/gostripe_api.exe ./cmd/api
	@echo Back end built!

start: start_front start_back

start_front: build_front
	@echo Starting the front end...
	@set STRIPE_KEY=$(STRIPE_KEY) && set STRIPE_SECRET=$(STRIPE_SECRET) && start /B .\dist\gostripe.exe -dsn=$(DSN)
	@echo Front end running!

start_back: build_back
	@echo Starting the back end...
	@set STRIPE_KEY=$(STRIPE_KEY) && set STRIPE_SECRET=$(STRIPE_SECRET) && start /B .\dist\gostripe_api.exe -env=development -port=$(API_PORT)
	@echo Back end running!

stop: stop_front stop_back
	@echo All applications stopped

stop_front:
	@echo Stopping the front end...
	@taskkill /IM gostripe.exe /F
	@echo Stopped front end

stop_back:
	@echo Stopping the back end...
	@taskkill /F /IM gostripe_api.exe 2>NUL || echo Back end process not found.
	@echo Stopped back end

Makefile Usage Example

make stop
make start_back
Building back end...
Back end built!
Starting the back end...
INFO    2025/03/31 12:58:37 Starting Back end server in %s mode on port %d development 4001
Back end running!

Air Live Reload

air
__    _   ___  
/ /\  | | | |_) 
/_/--\ |_| |_| \_ v1.61.7, built with Go go1.24.1

mkdir C:\Users\Administrator\Desktop\goapp\tmp
watching .
watching cmd
watching cmd\api
watching cmd\web
watching cmd\web\templates
watching dist
watching internal
watching internal\cards
!exclude tmp
building...
running...
INFO    2025/03/31 12:59:34 Starting HTTP server in %s mode on port %d development 4000

About

backend architecture

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published