RESTful API untuk aplikasi forum diskusi yang dibangun menggunakan Node.js, Express.js, dan PostgreSQL. API ini mendukung fitur thread, komentar, balasan, serta sistem like/unlike komentar.
Base URL (HTTPS):
https://forum-api.cloud
- ✅ Autentikasi JWT (Login & Register)
- ✅ Membuat Thread
- ✅ Menambahkan Komentar
- ✅ Membalas Komentar
- ✅ Hapus Komentar & Balasan (soft delete)
- ✅ Like & Unlike Komentar
- ✅ Menampilkan Detail Thread (nested comment & reply)
- ✅ Like Count pada komentar
Project ini menggunakan pendekatan:
- Clean Architecture
- Separation of Concerns
- Layered Structure (Domain, Application, Infrastructure, Interface)
src/
├── Domains/
├── Applications/
├── Infrastructures/
├── Interfaces/
└── Commons/
- Node.js
- Express.js
- PostgreSQL
- JWT (Authentication)
- Bcrypt (Password Hashing)
- Vitest (Testing)
- PM2 (Process Manager)
- NGINX (Reverse Proxy)
- GitHub Actions (CI/CD)
git clone https://github.com/moriaren/forum-api.git
cd forum-apinpm installBuat file .env
PORT=5000
PGHOST=localhost
PGUSER=postgres
PGPASSWORD=yourpassword
PGDATABASE=forum_api
PGPORT=5432
ACCESS_TOKEN_KEY=youraccesstoken
REFRESH_TOKEN_KEY=yourrefreshtokennpm run migrate upnpm run startMenjalankan seluruh test:
npm run testTesting mencakup:
- Unit Test
- Integration Test
- Endpoint Test
Pipeline otomatis menggunakan GitHub Actions:
- Run test saat push
- Deploy ke VPS via SSH
- Pull update dari repository
- Restart server menggunakan PM2
Aplikasi di-deploy menggunakan:
- VPS (Linux)
- NGINX sebagai reverse proxy
- HTTPS (SSL)
- PM2 untuk menjaga uptime
POST /usersPOST /authentications
POST /threadsGET /threads/{threadId}
POST /threads/{threadId}/commentsDELETE /threads/{threadId}/comments/{commentId}
POST /threads/{threadId}/comments/{commentId}/repliesDELETE /threads/{threadId}/comments/{commentId}/replies/{replyId}
PUT /threads/{threadId}/comments/{commentId}/likes