This is a base project for implementasi simple e wallet using Golang with the Fiber framework, Gorm for database operations, Redis for cahce ,midtrans for handle real money, filebeat kibana for log core,and PostgreSQL as the database.godotenv Configuration is managed via an env file.
- Transaction core: Core of transaction e money
- TopUp: Top up transaction use real money from mitrans api
- Notification Realtime
- Mobile PIN: a mobile PIN a one transaction
- Detect Location: Detect location a user when login
- Log core: centralized log use kibana and filebeat
- Queue Server: implement queue server use redis connection
- Fiber Framework: Fast and minimalistic web framework for Go.
- GORM: SQL builder and query library for Go.
- PostgreSQL: Relational database for storing application data.
- Env File: Simple configuration management using environment variables.
- Validator: simple validator for your application
- auth basic: basic authentication token for your application
Ensure you have the following installed:
-
Clone the repository:
git clone https://github.com/shellrean/golang-base-project-clean-directory.git cd golang-base-project-clean-directory
-
Install dependencies:
go mod tidy
-
Create and configure
.env
file:Create a
.env
file in the root directory and add your configuration variables.DB_HOST=localhost DB_PORT=5432 DB_USER=yourusername DB_PASS=yourpassword DB_NAME=yourdbname SERVER_HOST=localhost SERVER_PORT=8700 MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=email MAIL_PASSWORD=<password> REDIS_ADDR= REDIS_PASSWORD= REDIS_DB= MIDTRANS_KEY=server-key # production atau sandbox MIDTRANS_ENV= QUEUE_REDIS_ADDR=localhost:6379 QUEUE_REDIS_PASSWORD= QUEUE_REDIS_DB=0
-
Set up PostgreSQL database:
Make sure your PostgreSQL server is running and create a database matching your
.env
configuration.psql -U yourusername -c "CREATE DATABASE yourdbname;"
-
Set up Docker compose: Make sure your Docker server is running and create a Docker compose file
docker compose up
-
clone server redis queue from my github repository
git clone https://github.com/ahyalfan/redis-queue-server-go.git
Start the application with the following command:
go run main.go