A simple web application for users to register, log in, and post anonymous confessions or advice. Users can view all posts and like them. Posts are anonymous to the public, using Java Servlets, JDBC, MySQL, and a React/Next.js frontend.
- User registration and login/logout
- Post anonymous confessions or advice (login required)
- View all posts
- Like posts
- Database persistence
Not Included: User profiles, comments, admin moderation, JWT/OAuth.
- Java Servlets
- JDBC
- Relational Database (MySQL)
- HTTP Sessions (for login)
- JSON (REST API)
- React or Next.js
- Fetch API
- Plain CSS
- Git & GitHub
- Postman (API testing)
| Column | Type | Description |
|---|---|---|
| id | INT (PK) | Auto-increment |
| username | VARCHAR | Unique |
| password | VARCHAR | Hashed |
| created_at | TIMESTAMP | Auto |
| Column | Type | Description |
|---|---|---|
| id | INT (PK) | Auto-increment |
| content | TEXT | Confession text |
| likes | INT | Default 0 |
| user_id | INT (FK) | References users |
| created_at | TIMESTAMP | Auto |
| Column | Type | Description |
|---|---|---|
| id | INT (PK) | Auto-increment |
| content | TEXT | Advice text |
| likes | INT | Default 0 |
| user_id | INT (FK) | References users |
| created_at | TIMESTAMP | Auto |
| confession_id | INT (FK) | References confession |
Note: user_id is never exposed in API responses for anonymity.
Base URL: /api
-
POST /auth/register
Request:{ "username": "john", "password": "123456" } -
POST /auth/login (creates HTTP session)
-
POST /auth/logout
-
POST /confessions (login required, create)
-
GET /confessions (get all)
-
POST /confessions/{id}/like (like)
-
POST /advice (login required, create)
-
GET /advice (get all)
-
POST /advice/{id}/like (like)
{
"id": 1,
"content": "I feel lost about my future",
"likes": 3,
"createdAt": "2025-12-20T10:30:00"
}