This is a Go implementation of the Pray Together API server, migrated from SpringBoot to Go using Domain-Driven Design (DDD) principles with a domain-based modular architecture.
Each domain is a self-contained module with its own 4-layer architecture:
internal/domains/
├── member/ # Member management domain
├── room/ # Room and member-room relationship domain
├── prayer/ # Prayer management domain
├── auth/ # Authentication and authorization domain
├── invitation/ # Room invitation domain
├── fcmtoken/ # FCM token management domain
└── notification/ # Notification management domain
- domain/: Core business logic, entities, domain services
- application/: Use cases and application services
- infrastructure/: Repository implementations, external services
- interfaces/: Public APIs and HTTP handlers
- Complete Domain Independence: Each domain has its own BaseEntity and no shared dependencies
- Interface-Based Communication: Domains communicate only through defined public interfaces
- Aggregate Design: MemberRoom is part of Room aggregate (following DDD principles)
- Clean Architecture: Clear separation of concerns across layers
- Framework: Gin (HTTP framework)
- ORM: GORM
- Database: PostgreSQL
- Authentication: JWT
- Password Hashing: bcrypt
- Email: SMTP
- Push Notifications: FCM
- Configuration: Environment variables (.env)
- Go 1.21 or higher
- PostgreSQL
- Redis (optional, for caching)
- Clone the repository:
git clone <repository-url>
cd go-api-server- Install dependencies:
go mod download- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration- Run database migrations:
go run cmd/server/main.go migrate- Start the server:
go run cmd/server/main.goThe server will start on port 8080 by default (configurable via PORT environment variable).
POST /api/v1/auth/signup- User registrationPOST /api/v1/auth/login- User loginPOST /api/v1/auth/logout- User logoutPOST /api/v1/auth/refresh- Refresh tokenPOST /api/v1/auth/otp/send- Send OTPPOST /api/v1/auth/otp/verify- Verify OTP
GET /api/v1/members/me- Get current user profileGET /api/v1/members/:id- Get member by IDPUT /api/v1/members/me- Update profileDELETE /api/v1/members/me- Delete accountGET /api/v1/members/search- Search members
POST /api/v1/rooms- Create roomGET /api/v1/rooms- Get user's roomsGET /api/v1/rooms/:id- Get room detailsPUT /api/v1/rooms/:id- Update roomDELETE /api/v1/rooms/:id- Delete roomPOST /api/v1/rooms/:id/join- Join roomPOST /api/v1/rooms/:id/leave- Leave roomGET /api/v1/rooms/:id/members- Get room membersPUT /api/v1/rooms/:id/notification- Update notification settings
POST /api/v1/prayers- Create prayerGET /api/v1/prayers- Get prayersGET /api/v1/prayers/:id- Get prayer detailsPUT /api/v1/prayers/:id- Update prayerDELETE /api/v1/prayers/:id- Delete prayerPOST /api/v1/prayers/:id/complete- Mark prayer as completed
POST /api/v1/invitations- Create invitationGET /api/v1/invitations- Get invitationsPUT /api/v1/invitations/:id/accept- Accept invitationPUT /api/v1/invitations/:id/reject- Reject invitation
POST /api/v1/fcm-tokens- Register FCM tokenDELETE /api/v1/fcm-tokens- Delete FCM token
Prayer → Room (validate access)
Prayer → Member (get member info)
Auth → Member (authenticate)
Invitation → Room, Member
Notification → Member, FCMToken
go test ./...go build -o bin/server cmd/server/main.godocker build -t pray-together-api .
docker run -p 8080:8080 pray-together-apiThis Go implementation maintains full feature parity with the original SpringBoot application:
- ✅ JWT-based authentication
- ✅ OTP email verification
- ✅ Room management with roles (Owner/Member)
- ✅ Prayer sharing within rooms
- ✅ Invitation system
- ✅ FCM push notifications
- ✅ Soft delete support
- ✅ Audit fields (created_at, updated_at, deleted_at)
- Microservice Ready: Each domain can be extracted into a separate service
- Team Scalability: Different teams can own different domains
- Clear Boundaries: Business logic is clearly separated
- Testability: Each domain can be tested in isolation
- Maintainability: Changes in one domain don't affect others
[Your License]
[Contributing Guidelines]