A Go-based microservice that imports a spreadsheet of bank SWIFT (BIC) codes into SQLite and exposes four RESTful endpoints for querying, adding, and removing codes.
- Prerequisites
- Installation & Setup
- Running the Application
- API Endpoints
- Running Tests
- Note to Remitly Team
- Go ≥ 1.22 installed and in your
PATH - SQLite CLI (optional, for manual DB inspection)
- Git (to clone the repository)
- curl or Postman or a browser (to exercise the API)
Follow these steps to prepare your environment and get the project running:
-
Install Go (if not already installed)
- Download and install Go 1.22 or later from the official site: https://golang.org/dl/
- Verify the installation:
You should see output like
go version
go version go1.24.2 darwin/arm64.
-
Verify Git is installed (if not)
git --version
-
Clone the repository
git clone https://github.com/egemengunel/go-swift-codes.git
-
Install project dependencies
go mod download
-
The spreadsheet file is already present in the root
The
data/SWIFT_CODES.xlsxexcel data file already exists in the project root. So do not add the excel file to the project root again.
On first run, the app will:
- Create (or open)
swift_codes.dbin the project root - Create the
swift_codestable if missing - Parse and import all rows from
data/SWIFT_CODES.xlsx
Start the server:
go run main.goYou should see:
Server is starting on :8080...
The API is now listening on http://localhost:8080.
All requests and responses use JSON.
Request
GET http://localhost:8080/v1/swift-codes/{swiftCode}
Response
- 200 OK with JSON either:
- Head-office with nested
branchesarray - Branch (no
branchesfield)
- Head-office with nested
Example (Head-office)
{
"address": "23 BOULEVARD PRINCESSE CHARLOTTE …",
"bankName": "CREDIT AGRICOLE MONACO …",
"countryISO2": "MC",
"countryName": "MONACO",
"isHeadquarter": true,
"swiftCode": "AGRIMCM1XXX",
"branches": [
{
"address": "…",
"bankName": "…",
"countryISO2": "MC",
"countryName": "MONACO",
"isHeadquarter": false,
"swiftCode": "AGRIMCM1…"
}
]
}Request
GET http://localhost:8080/v1/swift-codes/country/{ISO2}
Response
- 200 OK
Example
{
"countryISO2": "PL",
"countryName": "POLAND",
"swiftCodes": [
{
"address": "…",
"bankName": "…",
"countryISO2": "PL",
"countryName": "POLAND",
"isHeadquarter": true,
"swiftCode": "ALBPPLPWXXX"
},
{
"address": "…",
"bankName": "…",
"countryISO2": "PL",
"countryName": "POLAND",
"isHeadquarter": false,
"swiftCode": "ALBPPLPWCUS"
}
]
}Request
POST http://localhost:8080/v1/swift-codes
Content-Type: application/json
Body
{
"address": "123 TEST AVENUE",
"bankName": "MY TEST BANK",
"countryISO2": "ZZ",
"countryName": "ZELAND",
"isHeadquarter": false,
"swiftCode": "ZZTESTBANKXXX"
}Response
- 201 Created
{ "message": "swift code created" }Request
DELETE http://localhost:8080/v1/swift-codes/{swiftCode}
Response
- 200 OK
{ "message": "swift code deleted" }Two test suites cover core logic:
- Service (repository) tests
go test ./service - Handler tests
go test ./handler
Or run all at once:
go test ./...Thank you for reviewing my submission! A few personal notes:
- I am primarily an iOS/Swift developer and this was my first time working with Go.
- I focused on clear, idiomatic Go code while ensuring I could meet all of the exercise requirements.
- I have tried learn and understand Go and its syntax as much as i can in the limited amount of time to reduce my reliance on AI Tools for coding.
- Writing unit tests and HTTP handler tests in Go was a new challenge, and I learned a lot about interfaces, dependency injection, REST API's and testing with
httptest. - I appreciate your patience and hope this solution demonstrates my ability to learn new technologies quickly.
Thank you for your time and consideration!