BIAYABLOG

Multi-Service Project: Deploy Backend, Frontend, dan Database dalam Satu Project

Tim Helipod
Diterbitkan 4 menit baca

Aplikasi production jarang hanya satu service. Kamu punya backend API, frontend UI, database, mungkin juga worker dan scheduler.

Di Helipod, kamu bisa deploy semua service dalam satu project: dan mereka otomatis terhubung lewat internal network tanpa konfigurasi manual.

Mengapa Multi-Service?#

1. Separation of Concerns#

Backend dan frontend punya kebutuhan berbeda:

  • Backend: Node.js/FastAPI, butuh akses database
  • Frontend: Next.js/React, butuh akses backend API
  • Database: PostgreSQL/Redis, butuh isolasi data

Memisahkan mereka = lebih mudah di-maintain, scale, dan debug.

2. Independent Scaling#

Frontend mungkin butuh 0.25 vCPU, tapi backend butuh 1 vCPU. Dengan multi-service, kamu bisa atur resource tiap service secara independen.

3. Independent Deployment#

Update frontend tanpa restart backend. Deploy backend tanpa ganggu database. Setiap service punya lifecycle sendiri.

Cara Membuat Multi-Service Project#

1. Buat Project Baru#

Buka Helipod dashboard → New Project → beri nama.

2. Tambah Service Pertama (Database)#

Klik Add Service → pilih PostgreSQL atau Redis.

Atur:

  • Resource: 0.5 vCPU, 1GB RAM
  • Volume: 1GB (untuk data persistent)

3. Tambah Service Kedua (Backend)#

Klik Add Service → pilih GitHub/GitLab → connect repo backend kamu.

Atur:

  • Resource: 0.5 vCPU, 1GB RAM
  • Environment variables:
    DATABASE_URL=postgresql://user:pass@postgres-db:5432/myapp
    REDIS_URL=redis://redis-cache:6379
    

4. Tambah Service Ketiga (Frontend)#

Klik Add Service → pilih GitHub/GitLab → connect repo frontend.

Atur:

  • Resource: 0.25 vCPU, 512MB
  • Environment variables:
    NEXT_PUBLIC_API_URL=https://backend-your-project.helipod.app
    

5. Deploy#

Klik Deploy untuk setiap service. Helipod akan:

  1. Build dan deploy tiap service
  2. Setup internal networking
  3. Generate domain untuk service yang butuh public access

Internal Networking#

Fitur paling powerful dari multi-service project: internal networking.

Cara Kerja#

Setiap service dalam satu project otomatis bisa saling akses menggunakan service name sebagai hostname:

postgres-db     → PostgreSQL container
redis-cache     → Redis container
backend-api     → Backend container
frontend-app    → Frontend container

Contoh Koneksi#

Backend → Database:

DATABASE_URL=postgresql://user:pass@postgres-db:5432/myapp

Backend → Redis:

REDIS_URL=redis://redis-cache:6379

Frontend → Backend:

NEXT_PUBLIC_API_URL=https://backend-api.helipod.app

Keamanan#

Internal network hanya bisa diakses oleh service dalam project yang sama. Service dari project lain tidak bisa akses, ini isolasi otomatis.

Contoh Architecture#

E-commerce App#

┌─────────────────────────────────────────┐
│              Project: MyShop            │
├─────────────────────────────────────────┤
│                                         │
│  ┌─────────────┐  ┌─────────────────┐  │
│  │  Frontend   │  │    Backend      │  │
│  │  Next.js    │──│    Laravel      │  │
│  │  0.25 vCPU  │  │    1 vCPU       │  │
│  └─────────────┘  └────────┬────────┘  │
│                            │            │
│                    ┌───────┴───────┐    │
│                    │               │    │
│              ┌─────┴─────┐  ┌─────┴──┐ │
│              │ PostgreSQL│  │ Redis  │ │
│              │ 0.5 vCPU  │  │0.25 vCPU│ │
│              └───────────┘  └────────┘ │
│                                         │
└─────────────────────────────────────────┘

Monolith + Worker#

┌─────────────────────────────────────────┐
│           Project: MyApp                │
├─────────────────────────────────────────┤
│                                         │
│  ┌─────────────────────────────────┐   │
│  │         Web Server              │   │
│  │    Laravel / Django / Express   │   │
│  │           1 vCPU                │   │
│  └──────────────┬──────────────────┘   │
│                 │                       │
│           ┌─────┴─────┐                │
│           │ PostgreSQL │                │
│           │  0.5 vCPU  │                │
│           └───────────┘                │
│                                         │
│  ┌─────────────────────────────────┐   │
│  │         Worker                  │   │
│  │    Queue processor / Cron       │   │
│  │           0.25 vCPU             │   │
│  └─────────────────────────────────┘   │
│                                         │
└─────────────────────────────────────────┘

Best Practice#

1. Naming Convention#

Gunakan nama yang deskriptif untuk service:

✅ postgres-db, redis-cache, backend-api, frontend-web
❌ db, cache, api, web

2. Resource Allocation#

Service Type Recommended CPU Recommended RAM
Database 0.5 - 1 vCPU 1 - 2GB
Backend API 0.5 - 2 vCPU 0.5 - 2GB
Frontend 0.25 - 0.5 vCPU 256MB - 1GB
Worker 0.25 - 0.5 vCPU 256MB - 512MB

3. Environment Variables#

Simpan secrets di environment variables, bukan di code:

# Database
DATABASE_URL=postgresql://user:pass@postgres-db:5432/myapp

# Cache
REDIS_URL=redis://redis-cache:6379

# API Keys
STRIPE_SECRET_KEY=sk_live_xxx

4. Health Checks#

Pastikan setiap service punya health check endpoint:

// Backend
app.get('/health', (req, res) => res.json({ status: 'ok' }));
# FastAPI
@app.get("/health")
async def health():
    return {"status": "ok"}

Monitoring Multi-Service#

Di Helipod dashboard, kamu bisa:

  1. Lihat status semua service: dalam satu canvas view
  2. Monitor connections: visualisasi koneksi antar service
  3. Check logs per service: filter berdasarkan service name
  4. Monitor metrics: CPU, RAM, network per service
  • Internal Networking: otomatis connect antar service
  • Environment Variables: kelola secrets per service
  • Custom Domain: setiap service bisa punya domain sendiri
  • HPA Autoscaling: scale service tertentu sesuai traffic

Kesimpulan#

Multi-service project memungkinkan kamu membangun aplikasi production yang terdiri dari beberapa service, backend, frontend, database, worker, dalam satu project yang terisolasi dan terhubung otomatis.

Belum coba Helipod? Daftar gratis di helipod.io, tidak perlu kartu kredit.

Punya pertanyaan? Hubungi kami di support@helipod.io atau bergabung ke komunitas di hangar.helipod.io.

Blog

Artikel terkait

Lihat semua

Siap coba Helipod?

Deploy aplikasi kamu sekarang. Gratis, tanpa kartu kredit.
WhatsApp