mirror of
https://github.com/blackboxprogramming/alexa-amundson-resume.git
synced 2026-03-18 00:04:00 -05:00
claude/merge-stripe-integration-Fj5h0
Replace documentation-only repo with working code: - Stripe integration: webhook handler (8 event types), billing API (customers, checkout, payments, subscriptions, invoices) - Express API server with health endpoint, structured logging - E2E tests (Playwright): health, webhook signature verification, billing API validation - Unit tests: webhook event handler coverage for all event types - Pi deployment: deploy.sh (rsync + systemd), NGINX load balancer across Pi cluster, Docker support - CI/CD: test workflow, Pi deploy workflow, updated auto-deploy and self-healing to run real tests before deploying - Move resume docs to docs/ to separate code from documentation https://claude.ai/code/session_01Mf5Pg82fV6BTRS9GnpV7nr
BlackRoad OS — Stripe Integration Service
Production Stripe integration with billing, webhooks, e2e tests, and Raspberry Pi deployment.
Architecture
src/
├── server.js # Express server entry point
├── config/
│ ├── index.js # Environment config
│ └── logger.js # Structured logging (pino)
├── api/
│ └── routes.js # API routes (health, billing, webhooks)
└── stripe/
├── client.js # Stripe client singleton
├── billing.js # Customer, checkout, payments, subscriptions
└── webhooks.js # Webhook verification + event handlers
tests/
├── unit/
│ └── webhooks.test.js # Webhook handler unit tests
└── e2e/
├── health.spec.js # Health endpoint e2e
├── billing-api.spec.js # Billing API e2e
└── stripe-webhook.spec.js # Webhook e2e
deploy/pi/
├── deploy.sh # Deploy to Pi nodes via SSH
└── setup-nginx.sh # NGINX load balancer for Pi cluster
Quick Start
# Install dependencies
npm install
# Copy env template and fill in your Stripe keys
cp .env.example .env
# Run server
npm start
# Run in dev mode (auto-reload)
npm run dev
API Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/health |
Health check |
| POST | /api/webhooks/stripe |
Stripe webhook receiver |
| POST | /api/customers |
Create Stripe customer |
| POST | /api/checkout |
Create checkout session |
| POST | /api/payments |
Create payment intent |
| GET | /api/customers/:id/invoices |
List customer invoices |
| GET | /api/subscriptions/:id |
Get subscription |
| DELETE | /api/subscriptions/:id |
Cancel subscription |
Stripe Webhooks
Handled events:
checkout.session.completed— Fulfill ordersinvoice.paid/invoice.payment_failed— Track paymentscustomer.subscription.created/updated/deleted— Manage subscriptionspayment_intent.succeeded/payment_failed— Payment lifecycle
To test locally:
# Forward Stripe events to local server
npm run stripe:listen
Testing
# Unit tests
npm test
# E2E tests (starts server automatically)
npm run test:e2e
# All tests
npm run test:all
Deploy to Raspberry Pi
- Set
PI_HOST_1,PI_HOST_2,PI_HOST_3in.env - Ensure SSH key access to each Pi
- Run:
npm run deploy:pi
This will:
- rsync code to each Pi
- Install Node.js if missing
- Install production dependencies
- Create/restart systemd service (
blackroad-stripe) - Run health checks
For load balancing across Pis:
bash deploy/pi/setup-nginx.sh
Docker
docker build -t blackroad-stripe .
docker run -p 3000:3000 --env-file .env blackroad-stripe
CI/CD
- test.yml — Runs unit + e2e tests on every push/PR
- auto-deploy.yml — Deploys to Railway/Cloudflare on main push
- deploy-pi.yml — Deploys to Pi nodes (manual trigger or on main push)
- self-healing.yml — Health monitoring every 30 min, auto-rollback
- security-scan.yml — CodeQL + dependency audit
Resume Docs
Career portfolio documents are in docs/.
Contact: amundsonalexa@gmail.com | (507) 828-0842 GitHub: @blackboxprogramming
Description
Languages
JavaScript
99.8%
Dockerfile
0.2%