Platform Snippet Code Indonesia

ManzxyCodes

by @manzxy

Platform snippet code open untuk developer Indonesia.
Simpan, share, dan temukan kode siap pakai — gratis selamanya.

Mengecek koneksi database…
Buka App Lihat Docs API Kontak Owner
Snippets
Total Likes
Total Views
5Languages
SCROLL DOWN
contact

Hubungi Owner

Ada pertanyaan, bug report, atau mau kolaborasi? Hit up Manzxy lewat salah satu kanal di bawah.

✈️
Telegram
@manzxy
Untuk diskusi panjang, kolaborasi project, atau gabung channel update.
Online hampir setiap hari
Buka Telegram
📧
Gmail
manzxy@gmail.com
Untuk keperluan formal, security report, atau partnership inquiry.
Dibalas dalam 24 jam
Kirim Email
api reference

Dokumentasi API

Base URL: https://manzxy.biz.id/api
Semua response dalam format application/json

GET/api/snippets
Ambil semua snippet
Public endpoint — tidak butuh auth. Snippet diurutkan terbaru dulu. Field snippet_key_hash tidak disertakan.
Response Fields
idnumberID unik snippet (bigserial)
created_atstringTimestamp ISO 8601
authorstringNama/username penulis
titlestringJudul snippet
descriptionstringDeskripsi singkat
languagestringJavaScript | TypeScript | Python | PHP | Go
tagsstring[]Array tag, contoh: ["fetch","async"]
codestringIsi kode snippet
likesnumberJumlah like
viewsnumberJumlah view
curl
curl https://manzxy.biz.id/api/snippets
200 OK
[
  {
    "id": 1,
    "created_at": "2026-03-15T10:00:00Z",
    "author": "manzxy",
    "title": "Fetch Retry",
    "description": "Auto-retry fetch dengan exponential backoff",
    "language": "JavaScript",
    "tags": ["fetch", "async"],
    "code": "async function fetchRetry...",
    "likes": 12,
    "views": 87
  }
]
POST/api/snippets
Like / View counter
Rate limit: view — 1x per IP per snippet per 10 menit. like/unlike — 1x per IP per snippet per 5 menit.
Body Parameters
actionreqstring"like" | "unlike" | "view"
idreqnumberID snippet yang ditarget
javascript
fetch('https://manzxy.biz.id/api/snippets', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ action: 'like', id: 1 })
})
200 OK — like/unlike
{ "likes": 13 }
200 OK — view
{ "views": 88 }
429 — Rate Limited
{ "error": "Terlalu cepat, tunggu sebentar", "likes": 13 }
POST/api/snippet-create
Upload snippet baru
snippetKey di-hash SHA-256 + salt sebelum disimpan. Simpan key asli — tidak bisa dipulihkan dari DB!
Rate limit: 10 request per menit per IP. Input max body 100kb.
Body Parameters
authorreqstringUsername/nama penulis (max 50 char)
titlereqstringJudul snippet (max 120 char)
descriptionreqstringDeskripsi singkat (max 500 char)
codereqstringIsi kode snippet (max 50.000 char)
snippetKeyreqstringKey pribadi 3–7 karakter untuk edit/hapus
languageoptstringJavaScript | TypeScript | Python | PHP | Go (default: JavaScript)
tagsoptstringPisah koma: "fetch, async, api" (max 10 tag)
curl
curl -X POST https://manzxy.biz.id/api/snippet-create \
  -H 'Content-Type: application/json' \
  -d '{
    "author": "manzxy",
    "title": "Fetch Retry",
    "description": "Auto-retry fetch dengan backoff",
    "language": "JavaScript",
    "tags": "fetch, async, utility",
    "code": "async function fetchRetry(url, n=3) {...}",
    "snippetKey": "abc12"
  }'
