
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
stakefy-usage-envelope
Advanced tools
Drop-in usage-based budget enforcement layer for enterprises. Plugs into Stripe for top-ups, Postgres for reporting, and x402 for capital-layer budget enforcement.
Drop-in usage-based budget enforcement layer for enterprises. Plugs into Stripe for top-ups, Postgres for reporting, and x402 for capital-layer budget enforcement.
Envelopes are usage budgets with time windows (hourly/daily/weekly/monthly/annual). Users stake capital via Stripe, which tops up their x402 envelope. Each usage request drains from the envelope atomically - if x402 drain fails, usage is blocked.
# Clone and install
cd stakefy-usage-envelope
npm install
# Start Postgres
docker compose up -d postgres
# Configure environment
cp .env.example .env
# Edit .env with your keys
# Run migrations
npm run prisma:migrate
# Start dev server
npm run dev
Server runs on http://localhost:3000
# Health check
curl http://localhost:3000/health
# Run full test suite
./test-api.sh
# Build and start everything
docker compose up -d
# Check health
curl http://localhost:3000/health
# View logs
docker compose logs -f api
# Stop
docker compose down
POST /envelopes - Create envelope
curl -X POST http://localhost:3000/envelopes \
-H "Content-Type: application/json" \
-d '{
"name": "Production API Budget",
"timeWindow": "MONTHLY",
"capacity": 1000,
"currency": "USD",
"ownerAccountId": "acct_123"
}'
POST /envelopes/:id/authorize - Authorize identity
curl -X POST http://localhost:3000/envelopes/{ENVELOPE_ID}/authorize \
-H "Content-Type: application/json" \
-d '{
"type": "API_KEY",
"value": "sk_prod_xyz"
}'
GET /envelopes/:id/status - Check remaining capacity
curl http://localhost:3000/envelopes/{ENVELOPE_ID}/status
POST /usage - Drain from envelope (atomic)
curl -X POST http://localhost:3000/usage \
-H "Content-Type: application/json" \
-d '{
"amount": 10,
"identity": "sk_prod_xyz",
"identityType": "API_KEY",
"metadata": {
"requestId": "req_abc",
"endpoint": "/api/v1/query"
}
}'
POST /stripe/topup - Create payment intent
curl -X POST http://localhost:3000/stripe/topup \
-H "Content-Type: application/json" \
-d '{
"envelopeId": "{ENVELOPE_ID}",
"amount": 500
}'
POST /stripe/webhook - Stripe webhook handler
https://your-domain.com/stripe/webhookpayment_intent.succeeded, payment_intent.payment_failed# Server
PORT=3000
NODE_ENV=development
# Database
DATABASE_URL="postgresql://user:pass@localhost:5432/stakefy_usage"
# Stripe
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
# x402
X402_API_KEY=your_api_key
X402_ENV=sandbox # or prod
# Security
APP_SIGNING_SECRET=random_secret_min_32_chars
# Logging
LOG_LEVEL=info # debug|info|warn|error
/usage with identity + amountx402Service.drain(envelopeId, amount)
# Development
npm run dev # Start with hot reload
npm run build # Compile TypeScript
npm start # Run production build
# Database
npm run prisma:generate # Generate Prisma Client
npm run prisma:migrate # Run migrations
npm run prisma:studio # Open Prisma Studio GUI
# Testing
./test-api.sh # Run integration tests
# Build image
docker build -t stakefy-usage-envelope:latest .
# Run with env file
docker run -d \
--name stakefy-api \
-p 3000:3000 \
--env-file .env.production \
stakefy-usage-envelope:latest
# Run migrations in production
docker exec stakefy-api npx prisma migrate deploy
APP_SIGNING_SECRET regularly/usage endpoint (see Step 10)"x402 client not initialized"
X402_API_KEY in .env"Connection refused" to Postgres
docker compose up -d postgresDATABASE_URL in .envStripe webhook fails
STRIPE_WEBHOOK_SECRET matches Stripe Dashboardstripe listen --forward-to localhost:3000/stripe/webhookMIT
Built by Stakefy - Web3 Payment Infrastructure
FAQs
Drop-in usage-based budget enforcement layer for enterprises. Plugs into Stripe for top-ups, Postgres for reporting, and x402 for capital-layer budget enforcement.
We found that stakefy-usage-envelope demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.