Banking Industry Architecture Network interfaces for Go
A Go library providing BIAN-compliant banking interfaces with dual API layer (REST + GraphQL). Built for developers creating fintech applications with open banking integration.
Repository: github.com/serverlesscloud/bian-go
- π Cloud-portable - Deploy anywhere (Docker, Kubernetes, serverless)
- π Provider-agnostic - Swap between CDR, Plaid, Open Banking implementations
- π Dual API - Both REST and GraphQL on single server
- π Type-safe - Compile-time guarantees with Go's type system
- π° Decimal precision - No floating-point errors in financial calculations
- π¦ BIAN v13.0.0 aligned - Standardized banking operations
- π§ͺ Mock provider - Development without external dependencies
- βοΈ Zero dependencies - REST API uses only Go standard library
go get github.com/serverlesscloud/bian-goimport (
"github.com/serverlesscloud/bian-go/providers/mock"
"github.com/serverlesscloud/bian-go/server"
)
provider := mock.NewProvider()
config := server.DefaultConfig()
srv := server.NewServer(provider, provider, provider, provider, config)
srv.Start() // Starts both REST and GraphQL APIsServer URLs:
- REST API: http://localhost:8080/
- GraphQL API: http://localhost:8080/graphql
- GraphQL Playground: http://localhost:8080/playground
- Health Check: http://localhost:8080/health
See examples/ directory for complete working implementations.
API Layer (REST + GraphQL)
β
Domain Layer (BIAN Interfaces)
β
Provider Layer (CDR/Plaid/Open Banking)
Key principle: Business logic lives in domain layer, transport is swappable.
Both REST and GraphQL APIs call domain interfaces directly (parallel implementations):
- Zero coupling between REST and GraphQL
- No performance overhead (both call domain directly)
- Independent evolution of each API
| Region | Standard | Provider Package | Status |
|---|---|---|---|
| π¦πΊ Australia | Consumer Data Right (CDR) | providers/cdr |
Planned |
| πΊπΈ π¨π¦ US/Canada | Plaid | providers/plaid |
Planned |
| π¬π§ UK | Open Banking | providers/obuk |
Planned |
| πͺπΊ EU | PSD2 | providers/psd2 |
Planned |
| π§ͺ Testing | Mock | providers/mock |
Available |
bian-go/
βββ domains/ # BIAN service interfaces
β βββ accounts.go
β βββ transactions.go
β βββ consents.go
β βββ balance.go
β
βββ models/ # Canonical data types
β βββ account.go
β βββ transaction.go
β βββ money.go
β βββ enums.go
β
βββ rest/ # REST API layer
β βββ handlers.go
β βββ middleware.go
β βββ server.go
β
βββ graphql/ # GraphQL API layer
β βββ schema.graphql
β βββ resolver.go
β βββ server.go
β βββ generated/ # gqlgen output
β
βββ providers/ # Banking implementations
β βββ mock/ # Testing provider
β
βββ server/ # Unified server
βββ examples/ # Working examples
See domains/ for complete interface definitions. Key patterns:
- AccountService - Account lifecycle and balance queries (BIAN Current Account Fulfillment)
- TransactionService - Payment execution and transaction history (BIAN Payment Execution)
- BalanceService - Balance information (BIAN Account Balance Management)
- ConsentService - OAuth consent management (BIAN Customer Consent Management)
All interfaces accept context.Context as first parameter for cancellation/timeouts.
Base URL: http://localhost:8080/
# Get account details
GET /accounts/{id}
# Get current balance
GET /accounts/{id}/balance
# Get all balance types
GET /accounts/{id}/balances
# Get transaction history
GET /accounts/{id}/transactions?fromDate=2024-01-01&limit=10# Get transaction details
GET /transactions/{id}# Get consent details
GET /consents/{id}
# Get consent status
GET /consents/{id}/statusEndpoint: http://localhost:8080/graphql
Playground: http://localhost:8080/playground
# Get account with balance
query {
account(id: "acc-001") {
id
accountNumber
accountType
productName
status
}
balance(accountId: "acc-001") {
balanceType
amount {
amount
currency
}
}
}
# Get transaction history
query {
transactions(accountId: "acc-001", input: {
limit: 10
fromDate: "2024-01-01"
}) {
id
transactionType
amount {
amount
currency
}
description
postingDate
}
}Configuration via gqlgen.yml. Run go generate ./... to regenerate after schema changes.
Implement domain interfaces to create new providers:
type MyProvider struct {
client *BankingAPIClient
}
func (p *MyProvider) RetrieveCurrentAccount(ctx context.Context, id string) (*models.Account, error) {
// 1. Call external banking API
// 2. Normalize to BIAN canonical model
// 3. Return standardized Account
}See providers/mock/ for reference implementation.
Precise decimal arithmetic for financial calculations:
// Create money amounts
aud, _ := models.NewMoney(decimal.NewFromFloat(123.45), "AUD")
usd, _ := models.NewMoney(decimal.NewFromFloat(100.00), "USD")
// Arithmetic operations
sum, _ := aud.Add(otherAUD)
product := aud.Multiply(decimal.NewFromFloat(1.5))
// Comparisons
equal := aud.Equal(otherAUD)
greater, _ := aud.GreaterThan(otherAUD)
// JSON serialization (string format for precision)
// {"amount": "123.45", "currency": "AUD"}Supported Currencies: AUD, USD, GBP, EUR, CAD, JPY, CHF, CNY, SEK, NZD
Includes realistic sample data for development:
acc-001: Checking Account (AUD $2,547.83)acc-002: Savings Account (AUD $15,420.50)acc-003: Credit Card (USD -$1,250.75)
- 11 transactions across accounts
- Various types: debit, credit, transfer, payment, fee
- Realistic merchants: Woolworths, Energy Australia, Amazon
consent-001: Active (account:read, transaction:read, balance:read)consent-002: Expiredconsent-003: Revoked
# Install dependencies
go mod download
# Generate GraphQL code
go generate ./...
# Run tests
go test ./...
# Run example server
cd examples/basic && go run main.go
# Build Docker image
docker build -t bian-go .
# Run in Docker
docker run -p 8080:8080 bian-goPORT: Server port (default: 8080)ENABLE_PLAYGROUND: Enable GraphQL Playground (default: true)
Automated workflow syncs with BIAN releases:
- Weekly checks for new Service Landscape versions
- Auto-generates PRs with updated OpenAPI specs
- Validates breaking changes
See .github/workflows/bian-sync.yml
See CONTRIBUTING.md
Key areas for contribution:
- New provider implementations (regional banking standards)
- Performance optimizations
- Documentation improvements
- Test coverage expansion
- Amazon Q Developer - 3 Musketeers build system implementation, DevOps automation
Apache License 2.0 - See LICENSE
Patent protection, corporate-friendly, permissive for commercial use.