A Go Fiber-based microservice to manage accounts and transactions, using SQLite and Viper for configuration.
This project uses Go 1.24 and builds using a multi-stage Alpine Linux-based Docker image (
golang:1.24.2-alpine).
The runtime container is based onalpine:latest.
go mod tidy
go run main.goUpdate config.yaml:
server:
port: "8080"
database:
path: "./pulseledger.db"
reset_on_start: true./runMake sure
.envis present with:
SERVER_PORT=8080
DATABASE_PATH=./pulseledger.db
DATABASE_RESET_ON_START=truego test ./...curl -X POST http://localhost:8080/api/v1/accounts \
-H "Content-Type: application/json" \
-d '{"document_number": 1234567890}'Invalid example:
curl -X POST http://localhost:8080/api/v1/accounts \
-H "Content-Type: application/json" \
-d '{}'curl -X POST http://localhost:8080/api/v1/transactions \
-H "Content-Type: application/json" \
-d '{
"account_id": 1,
"operation_type_id": 1,
"amount": 100.50
}'curl http://localhost:8080/api/v1/accounts/1Replace
1with the actual account ID you want to retrieve.
pulseledger/
├── config/ # Configuration loader (Viper)
├── db/ # DB init and migrations
├── handlers/ # HTTP handlers
├── repositories/ # DB layer
├── services/ # Business logic
├── dto/ # Request/response types
├── main.go # Entry point