Platform pembelajaran online berbasis web yang dibangun dengan arsitektur microservices menggunakan Go, gRPC, dan React.
- Tentang Proyek
- Tech Stack
- Fitur Utama
- Arsitektur Sistem
- Skema Database
- Prerequisites
- Instalasi
- Konfigurasi
- Menjalankan Aplikasi
- Struktur Proyek
- API Documentation
E-Learning Platform adalah sistem manajemen pembelajaran yang dirancang untuk memfasilitasi interaksi antara guru dan siswa dalam lingkungan digital. Platform ini mendukung berbagai role pengguna (Admin, Guru, Siswa) dengan fitur-fitur lengkap untuk pengelolaan kursus, materi pembelajaran, progress tracking, dan sistem notifikasi real-time.
Proyek ini dikembangkan sebagai bagian dari Uji Kompetensi Keahlian (UKK) jurusan Rekayasa Perangkat Lunak.
| Teknologi | Deskripsi |
|---|---|
| Library JavaScript untuk UI | |
| Superset JavaScript dengan typing | |
| Build tool & dev server | |
| Component library | |
| Utility-first CSS framework | |
| Client-side routing | |
| HTTP client |
| Teknologi | Deskripsi |
|---|---|
| Containerization | |
| Container engine (alternatif Docker) | |
| Multi-container orchestration | |
| Monitoring and metrics collection | |
| Visualization and dashboarding for metrics | |
| Version control |
versi tools yang saya pake:
go version go1.25.4 X:nodwarf5 linux/amd64- Bun
1.3.3 podman-compose version 1.5.0podman version 5.7.0postgres (PostgreSQL) 18.1Linux 6.17.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 24 Nov 2025 15:21:09 +0000 x86_64 GNU/Linux
- Manajemen pengguna (CRUD guru dan siswa)
- Manajemen kursus (approval, monitoring)
- Sistem notifikasi broadcast
- Dashboard analytics dan reporting
- Monitoring aktivitas sistem
- Membuat dan mengelola kursus
- Upload materi pembelajaran (PDF, video)
- Manajemen lesson dan chapter
- Monitoring progress siswa
- Memberikan feedback dan penilaian
- Browse dan enroll kursus
- Akses materi pembelajaran
- Progress tracking otomatis
- Dashboard personal
- Notifikasi real-time
- Authentication & Authorization dengan JWT
- Upload file dengan validasi (PDF, video)
- Dark mode / Light mode
- Responsive design
- Real-time notification via gRPC
- Log rotation dan monitoring
- RESTful API
singkatnya: pengen nyoba aja sih. lengkapnya: Go (Golang) dipilih sebagai bahasa pemrograman backend karena mendukung paradigma Object-Oriented Programming (OOP) dengan pendekatan yang unik dan modern. Meskipun Go tidak memiliki class seperti Java atau C++, Go tetap mendukung prinsip-prinsip OOP melalui:
Go menggunakan struct dan visibility rules (exported/unexported) untuk enkapsulasi data:
type User struct {
ID uint
name string // private (unexported)
Password string // public (exported)
}Go tidak mendukung inheritance, namun menggunakan composition yang lebih fleksibel:
type Repository struct {
db *gorm.DB
}
type UserRepository struct {
Repository // embedded struct (composition)
}Go menggunakan interface untuk mencapai polymorphism tanpa coupling yang ketat:
type CourseService interface {
Create(course *Course) error
GetByID(id uint) (*Course, error)
}
type courseServiceImpl struct {
repo CourseRepository
}
func (s *courseServiceImpl) Create(course *Course) error {
// implementation
}Go mendukung method yang di-attach pada struct, mirip dengan class methods:
func (u *User) ValidatePassword(password string) bool {
return bcrypt.CompareHashAndPassword(u.Password, password) == nil
}Simplicity: Tidak ada inheritance kompleks, lebih mudah dipahami Composition: Lebih fleksibel daripada inheritance hierarchy Interface Satisfaction: Duck typing membuat code lebih loosely coupled No Constructor Overhead: Initialization lebih eksplisit dan jelas Better Performance: Tanpa virtual method table overhead
Dalam proyek E-Learning Platform ini, prinsip OOP diterapkan melalui:
- Domain Layer: Struct sebagai representasi entity
- Repository Pattern: Interface untuk abstraksi database operations
- Service Layer: Business logic dengan dependency injection
- Handler Layer: Request/response handling dengan method receivers
- Middleware: Composition untuk chain of responsibility pattern
Arsitektur ini mengikuti Clean Architecture dan SOLID Principles, membuktikan bahwa Go dapat digunakan untuk membangun aplikasi enterprise-grade dengan prinsip OOP yang baik.
┌─────────────────┐
│ React SPA │
│ (Frontend) │
└────────┬────────┘
│ HTTP/REST
▼
┌─────────────────┐
│ Gin Router │
│ (API Gateway) │
└────────┬────────┘
│
┌────┴──────┐
│ │
▼ ▼
┌────────┐ ┌──────────────┐
│ Main │ │ Notification │
│Service │◄─┤ Service │
│ │ │ (gRPC) │
└───┬────┘ └──────────────┘
│
▼
┌─────────────┐
│ PostgreSQL │
└─────────────┘
---
config:
theme: neo
themeVariables:
primaryColor: '#e3f2fd'
primaryTextColor: '#1976d2'
primaryBorderColor: '#1976d2'
lineColor: '#666'
secondaryColor: '#f5f5f5'
tertiaryColor: '#fff'
look: handDrawn
layout: elk
---
flowchart TB
subgraph Auth["Authentication"]
Login["Login"]
Register["Register"]
Logout["Logout"]
end
subgraph StudentF["Student Features"]
Browse["Browse Courses"]
ViewDetail["View Course Detail"]
Enroll["Enroll in Course"]
Learn["Learn Lessons"]
Track["Track Progress"]
MarkDone["Mark Lesson Complete"]
StudentDash["Student Dashboard"]
end
subgraph TeacherF["Teacher Features"]
CreateCourse["Create Course"]
EditCourse["Edit Course"]
DeleteCourse["Delete Course"]
Publish["Publish/Unpublish"]
ManageLessons["Manage Lessons"]
ViewStudents["View Students"]
TeacherDash["Teacher Dashboard"]
end
subgraph AdminF["Admin Features"]
ManageUsers["Manage Users"]
ManageCourses["Manage All Courses"]
ViewReports["View Reports"]
SendNotif["Send Notifications"]
AdminDash["Admin Dashboard"]
end
subgraph Common["Common Features"]
ViewProfile["View Profile"]
EditProfile["Edit Profile"]
ChangePass["Change Password"]
ViewNotif["View Notifications"]
end
subgraph System["E-Learning Platform"]
direction TB
Auth
StudentF
TeacherF
AdminF
Common
end
Guest(["Guest"]) --> Browse & ViewDetail & Register & Login
Student(["Student"]) --> Login & Browse & ViewDetail & Enroll & Learn & Track & MarkDone & StudentDash & ViewProfile & EditProfile & ChangePass & ViewNotif & Logout
Teacher(["Teacher"]) --> Login & CreateCourse & EditCourse & DeleteCourse & Publish & ManageLessons & ViewStudents & TeacherDash & ViewProfile & EditProfile & ChangePass & ViewNotif & Logout
Admin(["Admin"]) --> Login & ManageUsers & ManageCourses & ViewReports & SendNotif & AdminDash & ViewProfile & EditProfile & ChangePass & ViewNotif & Logout
Enroll -. requires .-> Login
Learn -. requires .-> Login
CreateCourse -. requires .-> Login
ManageUsers -. requires .-> Login
Auth --> n1["Untitled Node"]
Guest:::actorStyle
Student:::actorStyle
Teacher:::actorStyle
Admin:::actorStyle
classDef actorStyle fill:#e3f2fd,stroke:#1976d2,stroke-width:3px,color:#1976d2
classDef usecaseStyle fill:#fff,stroke:#666,stroke-width:2px
classDef systemStyle fill:#f5f5f5,stroke:#999,stroke-width:2px
Main Service (Port 8080)
- Handler: Auth, User, Course, Lesson, Enrollment, Progress, Dashboard
- Middleware: Authentication, Logger, Ownership
- Repository Pattern dengan domain-driven design
Notification Service (Port 50051)
- gRPC server untuk notifikasi real-time
- Independent database connection
- Protocol Buffers untuk contract definition
erDiagram
users ||--o{ categories : creates
users ||--o{ courses : teaches
users ||--o{ enrollments : enrolls
users ||--o{ student_progress : tracks
users ||--o{ notifications : receives
users ||--o{ progress : completes
categories ||--o{ courses : contains
courses ||--o{ lessons : has
courses ||--o{ enrollments : "enrolled in"
courses ||--o{ student_progress : tracks
courses ||--|{ course_details : "detailed by"
lessons ||--o{ progress : "completed in"
users {
integer id PK
varchar name
varchar email
varchar password
user_role role
varchar avatar
timestamp created_at
timestamp updated_at
}
categories {
integer id PK
varchar name
text description
timestamp created_at
}
courses {
integer id PK
varchar title
text description
varchar thumbnail
integer category_id FK
integer teacher_id FK
boolean is_published
timestamp created_at
timestamp updated_at
}
lessons {
integer id PK
integer course_id FK
varchar title
text content
varchar video_url
varchar file_url
integer order_number
integer duration
timestamp created_at
timestamp updated_at
}
course_details {
integer id PK
varchar title
text description
varchar thumbnail
boolean is_published
varchar category_name
varchar teacher_name
varchar teacher_email
bigint total_lessons
bigint total_students
timestamp created_at
timestamp updated_at
}
enrollments {
integer id PK
integer user_id FK
integer course_id FK
timestamp enrolled_at
enrollment_status status
timestamp completed_at
}
student_progress {
integer user_id FK
integer course_id FK
varchar course_title
bigint total_lessons
bigint completed_lessons
numeric progress_percentage
timestamp enrolled_at
enrollment_status status
}
progress {
integer id PK
integer user_id FK
integer lesson_id FK
boolean is_completed
timestamp completed_at
}
notifications {
integer id PK
integer user_id FK
varchar title
text message
notification_type type
boolean is_read
timestamp created_at
}
users
- Menyimpan data pengguna (admin, guru, siswa)
- Relasi: courses (1:N), enrollments (1:N)
courses
- Menyimpan data kursus
- Relasi: users (N:1), lessons (1:N), enrollments (1:N)
lessons
- Menyimpan materi pembelajaran
- Relasi: courses (N:1), progress (1:N)
enrollments
- Menyimpan data pendaftaran siswa ke kursus
- Relasi: users (N:1), courses (N:1)
progress
- Tracking progress pembelajaran siswa
- Relasi: users (N:1), lessons (N:1)
notifications
- Menyimpan notifikasi sistem
- Relasi: users (N:1)
Pastikan sistem Anda telah terinstall:
- Go
- Node.js dan Bun (atau npm/yarn)
- PostgreSQL
- Podman atau Docker dan Docker Compose
- Protocol Buffer Compiler (protoc)
- Git
# Install Go
sudo pacman -S go
# Install Node.js dan Bun
sudo pacman -S nodejs npm
curl -fsSL https://bun.sh/install | bash
# Install PostgreSQL
sudo pacman -S postgresql
sudo systemctl enable postgresql
sudo systemctl start postgresql
# Install Podman
sudo pacman -S podman podman-compose
# Install protoc
sudo pacman -S protobuf# Install Go
wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
# Install Bun
curl -fsSL https://bun.sh/install | bash
# Install PostgreSQL
sudo apt update
sudo apt install postgresql postgresql-contrib
# Install Podman
sudo apt install podman podman-composegit clone --recurse-submodules https://github.com/fauzymadani/E-Learning.git
cd E-Learninguntuk guide lebih lengkap, pertimbangakn mengunjungi dokumentasi PostgreSQL resmi. atau https://wiki.archlinux.org/title/PostgreSQL
# Login ke PostgreSQL
sudo -u postgres psql
# Buat database dan user
CREATE DATABASE elearning_db;
CREATE USER elearning_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE elearning_db TO elearning_user;
\q
# Import schema database
psql -U elearning_user -d elearning_db -f elearning.sql# Install dependencies
go mod download
# Setup notification service
cd microservices/notification-service
go mod download
cd ../..
# Generate protobuf (jika ada perubahan)
cd proto
protoc --go_out=. --go-grpc_out=. notification.proto
cd ..cd frontend
# Install dependencies dengan Bun
bun install
# Atau dengan npm
# npm install
cd ..Buat file config.yaml atau setup environment variables:
cp .env.example .envBuat file config.yaml di microservices/notification-service/:
cp .env.example .env# Build dan jalankan semua service
podman-compose up -d
# Atau dengan docker-compose
docker-compose up -d
# Lihat logs
podman-compose logs -f
# Stop semua service
podman-compose down# Overview perintah Makefile:
Usage: make [target]
Targets:
help Show this help
build Build binary into ./bin
run Build and run
test Run unit tests
fmt gofmt (via go fmt)
vet go vet
lint run golangci-lint (must be installed)
deps download modules
clean remove build artifacts
# Build dan jalankan aplikasi
make build
make run
make test # TODO: implementasi test unit# Di terminal baru
cd frontend
bun run devAplikasi akan berjalan di:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8080
- gRPC Notification: localhost:50051
- Grafana url: http://localhost:3001/ (see .env for default credentials)
.
├── cmd/
│ └── api/
│ └── main.go # Entry point aplikasi
├── internal/
│ ├── config/ # Konfigurasi aplikasi
│ ├── domain/ # Domain models & entities
│ ├── handler/ # HTTP handlers (controllers)
│ ├── middleware/ # Custom middlewares
│ ├── repository/ # Database access layer
│ ├── router/ # Route definitions
│ └── service/ # Business logic layer
├── pkg/
│ ├── grpcclient/ # gRPC client utilities
│ ├── hash/ # Password hashing
│ ├── logger/ # Logging utilities
│ ├── storage/ # File storage (GCS/local)
│ └── token/ # JWT utilities
├── proto/ # Protocol buffer definitions
├── microservices/
│ └── notification-service/ # Microservice notifikasi
│ ├── cmd/server/
│ ├── internal/
│ └── proto/
├── frontend/ # React application
│ ├── src/
│ │ ├── api/ # API client
│ │ ├── components/ # React components
│ │ ├── context/ # React context
│ │ ├── dashboard/ # Dashboard components
│ │ ├── hooks/ # Custom hooks
│ │ ├── pages/ # Page components
│ │ └── router/ # Route configuration
│ └── public/
├── uploads/ # Upload directory
│ ├── avatars/
│ ├── files/
│ └── videos/
├── logs/ # Application logs
├── docker-compose.yml
├── Dockerfile
├── elearning.sql # Database schema
└── README.md
POST /api/auth/login # Login user
POST /api/auth/register # Register user baru
POST /api/auth/logout # Logout user
GET /api/auth/me # Get user profile
GET /api/users # List semua users (Admin only)
GET /api/users/:id # Get user by ID
PUT /api/users/:id # Update user
DELETE /api/users/:id # Delete user (Admin only)
POST /api/users # Create user (Admin only)
GET /api/courses # List semua courses
GET /api/courses/:id # Get course detail
POST /api/courses # Create course (Teacher/Admin)
PUT /api/courses/:id # Update course (Owner)
DELETE /api/courses/:id # Delete course (Owner)
GET /api/courses/my # Get my courses
GET /api/lessons # List lessons by course
GET /api/lessons/:id # Get lesson detail
POST /api/lessons # Create lesson
PUT /api/lessons/:id # Update lesson
DELETE /api/lessons/:id # Delete lesson
POST /api/lessons/:id/upload # Upload lesson material
POST /api/enrollments # Enroll ke course
GET /api/enrollments # Get my enrollments
DELETE /api/enrollments/:id # Unenroll dari course
GET /api/progress # Get my progress
POST /api/progress # Update progress
GET /api/progress/course/:id # Get course progress
GET /api/dashboard/stats # Get dashboard statistics
GET /api/dashboard/recent # Get recent activities
GET /api/notifications # Get my notifications
PUT /api/notifications/:id # Mark as read
DELETE /api/notifications/:id # Delete notification
POST /api/notifications/broadcast # Broadcast notification (Admin)
# Build binary
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/api cmd/api/main.go
# Build notification service
cd microservices/notification-service
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/server cmd/server/main.gocd frontend
bun run build
# Output akan ada di folder dist/# Build images
podman-compose build
podman-compose up -d
# Liat log
podman-compose logs -f backend- Pastikan PostgreSQL sudah running
- Cek kredensial database di config
- Pastikan database sudah di-create
# Cek port yang digunakan
sudo lsof -i :8080
sudo lsof -i :50051
sudo lsof -i :5173
# Kill process jika perlu
kill -9 <PID>- Pastikan notification service sudah running
- Cek konfigurasi gRPC URL di config
- Cek firewall rules
- Cek folder uploads/ memiliki permission yang benar
- Pastikan max file size sudah dikonfigurasi
- Cek disk space
Proyek ini dibuat untuk keperluan Uji Kompetensi Keahlian (UKK) SMK Jurusan Rekayasa Perangkat Lunak.
- Guru pembimbing dan penguji UKK
- Claude, ChatGPT atas bantuannya dalam pengembangan kode, refactoring, dan implementasi GRPC ke backend.
- Open source community atas tools dan libraries yang digunakan
- OOP in Go: https://www.geeksforgeeks.org/go-language/object-oriented-programming-in-golang/
- Mengenal Konsep Object-Oriented Pada Golang: https://medium.com/@reza_devhub/mengenal-konsep-object-oriented-pada-golang-b28e6e2b183c
- Unraveling the Power of OOP in Golang: https://dev.to/parthlaw/object-oriented-go-unraveling-the-power-of-oop-in-golang-49h6
Catatan: Dokumentasi ini akan terus diperbarui seiring dengan perkembangan proyek.
Untuk pertanyaan dan bug report, silakan buat issue di repository ini.

