Foomlet is a modern e-wallet application built with Go that provides secure digital wallet services including top-up, payments, and money transfers. The application features asynchronous transfer processing using RabbitMQ for improved performance and reliability.
-
User Management
- User registration with phone number and PIN
- Secure login with JWT authentication
- Profile management
-
Wallet Operations
- Digital wallet creation for each user
- Balance tracking and history
- Secure transaction processing
-
Financial Transactions
- Top-Up: Add money to wallet
- Payments: Make payments with remarks
- Transfers: Send money to other users
- Transaction history with detailed records
-
Asynchronous Processing
- RabbitMQ integration for transfer processing
- Quorum queues for high availability
- Fallback to synchronous processing when queue is unavailable
-
Security
- Argon2 password hashing
- JWT access and refresh tokens
- Database transaction integrity
- Go 1.23.5 - Primary programming language
- Gin - HTTP web framework
- PostgreSQL 15 - Primary database
- RabbitMQ 3.12 - Message broker for asynchronous processing
- JWT - JSON Web Tokens for authentication
- Argon2 - Password hashing algorithm
- pgx/v5 - PostgreSQL driver and connection pooling
- golang-migrate - Database migration tool
- Docker & Docker Compose - Containerization
- Alpine Linux - Lightweight container base
- godotenv - Environment variable management
- uuid - UUID generation
- amqp091-go - RabbitMQ client
e:\coding\rabbitmq\
├── cmd/
│ ├── main.go # Main application entry point
│ └── seeder/
│ └── seed.main.go # Database seeder
├── internal/
│ ├── config/ # Configuration management
│ ├── handlers/ # HTTP request handlers
│ ├── middlewares/ # Custom middlewares
│ ├── models/ # Data models and DTOs
│ ├── repositories/ # Data access layer
│ └── routes/ # Route definitions
├── migrations/ # Database migrations
│ └── seed/ # Seed data
├── pkg/ # Shared utilities
├── docker-compose.yml # Docker services configuration
├── dockerfile # Application container
├── .env # Environment variables
└── README.md
POST /api/auth- User loginPOST /api/auth/new- User registrationPOST /api/auth/refresh- Refresh access token
PATCH /api/profile- Update user profile
POST /api/topup- Add money to walletPOST /api/payments- Make paymentPOST /api/transfers- Transfer money to another userGET /api/transactions- Get transaction history
GET /ping- Application health check
- Docker and Docker Compose installed
- Git for cloning the repository
-
Clone the repository
git clone <repository-url> cd foomlet
-
Set up environment variables
# Create .env file with your database credentials # Example configuration is provided below
-
Start all services
docker-compose up --build -d
-
Check service status
docker-compose logs -f app
-
Access the application
- API: http://localhost:8080
- RabbitMQ Management: http://localhost:15672 (guest/guest)
- Database: localhost:5432
-
Install dependencies
# Install Go 1.23.5 # Install PostgreSQL 15 # Install RabbitMQ 3.12
-
Set up database
# Create PostgreSQL database createdb -U postgres foomlet # Run migrations migrate -path ./migrations -database "your-database-url" up
-
Seed initial data
go run cmd/seeder/seed.main.go
-
Start the application
go run cmd/main.go
# Build and start services
docker-compose up --build -d
# Stop services
docker-compose down
# View logs
docker-compose logs -f app
# Clean up
docker-compose down -v
# Run migrations manually
docker-compose exec app migrate -path ./migrations -database "$DB_URL" up
# Seed data manually
docker-compose exec app ./seeder
# Access database
docker-compose exec db psql -U youruser -d yourdbThe application comes with pre-seeded test data:
-
User 1:
- Phone:
08123456789 - PIN:
123456 - Name: John Doe
- Initial Balance: 350,000 (after transactions)
- Phone:
-
User 2:
- Phone:
08987654321 - PIN:
123456 - Name: Jane Smith
- Initial Balance: 100,000 (received from transfer)
- Phone:
- Top-up: 500,000
- Payment: 50,000 (electricity bill)
- Transfer: 100,000 (birthday gift to User 2)
Create a .env file with the following configuration:
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_USER=youruser
DB_PASSWORD=yourpassword
DB_NAME=yourdb
DB_URL="postgresql://youruser:yourpassword@localhost:5432/yourdb?search_path=public&sslmode=disable"
# JWT Configuration
JWT_ACCESS_SECRET=your_access_secret_here
JWT_REFRESH_SECRET=your_refresh_secret_here
JWT_ACCESS_EXPIRY=15m
JWT_REFRESH_EXPIRY=168h
# RabbitMQ Configuration
RABBITMQ_URL=amqp://guest:guest@localhost:5672/
# Server Configuration
PORT=8080- Transfers are queued in RabbitMQ for processing
- Worker processes consume transfer messages
- Graceful fallback to synchronous processing
- Quorum queues ensure message durability
- PostgreSQL with proper foreign key relationships
- Money type for accurate financial calculations
- Transaction atomicity with proper rollback handling
- Separate tables for different transaction types
- Argon2 password hashing with salt
- JWT-based stateless authentication
- Input validation and sanitization
- Database transaction integrity
Access http://localhost:15672 with credentials guest/guest to:
- Monitor queue status
- View message rates
- Manage exchanges and queues
- Debug transfer processing
Connect to PostgreSQL to:
- View transaction history
- Monitor wallet balances
- Analyze user data
- Debug database issues
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is developed for educational and demonstration purposes. This project is developed for educational and demonstration purposes.