Memulai — Getting Started
Panduan lengkap untuk menyiapkan lingkungan pengembangan LMS Codeverta di mesin lokal Anda.
Persyaratan Sistem
Sebelum memulai, pastikan Anda memiliki perangkat lunak berikut terinstal di komputer Anda:
| Software | Versi Minimum | Fungsi |
|---|---|---|
| Go | 1.22+ | Bahasa backend dan compiler |
| Node.js | 18.0+ | Runtime JavaScript untuk frontend |
| pnpm | 8.0+ | Package manager monorepo |
| MySQL | 8.0+ | Database utama |
| Redis | 6.0+ | Cache dan rate limiting |
| Make | Any | Build automation |
Instalasi per Sistem Operasi
macOS (menggunakan Homebrew)
# Go
brew install go
# Node.js
brew install node@20
# pnpm
npm install -g pnpm
# MySQL
brew install mysql
brew services start mysql
# Redis
brew install redis
brew services start redis
# Make
xcode-select --install # sudah terinstal di macOS
Ubuntu/Debian Linux
# Go
wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
# Node.js
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
# pnpm
npm install -g pnpm
# MySQL
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
# Redis
sudo apt install redis-server
sudo systemctl start redis
# Make
sudo apt install make
Windows
# Install Chocolatey (package manager Windows)
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Go
choco install golang
# Node.js
choco install nodejs-lts
# pnpm
npm install -g pnpm
# MySQL (atau gunakan MySQL Installer dari mysql.com)
choco install mysql
# Redis (menggunakan WSL atau Memurai)
choco install memurai-developer
# Make
choco install make
Kloning Repository
git clone https://github.com/codeverta/learning-management-system.git
cd learning-management-system
Struktur Monorepo
Proyek ini menggunakan pnpm workspace untuk mengelola monorepo:
lms.codeverta.com/
├── apps/
│ ├── admin/ → React Frontend (Vite)
│ ├── backend/ → Go Backend (Gin)
│ └── landing/ → Landing page (Cloudflare Workers)
├── docs/ → Dokumentasi ini
├── pnpm-workspace.yaml
├── pnpm-lock.yaml
└── package.json
Instalasi Dependensi
1. Install dependensi monorepo root
pnpm install
2. Install dependensi backend
cd apps/backend
go mod download
cd ../..
3. Install dependensi frontend
cd apps/admin
pnpm install
cd ../..
Konfigurasi Lingkungan
Backend — .env
Buat file .env di dalam direktori apps/backend/ dengan mengcopy template:
cd apps/backend
cp .env.example .env
Isi file .env dengan konfigurasi Anda:
# Server Configuration
SERVER_PORT=8080
SERVER_ENV=development
# Database Configuration
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password_here
DB_NAME=lms_codeverta
# Redis Configuration
REDIS_ADDR=127.0.0.1:6379
REDIS_PASSWORD=
# JWT / Auth
JWT_SECRET=your-super-secret-jwt-key-here
# File Storage
STORAGE_PATH=./storage
MAX_UPLOAD_SIZE_MB=25
# Xendit Payment (opsional)
XENDIT_SECRET_KEY=
XENDIT_CALLBACK_TOKEN=
# AI / OpenAI (opsional untuk fitur chat)
OPENAI_API_KEY=
# Email (opsional)
SMTP_HOST=
SMTP_PORT=
SMTP_USER=
SMTP_PASSWORD=
SMTP_FROM=
Frontend — .env
cd apps/admin
# Frontend menggunakan VITE_ prefix untuk environment variables
cat > .env << EOF
VITE_API_BASE_URL=http://localhost:8080/api
EOF
cd ../..
Setup Database
1. Buat Database MySQL
mysql -u root -p -e "CREATE DATABASE lms_codeverta CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
2. Jalankan Auto-Migration
Backend menggunakan GORM Auto-Migration yang akan membuat tabel secara otomatis saat aplikasi pertama kali dijalankan. Anda tidak perlu menjalankan migration secara manual.
Menjalankan Aplikasi
Backend
cd apps/backend
make run
Atau tanpa make:
cd apps/backend
go run main.go
Backend akan berjalan di http://localhost:8080.
Frontend
cd apps/admin
pnpm dev
Frontend akan berjalan di http://localhost:5173 (Vite dev server).
Akun Default
Saat pertama kali menjalankan backend, database akan di-migrate otomatis. Untuk membuat akun admin pertama, Anda dapat menggunakan API registrasi:
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "admin@codeverta.com",
"password": "password123",
"name": "Admin Utama",
"role": 100
}'
Atau gunakan seeder jika tersedia:
cd apps/backend
go run database/seeder/seeder.go
Verifikasi Instalasi
Test Backend Health
curl http://localhost:8080/api/health
# Expected: {"status":"ok","timestamp":"..."}
Test Frontend
Buka browser dan akses http://localhost:5173. Anda akan melihat halaman login.
Login dengan Akun Admin
- Akses
http://localhost:5173 - Login dengan email:
admin@codeverta.com - Password:
password123
Menjalankan dengan Docker
Jika Anda lebih memilih menjalankan dengan Docker, gunakan docker-compose.yml:
# Build dan jalankan semua service
docker-compose up --build
# Atau jalankan dalam mode detached
docker-compose up -d
docker-compose.yml akan menjalankan:
| Service | Port | Deskripsi |
|---|---|---|
backend | 8080 | Go API Server |
admin | 80/443 | React Frontend (Nginx) |
mysql | 3306 | MySQL Database |
redis | 6379 | Redis Cache |
Troubleshooting
Error: port already in use
# Cari proses yang menggunakan port
lsof -i :8080
# atau
netstat -tlnp | grep 8080
# Kill proses tersebut
kill -9 <PID>
Error: go.sum mismatch
cd apps/backend
go mod tidy
Error: cannot find module di frontend
cd apps/admin
rm -rf node_modules
pnpm install
MySQL Connection Error
Pastikan MySQL server berjalan:
# macOS
brew services start mysql
# Linux
sudo systemctl start mysql
# Cek status
mysql -u root -p -e "SELECT 1;"
Editor Setup
VS Code (Recommended)
Install extension berikut untuk pengalaman development terbaik:
| Extension | Fungsi |
|---|---|
| Go | Syntax highlighting Go |
| ES7+ React/Redux/React-Native snippets | React code snippets |
| Tailwind CSS IntelliSense | Auto-complete Tailwind |
| Prettier | Code formatting |
| ESLint | Linting JavaScript |
| Error Lens | Inline error highlighting |
Rekomendasi VS Code Settings
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[go]": {
"editor.defaultFormatter": "golang.go"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
Langkah Selanjutnya
Setelah berhasil menjalankan aplikasi, lanjutkan ke:
- Arsitektur Sistem — Pelajari arsitektur aplikasi
- Autentikasi & Otorisasi — Pelajari sistem auth
- API Reference — Lihat semua endpoint API
- Manajemen Kursus — Mulai membuat kursus pertama
Terakhir diperbarui: Juni 2026