How sharansrj567/vision-bank works
This repository implements a Go banking API. The main workflow starts at the service entry point, configures PostgreSQL-backed storage and HTTP routes, then handles user registration/login and authenticated account or transfer requests. Transfers validate both accounts before a single storage transaction records the transfer, entries, and balance changes. The graph includes the principal API, persistence, authentication, and utility layers. The README is empty, and unsampled SQL, migration, and configuration details are represented only where the tree or shown source supports them.
Main entry points: server.go HTTP server and routes · store.go Store and transfer transaction · user.go User registration and login · jwt_maker.go JWT token maker
Components 16
Service runtime
- Service entry
main.go
HTTP API
- HTTP server and routes
api/server.go - User registration and login
api/user.go - Account endpoints
api/account.go - Transfer endpoint
api/transfer.go - Request validation
api/validator.go
Persistence
- Store and transfer transaction
db/sqlc/store.go - SQL query operations
db/sqlc - PostgreSQL database
Identity and security
- Bearer authentication
api/middleware.go - JWT token maker
token/jwt_maker.go - Token payload
token/payload.go - Password hashing
util/password.go
Utilities
- Runtime config
util/config.go - Currency support
util/currency.go
Other components
- API client
Connections 25
- API client → HTTP server and routes: sends requests
api/server.go - Service entry → Runtime config: loads config
main.go - Service entry → Store and transfer transaction: creates store
main.go - Service entry → HTTP server and routes: starts server
main.go - HTTP server and routes → User registration and login: routes users
api/server.go - HTTP server and routes → Account endpoints: routes accounts
api/server.go - HTTP server and routes → Transfer endpoint: routes transfers
api/server.go - HTTP server and routes → Bearer authentication: protects routes
api/server.go - HTTP server and routes → JWT token maker: creates maker
api/server.go - HTTP server and routes → Runtime config: uses settings
api/server.go - HTTP server and routes → Store and transfer transaction: receives store
api/server.go - User registration and login → Store and transfer transaction: reads and writes users
api/user.go - User registration and login → Password hashing: hashes and checks
api/user.go - User registration and login → JWT token maker: creates access token
api/user.go - Account endpoints → Store and transfer transaction: reads and writes accounts
api/account.go - Account endpoints → Currency support: validates currency
- Transfer endpoint → Store and transfer transaction: checks and transfers
api/transfer.go - Transfer endpoint → Currency support: validates currency
- Bearer authentication → JWT token maker: verifies token
api/middleware.go - JWT token maker → Token payload: creates and parses
token/jwt_maker.go - Store and transfer transaction → SQL query operations: executes queries
db/sqlc/store.go - SQL query operations → PostgreSQL database: runs SQL
db/sqlc/accounts.sql.go - Store and transfer transaction → PostgreSQL database: opens transactions
db/sqlc/store.go - HTTP server and routes → Request validation: registers currency rule
api/server.go - Request validation → Currency support: checks support
api/validator.go