A simple banking simulation API built with Go, featuring user authentication, account management, and money transfers.
- User registration and login with JWT authentication
- Account creation and balance management
- Secure money transfers between accounts
- Asynchronous processing with RabbitMQ
- PostgreSQL database with GORM ORM
- RESTful API with Gin framework
- Go 1.19+
- PostgreSQL
- RabbitMQ
- Docker (optional, for containerized setup)
-
Clone the repository:
git clone https://github.com/trueMNOX/GoBank.git cd GoBank -
Install dependencies:
go mod tidy
-
Set up environment variables (create a
.envfile or set them directly):DB_HOST,DB_PORT,DB_USER,DB_PASSWORD,DB_NAMEJWT_SECRETRABBITMQ_URLSERVER_PORT
-
Run database migrations:
go run migrations/migrate.go
go run cmd/api/main.goThe server will start on the configured port (default: 8080).
go run cmd/worker/main.goPOST /api/register- Register a new userPOST /api/login- Login userPOST /api/accounts- Create account (authenticated)GET /api/accounts- List user accounts (authenticated)POST /api/transfers- Transfer money (authenticated)
To run with Docker Compose:
docker-compose up --buildThis project is licensed under the MIT License.