Installation Guide
Prerequisites
Section titled “Prerequisites”Rust Toolchain
Section titled “Rust Toolchain”Semua backend services ditulis dalam Rust. Install via rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shsource $HOME/.cargo/env
# Verifikasirustc --version # >= 1.80cargo --versionProtocol Buffers
Section titled “Protocol Buffers”Services berkomunikasi via gRPC. protoc dibutuhkan untuk compile .proto files:
# macOSbrew install protobuf
# Ubuntu/Debianapt-get install -y protobuf-compiler
# Verifikasiprotoc --version # >= 25.xPostgreSQL
Section titled “PostgreSQL”Auth API, Main API, dan Reference API masing-masing punya database sendiri:
# macOSbrew install postgresql@15brew services start postgresql@15
# Buat databasescreatedb waqfuel_authcreatedb waqfuel_maincreatedb waqfuel_referenceAlternatif: gunakan Neon untuk managed PostgreSQL (yang dipakai di production).
Dipakai oleh Auth API untuk caching dan rate limiting:
# macOSbrew install redisbrew services start redis
# Verifikasiredis-cli ping # PONGNode.js
Section titled “Node.js”Frontend clients menggunakan Node.js:
# Install via fnm (recommended)fnm install --ltsfnm use lts-latest
node --version # >= 20.xnpm --versionAWS CLI (Optional)
Section titled “AWS CLI (Optional)”Untuk manage S3 bucket secara lokal:
brew install awscliaws configure # masukkan credentialsSetup Per Service
Section titled “Setup Per Service”Auth API
Section titled “Auth API”cd waqfuel-auth-apigit submodule update --init --recursive
cp .env.example .envEdit .env — key variables:
API_PORT=3001GRPC_PORT=50051DATABASE_URL=postgresql://localhost/waqfuel_auth
# Generate RSA key pair untuk JWTopenssl genrsa -out keys/private.pem 2048openssl rsa -in keys/private.pem -pubout -out keys/public.pem
JWT_PRIVATE_KEY_PATH=keys/private.pemJWT_PUBLIC_KEY_PATH=keys/public.pemJWT_KEY_ID=key-dev-001
# Super admin — di-seed saat pertama kali startupSUPER_ADMIN_EMAIL=admin@waqfuel.comSUPER_ADMIN_PASSWORD=changeme123
# gRPC endpoints service lainGRPC_REFERENCE=localhost:50050GRPC_NOTIF=localhost:50052Jalankan migrations dan start:
# Install sqlx-clicargo install sqlx-cli --features postgres
# Run migrationssqlx migrate run
# Start servicecargo runMain API
Section titled “Main API”cd waqfuel-main-apigit submodule update --init --recursive
cp .env.example .envKey variables:
API_PORT=8081DATABASE_URL=postgresql://localhost/waqfuel_main
# Auth service JWKS endpoint untuk validasi JWTJWKS_AUTH=http://localhost:3001/.well-known/jwks.json
# gRPC auth serviceGRPC_AUTH=localhost:50051
# AWS S3AWS_REGION=ap-southeast-1AWS_ACCESS_KEY_ID=...AWS_SECRET_ACCESS_KEY=...AWS_BUCKET_ASSETS=waqfuel-assets-devsqlx migrate runcargo runNotification API
Section titled “Notification API”cd waqfuel-notif-apicp .env.example .envGRPC_PORT=50052RESEND_API_KEY=re_... # dari resend.comNOREPLY_EMAIL=no-reply@waqfuel.comcargo runReference API
Section titled “Reference API”cd waqfuel-reference-apigit submodule update --init --recursive
cp .env.example .envAPI_PORT=4000GRPC_PORT=50050DATABASE_URL=postgresql://localhost/waqfuel_reference
AWS_ENDPOINT=https://s3.ap-southeast-1.amazonaws.comAWS_BUCKET_ASSETS=waqfuel-assets-devAWS_REGION=ap-southeast-1sqlx migrate run # includes lokasi Indonesia (provinsi, kota, kecamatan, kelurahan)cargo runFrontend Clients
Section titled “Frontend Clients”# Platform Client (admin dashboard)cd waqfuel-platform-clientnpm installcp .env.example .env.localnpm run dev # http://localhost:3000
# Public Websitecd waqfuel-webnpm installcp .env.example .env.localnpm run dev # http://localhost:3000Verifikasi Setup
Section titled “Verifikasi Setup”Setelah semua services running, test endpoint health:
# Reference APIcurl http://localhost:4000/provinces | jq '.[:3]'
# Auth APIcurl http://localhost:3001/.well-known/jwks.json | jq .
# Main APIcurl http://localhost:8081/health | jq .
# Login sebagai super admincurl -X POST http://localhost:3001/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"admin@waqfuel.com","password":"changeme123"}' | jq .access_token