Bitcoin Payment Gateway for Small Businesses - The Stripe of Bitcoin
This monorepo uses:
- pnpm workspaces for dependency management
- Turborepo for build orchestration and caching
- Bit for component management and sharing
- TypeScript across all packages
- Next.js for React applications
- Tailwind CSS for styling
stackspay/
βββ apps/
β βββ backend/ # Node.js/Express API server
β βββ dashboard/ # Merchant dashboard (Next.js)
β βββ docs/ # Documentation site (Nextra)
βββ packages/
β βββ ui/ # Shared UI components (Bit managed)
β βββ utils/ # Utility functions
β βββ sdk/ # JavaScript/TypeScript SDK
β βββ widget/ # Payment widget
βββ smartcontracts/ # Stacks smart contracts
βββ package.json # Root workspace configuration
- Node.js 18+
- pnpm 8+
# Install all dependencies and link packages
pnpm install# Run all apps in parallel
pnpm dev
# Run specific app
pnpm --filter @stackspay/dashboard dev
pnpm --filter @stackspay/backend dev
pnpm --filter @stackspay/docs dev
# Build all packages
pnpm build
# Run tests
pnpm test
# Lint all packages
pnpm lintimport { Button, Card, Input } from "@stackspay/ui";
import { cn } from "@stackspay/utils";
function MyComponent() {
return (
<Card>
<Button className={cn("w-full")}>
Pay with Bitcoin
</Button>
</Card>
);
}import { formatBTC, formatCurrency } from "@stackspay/utils";
const btcAmount = formatBTC(0.001); // "0.00100000 BTC"
const usdAmount = formatCurrency(100); // "$100.00"import { StacksPaySDK } from "@stackspay/sdk";
const sdk = new StacksPaySDK("your-api-key");
const payment = await sdk.createPayment({
amount: 100000, // satoshis
currency: "BTC",
description: "Coffee purchase"
});import { PaymentWidget } from "@stackspay/widget";
function CheckoutPage() {
return (
<PaymentWidget
apiKey="your-api-key"
amount={100000} // satoshis
description="Coffee purchase"
onPaymentSuccess={(paymentId) => {
console.log("Payment successful:", paymentId);
}}
/>
);
}# Start Bit development server
pnpm bit:start# Track a new component
bit add packages/ui/src/button.tsx
# Tag components with a version
bit tag
# Export components to remote scope
bit export
# Install components
bit install- Create components in
packages/ui/src/ - Use
bit addto track them - Use
bit tagto version them - Use
bit exportto share them
# Run tasks in dependency order
turbo run build
# Run tasks in parallel
turbo run dev --parallel
# Run tasks for specific packages
turbo run build --filter=@stackspay/ui
# Run tasks excluding packages
turbo run build --filter=!@stackspay/contractspnpm dev- Run all apps in development modepnpm build- Build all packages and appspnpm test- Run tests for all packagespnpm lint- Lint all packagespnpm type-check- Type check all packagespnpm clean- Clean build artifactspnpm format- Format code with Prettier
pnpm bit:start- Start Bit development serverpnpm bit:compile- Compile Bit componentspnpm bit:export- Export components to remote scopepnpm bit:build- Build Bit componentspnpm bit:tag- Tag components with versionpnpm bit:install- Install Bit components
- Start development:
pnpm dev - Make changes to packages or apps
- Test changes with
pnpm test - Lint code with
pnpm lint - Build with
pnpm build - Commit changes
Shared React components built with Tailwind CSS and shadcn/ui patterns.
Utility functions for formatting, validation, and common operations.
TypeScript SDK for integrating with StackPay API.
React payment widget for easy integration into websites.
Node.js/Express API server for payment processing.
Next.js merchant dashboard for managing payments and settings.
Documentation site built with Nextra.
Stacks smart contracts for payment processing.
All packages can import from each other using the @stackspay/ scope:
// In any package/app
import { Button } from "@stackspay/ui";
import { formatBTC } from "@stackspay/utils";
import { StacksPaySDK } from "@stackspay/sdk";
import { PaymentWidget } from "@stackspay/widget";pnpm-workspace.yaml- pnpm workspace configurationturbo.json- Turborepo build pipelinetsconfig.base.json- Shared TypeScript configurationworkspace.jsonc- Bit workspace configuration.npmrc- pnpm configuration
MIT
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request