Project sederhana untuk membuat dan menampilkan daftar post menggunakan Next.js (App Router) dan Supabase.
Simple project to create and display posts using Next.js (App Router) and Supabase.
- Preview
- Fitur
- Tech Stack
- Struktur Singkat
- Menjalankan Project di Lokal
- Setup Database Supabase
- Script NPM
- Deploy
Versi ringkas dokumentasi dalam Bahasa Indonesia ada di setiap sub-bagian bertanda "Indonesia".
An English version is included in each section marked "English".
- Menampilkan daftar post dari tabel
posts(urut terbaru). - Menambah post baru dari form input.
- Integrasi client-side ke Supabase dengan
@supabase/supabase-js. - Dibangun dengan Next.js 16 + React 19 + TypeScript.
- Display posts from the
poststable (newest first). - Add a new post from the input form.
- Client-side integration with Supabase using
@supabase/supabase-js. - Built with Next.js 16 + React 19 + TypeScript.
- Next.js 16
- React 19
- TypeScript
- Supabase
- Tailwind CSS 4
app/
page.tsx # Halaman utama + form + list post
lib/
supabase.ts # Inisialisasi Supabase client
- Clone repository ini.
- Install dependency:
npm install- Buat file
.env.locallalu isi:
NEXT_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT_ID.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEYCatatan:
- Alternatif key yang didukung oleh kode saat ini:
NEXT_PUBLIC_SUPABASE_ANON_KEY. - Jangan commit file
.envatau.env.localke repository.
- Jalankan development server:
npm run dev- Buka
http://localhost:3000.
- Clone this repository.
- Install dependencies:
npm install- Create a
.env.localfile and fill it with:
NEXT_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT_ID.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=YOUR_SUPABASE_PUBLISHABLE_KEYNotes:
- Supported alternative key in current code:
NEXT_PUBLIC_SUPABASE_ANON_KEY. - Do not commit
.envor.env.localto the repository.
- Run the development server:
npm run dev- Open
http://localhost:3000.
Pastikan ada tabel posts dengan kolom minimal:
id(number / bigint, primary key)title(text)created_at(timestamp, defaultnow())
Contoh SQL:
create table if not exists public.posts (
id bigint generated always as identity primary key,
title text not null,
created_at timestamp with time zone default now() not null
);Make sure you have a posts table with at least these columns:
id(number / bigint, primary key)title(text)created_at(timestamp, defaultnow())
SQL example:
create table if not exists public.posts (
id bigint generated always as identity primary key,
title text not null,
created_at timestamp with time zone default now() not null
);npm run dev # Jalankan app mode development
npm run build # Build production
npm run start # Jalankan hasil build
npm run lint # Linting dengan ESLintProject ini dapat dideploy ke Vercel dengan menambahkan environment variable Supabase yang sama seperti di lokal.
This project can be deployed to Vercel by adding the same Supabase environment variables used in local development.
