A React-based web application for managing and tracking scam complaints, integrated with LINE messaging platform.
ScamReport is a comprehensive system for:
- π Collecting scam reports via LINE bot
- π₯ Managing complaints (Admin & Journalist dashboards)
- π¬ Viewing conversation history with complaint titles
- π Analyzing and categorizing scam patterns
- π Role-based access control (Admin, Journalist, Public)
- Node.js 18+
- npm or yarn
- AWS Lambda (deployed)
- PostgreSQL database
# 1. Clone repository
git clone <repository-url>
cd scamreport-frontend
# 2. Install dependencies
npm install
# 3. Start development server
npm run dev
# 4. Open browser
http://localhost:5173scamreport-frontend/
βββ docs/ # π Complete documentation
β βββ lambda/ # Lambda function code
β β βββ lambda-complete.js β Production Lambda
β βββ testing/ # Test scripts
β β βββ test-all-endpoints.mjs
β βββ database/ # Database utilities
β β βββ db-verify-schema.mjs
β βββ archive/ # Old versions
β βββ README.md # Main documentation
β βββ FRONTEND_INTEGRATION.md
β βββ README_LAMBDA.md
βββ src/
β βββ components/ # React components
β βββ pages/ # Page components
β β βββ admin/ # Admin dashboard
β β β βββ AdminHistory.jsx # Conversation history β
β β β βββ AdminDashboard.jsx
β β βββ journalist/ # Journalist dashboard
β β βββ public/ # Public pages
β βββ services/ # API clients
β β βββ complaintApi.js # Lambda API client β
β βββ context/ # React context
β βββ App.jsx # Main app
β βββ main.jsx # Entry point
βββ vite.config.js # Vite configuration β
βββ package.json
βββ README.md # This file
- View all complaints with pagination
- Filter by status, category, urgency
- Assign to journalists
- Track progress
- View LINE chat history
- Display complaint titles in modal
- Message timeline
- User/Admin identification
- Admin: Full access, user management
- Journalist: Assigned complaints, follow-ups
- Public: Submit complaints (via LINE)
- Live complaint status
- Instant message updates
- Dashboard statistics
Create .env file:
# API Configuration
VITE_API_BASE_URL=https://your-lambda-url.lambda-url.us-east-1.on.aws
VITE_REGION=us-east-1
# Development Only - Test Credentials
VITE_TEST_ADMIN_EMAIL=admin@example.com
VITE_TEST_ADMIN_PASSWORD=your-passwordNote: Copy
.env.exampleto.envand fill in your actual values. See.env.examplefor template.
File: vite.config.js
export default defineConfig({
server: {
proxy: {
'^/(table|users|user|connection)': {
target: process.env.VITE_API_BASE_URL || 'https://your-lambda-url.lambda-url.us-east-1.on.aws',
changeOrigin: true,
secure: false
}
}
}
})Note: The actual Lambda URL is configured in
.envfile (not in this config file).
Benefits:
- β No CORS issues in development
- β Simplified API calls
- β Same code for dev and prod
URL: See .env file (not published in documentation for security)
Format:
https://[function-id].lambda-url.[region].on.aws
| Endpoint | Description | Response |
|---|---|---|
GET /table/complaints |
List complaints | { data: [...], pagination: {...} } |
GET /table/complaints/:id |
Get complaint | { data: {...} } |
GET /table/complaints/:id/messages |
Get messages with title | { messages: [...], complaint_title: "..." } |
GET /table/complaints/:id/summary |
Get summary | { summary: {...}, complaint_title: "..." } |
- Complete Documentation - Start here!
- Lambda Deployment - Deploy Lambda
- Frontend Integration - API usage
- Testing Guide - Test scripts
-
Setting Up:
- Read Quick Start
- Configure environment variables
- Set up Vite proxy
-
Development:
- Use API Client in
src/services/complaintApi.js - Follow component structure
- Test with scripts in
docs/testing/
- Use API Client in
-
Deployment:
- Build:
npm run build - Test:
npm run preview - Deploy
dist/folder
- Build:
cd docs/testing
node test-all-endpoints.mjsExpected: β 100% pass rate (14/14 tests)
npm run dev- Navigate to Admin History
- Click a complaint
- Verify:
- β Modal opens
- β Complaint title displays correctly
- β Messages load
- β No console errors
Error:
Access to XMLHttpRequest has been blocked by CORS policy
Solution:
- Check Vite proxy in
vite.config.js - Restart dev server:
npm run dev - Clear browser cache
Symptoms:
- Modal shows "ΰΈ£ΰΈ²ΰΈ’ΰΈ₯ΰΈ°ΰΉΰΈΰΈ΅ΰΈ’ΰΈΰΈΰΈ²ΰΈ£ΰΈͺΰΈΰΈΰΈΰΈ²" instead of actual title
Solution:
- Test Lambda:
cd docs/testing && node test-all-endpoints.mjs - Verify
complaint_titlein response - Redeploy latest Lambda from
docs/lambda/lambda-complete.js
npm run build
# Output: dist/npm run preview
# Open: http://localhost:4173- React 18 - UI framework
- Vite - Build tool
- React Router - Routing
- Axios - HTTP client
- Tailwind CSS - Styling
- AWS Lambda - Serverless API
- PostgreSQL - Database (RDS)
- node-postgres (pg) - Database driver
- AWS RDS - Database hosting
- AWS Lambda - API hosting
- AWS Cognito - Authentication
β Working:
- Complaint management
- Service history tracking
- Message history with titles
- Role-based dashboards
- Lambda API integration
- Database connectivity
- Auto deployment via Vercel
URL: https://scam-report.vercel.app
Lambda API: Configured via environment variables (see .env)
Deployment: Automatic via Vercel
- Push to
mainβ Auto deploy to production - Create PR β Auto preview deployment
See VERCEL_DEPLOYMENT.md for details.
Status: β Production Ready & Deployed
Last Updated: 2025-11-12