"The only way to make sense out of change is to plunge into it, move with it, and join the dance." - Alan Watts
Welcome to GoBank - where your money is safer than a squirrel's nuts in winter! 🐿️ This is my personal playground for mastering Go backend development, because let's face it, someone's gotta keep those zeros and ones in line.
GoBank is my humble attempt at building a banking system in Go - think of it as a digital piggy bank, but with more code and fewer coins rattling around. The main goal? To get cozy with the Fiber framework and prove that Go can handle financial shenanigans better than my actual bank handles my overdraft fees! 💸
"Code is like humor. When you have to explain it, it's bad." - Cory House
- Go 1.24.2 - Because life's too short for slow languages
- Fiber Framework - Fast, Express-inspired web framework (coming soon to a codebase near you!)
- PostgreSQL - Where your data lives rent-free
- Docker - Containerization magic ✨
- SQLC - Type-safe SQL generation
- golang-migrate - Database migration wizardry
// The usual suspects
github.com/google/uuid v1.6.0 // For unique IDs (like snowflakes, but digital)
github.com/jackc/pgx/v5 v5.7.5 // PostgreSQL driver that actually works
github.com/joho/godotenv v1.5.1 // Because hardcoding secrets is for amateurs
github.com/stretchr/testify v1.10.0 // Testing made bearableNote: Fiber framework will join the party once I stop procrastinating and actually install it! 🎉
Make sure you have these installed, or this journey ends before it begins:
- Go 1.24.2+ - Download here
- Docker & Docker Compose - Get Docker
- golang-migrate - Install with:
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
-
Clone this masterpiece:
git clone https://github.com/fr13nd230/gobank.git cd gobank -
Set up your environment:
cp .env.example .env # Edit .env with your database credentials (no, 'password123' is not secure) -
Fire up the containers:
make cmp-up
-
Run migrations:
make migrate-up
-
Start the server:
make run
"It's not a bug, it's a feature!" - Every developer ever
Our Makefile is like a Swiss Army knife, but for code:
| Command | Description | Fun Factor |
|---|---|---|
make build |
Build the application | 🔨 Hammer time! |
make test |
Run tests with coverage | 🧪 Science! |
make run |
Start the server | 🚀 Blast off! |
make cmp-up |
Start Docker containers | 🐳 Wake the whale! |
make cmp-down |
Stop Docker containers | 😴 Nap time! |
make createdb |
Create database | 🗄️ Birth of data |
make dropdb |
Drop database | 💥 Digital demolition |
make connectdb |
Connect to database | 🔌 Phone home |
make migrate-up |
Run migrations up | ⬆️ Leveling up |
make migrate-down |
Run migrations down | ⬇️ Going backward |
make fixdirty |
Fix dirty migrations | 🧹 Spring cleaning |
make gensqlc |
Generate SQLC code | 🎭 Code magic |
Contributing to GoBank is easier than explaining why you need another banking app:
feature/awesome-new-thing- For new features that'll blow mindsfix/that-annoying-bug- For squashing bugs like a proconfig/environment-setup- For configuration changestest/unit-coverage- For test improvements
Follow this pattern or face the wrath of inconsistent git history:
GB | purpose(scope): Your brilliant message here
Examples:
GB | feat(auth): Add user authentication with JWT tokens
GB | fix(database): Resolve connection pool leak issue
GB | test(unit): Creating unit tests for account service
GB | config(docker): Update PostgreSQL version in compose file
- Always open a Pull Request - No direct pushes to main (we're civilized here)
- Unit Tests are MANDATORY - If it's not tested, it doesn't exist
- Minimum 90% test coverage - Because 89% is for quitters
- Code reviews are your friend - Two pairs of eyes are better than one
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler
We take testing seriously here (unlike my diet):
make testThis will run all tests with coverage reporting. If you're not hitting 90% coverage, you're not trying hard enough! 📈
Because "it works on my machine" is not a valid deployment strategy:
- Development:
make cmp-up - Cleanup:
make cmp-down
PostgreSQL is our database of choice because:
- It's reliable (unlike my sleep schedule)
- It handles complex queries (unlike my brain on Monday mornings)
- It's open source (like my admiration for good code)
This project is licensed under the MIT License - because sharing is caring, and lawyers are expensive.
"The best time to plant a tree was 20 years ago. The second best time is now." - Chinese Proverb
The same goes for learning Go - start now, thank yourself later!
Built with ❤️ and probably too much coffee by fr13nd230
Remember: In code we trust, but we test everything else! 🚀