201 Created
{ "ok": true }
400 — Validasi Gagal
{
  "errors": {
    "author": "Wajib diisi",
    "snippetKey": "Key harus 3–7 karakter"
  }
}
PUT/api/snippet-action
Edit snippet
Butuh snippetKey asli ATAU session admin cookie (mzx_token). Minimal satu field opsional harus diisi.
Body Parameters
idreqnumberID snippet yang diedit
snippetKeyreq*stringKey asli waktu upload (*tidak perlu jika admin)
titleoptstringJudul baru (max 120 char)
descriptionoptstringDeskripsi baru (max 500 char)
languageoptstringJavaScript | TypeScript | Python | PHP | Go
tagsoptstringTags baru, pisah koma
codeoptstringKode baru (max 50.000 char)
200 OK
{ "ok": true }
403 — Key Salah
{ "error": "Key salah!" }
DELETE/api/snippet-action
Hapus snippet
Penghapusan bersifat permanen dan tidak bisa dibatalkan!
Body Parameters
idreqnumberID snippet yang dihapus
snippetKeyreq*stringKey asli (*tidak perlu jika admin)
curl
curl -X DELETE https://manzxy.biz.id/api/snippet-action \
  -H 'Content-Type: application/json' \
  -d '{"id": 1, "snippetKey": "abc12"}'
200 OK
{ "ok": true }
GET/api/health
Status server
Gunakan endpoint ini untuk monitoring uptime server.
200 OK
{
  "status":  "ok",
  "app":     "ManzxyCodes",
  "version": "1.0.0",
  "env":     "production",
  "uptime":  "3600s",
  "ts":      "2026-03-15T10:00:00.000Z"
}
Endpoint admin hanya untuk owner. Jangan share credentials.
POST/api/admin-login
Login → set JWT cookie
Rate limit ketat: 3 percobaan per 5 menit per IP. Ada delay 150–350ms saat gagal (anti brute-force).
Body Parameters
usernamereqstringDari env var ADMIN_USERNAME
passwordreqstringPlain password — di-hash SHA-256+salt di server
Jika berhasil, server set cookie mzx_token sebagai HttpOnly, SameSite=Lax. Cookie tidak bisa diakses JS browser. Berlaku 8 jam.
200 OK + Set-Cookie
{ "ok": true }
// Header: Set-Cookie: mzx_token=eyJ...; HttpOnly; SameSite=Lax; Max-Age=28800
401 — Credentials Salah
{ "error": "Username atau password salah" }
429 — Rate Limited
{ "error": "Terlalu banyak request. Coba lagi nanti." }
GET/api/admin-verify
Cek session admin aktif
Cookie mzx_token dikirim otomatis browser jika sudah login. Selalu return 200 — cek nilai admin untuk tahu status.
curl
curl -b "mzx_token=eyJ..." https://manzxy.biz.id/api/admin-verify
200 OK — Session aktif
{ "admin": true }
200 OK — Tidak ada session / expired
{ "admin": false }
POST/api/admin-logout
Logout — hapus cookie
200 OK + Clear-Cookie
{ "ok": true }
// Header: Set-Cookie: mzx_token=; Max-Age=0
INFOAlur Autentikasi Admin
Cara kerja lengkap
flow
// 1. Login
POST /api/admin-login { username, password }
  → server hash password + salt → compare ADMIN_PASSWORD_HASH
  → jika cocok: buat JWT (expire 8h) → Set-Cookie: mzx_token

// 2. Gunakan admin session
PUT /api/snippet-action { id, title, code }
  → browser kirim cookie mzx_token otomatis
  → server verify JWT → bypass snippet key check

// 3. Cek session masih aktif
GET /api/admin-verify
  → { admin: true } jika valid, { admin: false } jika expired

// 4. Logout
POST /api/admin-logout
  → server clear cookie (Max-Age=0)
Base URL sudah set ke manzxy.biz.id. Salin dan langsung pakai.
PYPython Scraper
Fetch + filter + upload + export
python
import requests, json

BASE = "https://manzxy.biz.id"

def get_all():
    r = requests.get(f"{BASE}/api/snippets")
    r.raise_for_status()
    return r.json()

def by_lang(snippets, lang):
    return [s for s in snippets if s["language"] == lang]

