commit 7cb1ebafe0f90f1743ba4673828538ae76fb5d3d Author: Gilang Aryo Date: Fri Nov 27 16:47:48 2026 +0700 init: pusat bantuan tumbuhin diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e301876 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +.next +.source +.git +*.log diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..50225f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +node_modules +.next +.source +out +next-env.d.ts +*.log +.env*.local diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5c28567 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +# ---------- Install & build ---------- +FROM node:22-alpine AS builder +WORKDIR /app + +COPY . . +# postinstall menjalankan `fumadocs-mdx` (butuh source.config.ts & content/) +RUN npm ci || npm install + +ENV NEXT_TELEMETRY_DISABLED=1 +ARG SITE_URL +ENV SITE_URL=${SITE_URL} +RUN npm run build + +# ---------- Runtime (image kecil) ---------- +FROM node:22-alpine AS runner +WORKDIR /app + +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 +ENV PORT=3000 +ENV HOSTNAME=0.0.0.0 + +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder /app/public ./public + +EXPOSE 3000 +CMD ["node", "server.js"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b94978 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ +# Pusat Bantuan Tumbuhin POS + +Situs dokumentasi/bantuan Tumbuhin POS, dibangun dengan **Next.js + Fumadocs**, dengan dashboard writer **Decap CMS** yang menyimpan artikel ke **Gitea**. + +## Struktur + +``` +app/ + docs/[[...slug]]/page.tsx halaman artikel (+ metadata SEO & JSON-LD) + docs/layout.tsx sidebar + daftar isi (Fumadocs) + api/search/route.ts pencarian bawaan + sitemap.ts, robots.ts SEO otomatis +content/docs/ 📝 SEMUA ARTIKEL (.mdx) + memulai/ + meta.json urutan menu sidebar + cara-login.mdx +public/ + images/docs/ 🖼️ gambar artikel + admin/ dashboard Decap CMS (/admin) +Dockerfile untuk deploy di Dokploy +``` + +## Menjalankan di laptop + +```bash +npm install +npm run dev +``` + +Buka http://localhost:3000/docs + +## Menambah artikel (manual) + +1. Buat file `.mdx` di folder kategori, misalnya `content/docs/memulai/lupa-password.mdx`. +2. Isi front matter: + + ```mdx + --- + title: Cara Reset Password Tumbuhin POS + description: Panduan mengganti password akun Tumbuhin POS yang lupa. + --- + + Isi artikel... (subjudul mulai dari ##) + ``` + +3. Gambar disimpan di `public/images/docs/` dan dipanggil dengan `/images/docs/nama-file.png`. +4. Commit & push → Dokploy otomatis build → artikel tayang dan masuk sitemap. + +Kategori baru = folder baru di `content/docs/` + file `meta.json`. + +> Catatan MDX: komentar ditulis `{/* ... */}`, bukan ``. + +## Dashboard writer (Decap CMS + Gitea) + +1. Di Gitea: **Settings → Applications → OAuth2 Applications → buat baru** + - Redirect URI: `http://localhost:3000/admin/` (test) atau `https://bantuan.tumbuhindigital.com/admin/` (produksi) + - **Hilangkan centang "Confidential Client"** +2. Salin **Client ID** ke `public/admin/config.yml` → `app_id`. +3. Sesuaikan `repo`, `base_url`, dan `api_root` di file yang sama. +4. Buka `/admin` dan login dengan akun Gitea (akun harus punya akses Write ke repo). + +> Login Decap butuh *secure context*: jalankan di `http://localhost` atau domain **HTTPS**. Domain `http://...traefik.me` tidak akan bisa login. + +## Deploy di Dokploy + +1. Push repo ini ke Gitea. +2. Dokploy → **Settings → Git Providers → Add Gitea**. +3. **Create Application** → pilih repo → Build Type: **Dockerfile**. +4. Environment: `SITE_URL=https://bantuan.tumbuhindigital.com` (juga sebagai Build Arg). +5. Domain: `bantuan.tumbuhindigital.com`, port `3000`, HTTPS aktif. +6. Aktifkan **Auto Deploy**. +7. Daftarkan domain di Google Search Console dan submit `/sitemap.xml`. + +## SEO yang sudah otomatis + +- Title & description per artikel dari front matter +- Canonical URL & Open Graph +- Structured data JSON-LD (`TechArticle`) +- `sitemap.xml` (semua artikel otomatis masuk) +- `robots.txt` (memblokir `/admin` dan `/api`) +- Semua halaman statis (SSG) +- Redirect slug lama → baru: tambahkan di `next.config.mjs` bagian `redirects()` diff --git a/app/api/search/route.ts b/app/api/search/route.ts new file mode 100644 index 0000000..6e94418 --- /dev/null +++ b/app/api/search/route.ts @@ -0,0 +1,5 @@ +import { createFromSource } from 'fumadocs-core/search/server'; +import { source } from '@/lib/source'; + +// Pencarian bawaan (gratis, tanpa Algolia) +export const { GET } = createFromSource(source); diff --git a/app/docs/[[...slug]]/page.tsx b/app/docs/[[...slug]]/page.tsx new file mode 100644 index 0000000..4edaafe --- /dev/null +++ b/app/docs/[[...slug]]/page.tsx @@ -0,0 +1,69 @@ +import type { Metadata } from 'next'; +import { notFound } from 'next/navigation'; +import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/page'; +import { source } from '@/lib/source'; +import { getMDXComponents } from '@/mdx-components'; +import { SITE_NAME, SITE_URL } from '@/lib/site'; + +type Props = { + params: Promise<{ slug?: string[] }>; +}; + +export default async function Page(props: Props) { + const params = await props.params; + const page = source.getPage(params.slug); + if (!page) notFound(); // status 404 yang benar + + const MDXContent = page.data.body; + + // Structured data (JSON-LD) untuk Google + const jsonLd = { + '@context': 'https://schema.org', + '@type': 'TechArticle', + headline: page.data.title, + description: page.data.description, + inLanguage: 'id-ID', + mainEntityOfPage: `${SITE_URL}${page.url}`, + publisher: { '@type': 'Organization', name: 'Tumbuhin' }, + }; + + return ( + + + + diff --git a/public/images/docs/login-tumbuhin-pos.png b/public/images/docs/login-tumbuhin-pos.png new file mode 100644 index 0000000..756cc64 Binary files /dev/null and b/public/images/docs/login-tumbuhin-pos.png differ diff --git a/source.config.ts b/source.config.ts new file mode 100644 index 0000000..4baa63d --- /dev/null +++ b/source.config.ts @@ -0,0 +1,8 @@ +import { defineConfig, defineDocs } from 'fumadocs-mdx/config'; + +// Semua artikel ada di folder content/docs +export const docs = defineDocs({ + dir: 'content/docs', +}); + +export default defineConfig(); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..80e80c0 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ESNext", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/.source": ["./.source/index.ts"], + "@/*": ["./*"] + }, + "plugins": [{ "name": "next" }] + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["node_modules"] +}