https://github.com/sebi75/go-bank-api
A bank monorepo with a primary service for managing resources and an auth microservice
https://github.com/sebi75/go-bank-api
go microservice
Last synced: 12 months ago
JSON representation
A bank monorepo with a primary service for managing resources and an auth microservice
- Host: GitHub
- URL: https://github.com/sebi75/go-bank-api
- Owner: sebi75
- Created: 2023-03-20T15:40:02.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-21T21:01:24.000Z (almost 3 years ago)
- Last Synced: 2025-02-13T07:41:29.585Z (about 1 year ago)
- Topics: go, microservice
- Language: Go
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Bank API
This is a monorepo for the Go Bank API, which consists of two microservices: the Auth Service and the Banking Service. The Auth Service is responsible for handling user authentication using JWT, while the Banking Service is the main REST API for managing resources.
## Getting Started
These instructions will help you set up and run the Go Bank API on your local machine for development and testing purposes.
### Prerequisites
- Go (v1.17 or higher) - Optional, for local development without Docker
- Docker (for running the services in containers)
- Docker Compose (for orchestrating the containers)
### Installing
1. Clone the repository:
ssh:
```sh
git clone git@github.com:sebi75/go-bank-api.git
cd go-bank-api
```
https:
```sh
git clone https://github.com/sebi75/go-bank-api.git
cd go-bank-api
```
Set up the environment variables for each microservice.
Rename the .env.example file to .env in the root directory of each microservice, and set the values for the environment variables. For example, in the auth-service/.env file, you should have something like this:
```sh
DB_HOST=localhost
DB_PORT=5432
DB_USER=yourdbuser
DB_PASSWORD=yourdbpassword
DB_NAME=yourdbname
JWT_SECRET=yourjwtsecret
```
Make sure to replace the values with your own.
Build and run the microservices using Docker Compose. In the root directory of the project, run the following command:
```sh
docker-compose up --build
```
Docker Compose will build the images and start the containers for both services.
Using the Monorepo in Visual Studio Code
To properly work with the monorepo in Visual Studio Code, create a go-bank-api.code-workspace file in the root directory of the repository, and include the following configuration:
```json
{
"folders": [
{
"path": "auth-service"
},
{
"path": "banking-service"
}
{
"path": "banking-lib"
}
]
}
```
Now, open the go-bank-api.code-workspace file in Visual Studio Code, and you should have a properly configured workspace for the monorepo.
Usage
Once the services are up and running, you can interact with the API using tools like Postman or curl. Below are some example endpoints:
Auth Service:
POST /auth/register: Register a new user
POST /auth/login: Authenticate a user and generate a JWT token
Banking Service:
GET /customers: Get a list of customers
POST /customers: Create a new customer
PUT /customers/{id}: Update a customer
DELETE /customers/{id}: Delete a customer
Refer to the API documentation for a complete list of endpoints and request/response formats.