def upload(author, title, desc, lang, tags, code, key):
    r = requests.post(f"{BASE}/api/snippet-create", json={
        "author": author, "title": title,
        "description": desc, "language": lang,
        "tags": tags, "code": code, "snippetKey": key
    })
    return r.json()

def delete_snippet(id, key):
    r = requests.delete(f"{BASE}/api/snippet-action",
        json={"id": id, "snippetKey": key})
    return r.json()

if __name__ == "__main__":
    data = get_all()
    print(f"Total: {len(data)} snippets")
    js = by_lang(data, "JavaScript")
    print(f"JS snippets: {len(js)}")
    # Export ke JSON
    with open("snippets.json", "w") as f:
        json.dump(data, f, indent=2, ensure_ascii=False)
JSNode.js Scraper
Fetch + upload + delete
javascript (node 18+)
// node scraper.js
const BASE = 'https://manzxy.biz.id';

async function fetchAll() {
  const r = await fetch(`${BASE}/api/snippets`);
  if (!r.ok) throw new Error(`HTTP ${r.status}`);
  return r.json();
}

async function upload(payload) {
  const r = await fetch(`${BASE}/api/snippet-create`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(payload)
  });
  return r.json();
}

async function deleteSnippet(id, key) {
  const r = await fetch(`${BASE}/api/snippet-action`, {
    method: 'DELETE',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ id, snippetKey: key })
  });
  return r.json();
}

(async () => {
  const all = await fetchAll();
  console.log(`Total: ${all.length}`);
  const top = [...all].sort((a,b) => b.likes - a.likes)[0];
  console.log('Top liked:', top?.title);
})();
PHPPHP Scraper
cURL wrapper lengkap
php
<?php
$BASE = "https://manzxy.biz.id";

function apiGet($url) {
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => ['Accept: application/json']
    ]);
    $body = curl_exec($ch);
    curl_close($ch);
    return json_decode($body, true);
}

function apiPost($url, $data, $method = 'POST') {
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST  => $method,
        CURLOPT_POSTFIELDS     => json_encode($data),
        CURLOPT_HTTPHEADER     => ['Content-Type: application/json']
    ]);
    $body = curl_exec($ch);
    curl_close($ch);
    return json_decode($body, true);
}

// Ambil semua snippet
$snippets = apiGet("$BASE/api/snippets");
echo "Total: " . count($snippets) . " snippets\n";

// Upload snippet baru
$result = apiPost("$BASE/api/snippet-create", [
    "author"     => "manzxy",
    "title"      => "PHP Helper",
    "description"=> "Useful PHP functions",
    "language"   => "PHP",
    "tags"       => "php, utility",
    "code"       => "function helper() {...}",
    "snippetKey" => "mykey"
]);
echo json_encode($result);
Semua response error menyertakan field "error": "pesan error". Error validasi menyertakan "errors": {...}.
2xxSuccess Responses
200OK — Request berhasil, data di-return
201Created — Snippet berhasil dibuat
4xxClient Error Responses
400Bad Request — Field wajib kosong, panjang melebihi batas, atau format tidak valid. Response menyertakan errors object per-field.
401Unauthorized — Credentials admin salah (login).
403Forbidden — Snippet key salah atau tidak diberikan. Ada delay 150–350ms untuk anti brute-force.
404Not Found — Snippet dengan ID tersebut tidak ditemukan di database.
405Method Not Allowed — HTTP method tidak didukung endpoint ini.
429Too Many Requests — Rate limit tercapai. Tunggu sesuai cooldown: 5 menit (like), 10 menit (view), 1 menit (create), 5 menit (login).
5xxServer Error Responses
500Internal Server Error — Error dari server/database. Cek /api/health untuk status server.
Jika ada error 500 berulang, hubungi owner via kontak di atas.
INFORate Limit Summary
create10 request per menit per IP
edit15 request per menit per IP
delete10 request per menit per IP
like1x per 5 menit per IP per snippet
view1x per 10 menit per IP per snippet
login3 percobaan per 5 menit per IP