commit 810a49aa4ef6e6b21cb88a6da0e8693e22cf5ae0 Author: Ruidy Date: Sat Sep 27 01:47:19 2025 +0200 chore: init repo diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..d0a72ab --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,33 @@ +# Repository Guidelines + +PayIt is a Go-based Stripe integration demo. Use this guide to deliver focused contributions that keep the service reliable and secure. + +## Project Structure & Module Organization + +- `go.mod` defines the module `github.com/rjNemo/payit` and anchors dependencies; update it alongside any new package additions. +- Keep the HTTP server entry point in `cmd/payit/main.go`; additional CLIs belong under `cmd/`. +- Place shared business logic under `internal/payments`, with Stripe client helpers in `internal/stripe`; keep packages small and unexported when possible. +- Organize web handlers, templates, and static assets under `internal/web`, `web/templates`, and `web/static`. Store sample data or fixtures beside the owning package under `testdata/`. + +## Build, Test, and Development Commands + +- `go run ./cmd/payit` — start the local server, loading configuration from `.env.local` when present. +- `go build ./...` — ensure every package compiles prior to opening a PR. +- `go test ./...` — execute the full unit suite; add `-run TestStripe` to focus on Stripe-specific tests during iteration. +- `STRIPE_SECRET_KEY=sk_test... go test ./internal/payments -v` — example of running package tests that require live credentials. + +## Coding Style & Naming Conventions + +Run `go fmt ./...` and `goimports` before committing; code should pass Go 1.25 formatting without manual tweaks. Name handlers `Handler`, Stripe service wrappers `Service`, and environment variables `PAYIT_*`. Centralize configuration defaults under `config/config.go` and prefer composition over inheritance-style embedding. + +## Testing Guidelines + +Write table-driven tests named `Test_`. Co-locate doubles in `_test.go` files and keep external fixtures under `testdata/`. Target >80% coverage on payment flows, and gate integration suites behind the `-short` flag so CI can skip live Stripe runs when credentials are absent. + +## Commit & Pull Request Guidelines + +Use imperative, present-tense commits such as `feat: add checkout handler`; include a short body that explains why. Reference issues with `Refs #123` and note config or schema changes. PRs should summarize the change, attach manual test notes, and include screenshots or API logs when behavior shifts. Always wait for tests to pass before requesting merge. + +## Security & Configuration Tips + +Never commit Stripe secrets; store them in `.env.local` and rely on your process manager to inject them. Rotate exposed keys immediately. Redact cardholder data in logs and avoid persisting PII outside Stripe’s systems. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a33fb6a --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# PayIt + +Demo application to showcase Stripe integration + +## Features + +- One-time payments +- Subscription management diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..e491377 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/rjNemo/payit + +go 1.25.1