A minimalist Hacker News clone built for vibe coding demonstrations.
- Browse posts with scores and comment counts
- View post details with comments
- Submit new posts (with URL or text content)
- Add comments to posts
- Upvote posts
- SQLite database with seed data
- Hot-reloading for both frontend and backend
- Frontend: React + Vite
- Backend: Node.js + Express
- Database: SQLite (better-sqlite3)
-
Install dependencies:
npm install
-
Run the application:
npm start [PORT_NUMBER]
The PORT_NUMBER parameter determines which ports to use:
- Frontend will run on
3000 + PORT_NUMBER - Backend will run on
8000 + PORT_NUMBER
Examples:
npm startornpm start 0→ Frontend: 3000, Backend: 8000npm start 1→ Frontend: 3001, Backend: 8001npm start 2→ Frontend: 3002, Backend: 8002
- Frontend will run on
-
Access the app: Open your browser to the frontend URL (e.g., http://localhost:3001 if you used
npm start 1) -
Health check (optional):
./healthcheck.sh [PORT_NUMBER]
Run this to verify both frontend and backend are running correctly. Uses the same PORT_NUMBER as the app.
- Returns exit code 0 if all checks pass
- Returns exit code 1 if any check fails
- The database (
backend/database.db) is created and seeded automatically on first run - Hot-reloading is enabled for both frontend (Vite) and backend (nodemon)
- The database persists across hot-reloads - only frontend and backend code changes trigger reloads
- No authentication required - all features are publicly accessible
.
├── backend/
│ ├── server.js # Express API server
│ └── db.js # SQLite database setup & seed data
├── src/
│ ├── App.jsx # Main React component
│ ├── components/ # React components
│ └── *.css # Styling
├── run.js # Startup script
└── package.json # Dependencies & scripts
GET /api- Health check endpoint (returns "Healthy")GET /api/posts- List all postsGET /api/posts/:id- Get post with commentsPOST /api/posts- Create new postPOST /api/posts/:id/comments- Add commentPOST /api/posts/:id/upvote- Upvote post
The healthcheck.sh script performs the following checks:
- ✓ Backend health endpoint returns "Healthy"
- ✓ Frontend server is responding
- ✓ Frontend HTML contains expected content
- ✓ Frontend JavaScript module is loading
- ✓ Frontend-backend connectivity (CORS)
This is useful for CI/CD pipelines, monitoring, or just verifying the app is working correctly.