Minibank is a multi-toolchain repository:
- The main application is written in Go under
cmd/,domain/,infra/, andlogger/ - MongoDB migrations live under
migration/and use Node/CommonJS - Data seeding lives under
seeder/and uses Python
The current Go entrypoint in cmd/main.go only loads env vars, connects to MongoDB, logs the selected database name, and exits.
- Docker or Docker Compose
- Nix with flakes if you want to use the dev shell
Or install the toolchains manually:
- Go
- Node.js
- Python 3
Create a .env file at the repository root:
MONGO_URL=mongodb://localhost:27017
MONGO_DB_NAME=minibankThis .env file is shared by the Go app, migrations, and seeder.
Note: cmd/main.go currently hardcodes client.Database("minibank"), so changing MONGO_DB_NAME alone does not fully retarget the Go app.
Enter the development shell with:
nix developflake.nix currently provides tooling only:
- Go toolchain
- Node.js
- Python 3
- Python LSP packages
Python runtime dependencies for the seeder are intentionally not bundled into the flake. Install them from seeder/requirements.txt.
From the repository root:
docker compose up -d mongoMongoDB will be available on localhost:27017.
From the repository root:
go run ./cmdVerified commands:
go test ./...
go build ./...Do not use go build ./cmd here. In this repository, cmd/ is a directory name, so the correct verification commands are go build ./... or go run ./cmd.
Run the seeder from the seeder/ directory because the code calls load_dotenv("../.env"):
cd seeder
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python seeder.pyThe current seeder will:
- insert
branchs - insert
customers - embed
accountsinside each customer document - insert
loans
The schema is not fully aligned yet between the Go structs and the seeded documents. For example:
domain.Customerusesdob, while the seeder writesbirthdatedomain.Accountexpectscustomer_id, while seeded accounts are nested inside customers
Run migration tooling from the migration/ directory because the config resolves ../.env from there.
cd migration
npm installImportant notes:
migration/package.jsondoes not currently declaremigrate-mongo- There are no ready-to-use migration scripts in
package.json - If you want to use
migrate-mongo, you need to install that tooling yourself
The config file is migration/migrate-mongo-config.js.
.
|- cmd/
|- domain/
|- infra/
|- logger/
|- migration/
|- seeder/
|- docker-compose.yml
|- flake.nix