Skip to main content

Local Setup

Prerequisites

  • Go 1.23+
  • Node.js 18+
  • Docker & Docker Compose v2+
  • Git
  • Java 17+ (untuk Core Banking)

1. Clone Repository

git clone https://github.com/bjbsyariah/bjbs-clm.git
cd bjbs-clm

2. Setup Environment

cp .env.example .env
# Edit .env sesuai kebutuhan

3. Start Infrastructure

# Start OpenSearch, PostgreSQL, Keycloak
docker compose up -d opensearch postgres keycloak

# Wait for services to be ready
sleep 30

4. Setup Backend

cd backend

# Install dependencies
go mod download

# Set environment variables
export PORT=8081
export KEYCLOAK_BASE_URL=http://localhost:8080
export KEYCLOAK_REALM=log-monitoring
export KEYCLOAK_CLIENT_ID=backend-api
export OPENSEARCH_BASE_URL=https://localhost:9200
export OPENSEARCH_USERNAME=admin
export OPENSEARCH_PASSWORD=MyStrong@OpenSearch2026!
export OPENSEARCH_SKIP_TLS_VERIFY=true
export DB_HOST=localhost
export DB_PORT=5432
export DB_USER=clm
export DB_PASSWORD=ClmBjbs2024!
export DB_NAME=clm_db

# Run backend
go run ./cmd/api

Backend berjalan di http://localhost:8081

5. Setup Frontend

cd frontend

# Install dependencies
npm install

# Start dev server
npm run dev

Frontend berjalan di http://localhost:3000

6. Setup Core Banking (Optional)

cd core-banking

# Build and run
mvn spring-boot:run

Core Banking berjalan di http://localhost:8080

7. Verify Setup

# Check backend health
curl http://localhost:8081/healthz

# Check frontend
curl http://localhost:3000

# Check OpenSearch
curl -sk https://localhost:9200/_cluster/health

Development Workflow

Backend Development

# Run with hot reload (install air first)
go install github.com/air-verse/air@latest
air

# Or run directly
go run ./cmd/api

Frontend Development

# Run dev server
npm run dev

# Lint
npm run lint

# Type check
npm run typecheck

# Format
npm run format

Build

# Build backend
go build -o bin/api ./cmd/api

# Build frontend
npm run build

Database Migrations

# Run migrations
cd backend
go run ./cmd/migrate up

API Documentation

# Generate swagger docs
cd backend
swag init -g cmd/api/main.go -o docs

# Access Swagger UI
open http://localhost:8081/swagger/

Testing

Backend Tests

cd backend
go test ./...

Frontend Tests

cd frontend
npm test

IDE Setup

VS Code

Recommended extensions:

  • Go
  • ESLint
  • Prettier
  • Tailwind CSS IntelliSense
  • TypeScript Hero

Settings

{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.preferences.importModuleSpecifier": "relative"
}

Next Steps