A full-stack platform for managing client-submitted articles, with host moderation, built using React, Express, MySQL, and Redis for server-side and client-side caching.
Click to view folder structure
inter-boat/
βββ .gitignore
βββ LICENSE
βββ README.md
βββ requirements.txt
βββ sql_sample_data.txt
βββ backend/
β βββ middleware/
β β βββ session.js
β βββ routes/
β β βββ clientRoute.js
β β βββ dataRoute.js
β βββ package.json
β βββ requirements.txt
β βββ server.js
β βββ .env
β βββ redisClient.js
β βββ node_modules/
βββ frontend/
β βββ public/
β βββ src/
β β βββ App.jsx
β β βββ index.css
β β βββ main.jsx
β β βββ components/
β β βββ Add.jsx
β β βββ Client.jsx
β β βββ Edit.jsx
β β βββ Footer.jsx
β β βββ Header.jsx
β β βββ Home.jsx
β β βββ Host.jsx
β β βββ LoadingSpinner.jsx
β β βββ Login.jsx
β β βββ NotFoundPage.jsx
β β βββ Signup.jsx
β β βββ StatusFilter.jsx
β βββ index.html
β βββ package.json
β βββ requirements.txt
β βββ vite.config.js
β βββ eslint.config.js
β βββ .env
β βββ node_modules/
git clone https://github.com/your-username/inter-boat.git
cd inter-boat
cd backend
npm install
Create a .env
file in the backend/
directory:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USERNAME=your_mysql_user
MYSQL_PASSWORD=your_mysql_password
MYSQL_DATABASE=inter_boat
SESSION_SECRET=your_session_secret
EXPRESS_PORT=8000
FRONTEND_URL=http://localhost:5173
REDIS_URL=redis://localhost:6379
- Create the database and tables using the following SQL:
CREATE DATABASE inter_boat;
USE inter_boat;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
role ENUM('host', 'client') NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE articles (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
client_id INT NOT NULL,
submitted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (client_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE TABLE article_status (
id INT AUTO_INCREMENT PRIMARY KEY,
article_id INT NOT NULL,
status ENUM('pending', 'accepted', 'rejected') DEFAULT 'pending',
updated_by INT NOT NULL,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (article_id) REFERENCES articles(id) ON DELETE CASCADE,
FOREIGN KEY (updated_by) REFERENCES users(id)
);
- Optionally, seed with some users and articles using
sql_sample_data.txt
.
sudo apt update
sudo apt install redis-server
sudo systemctl enable redis-server
sudo systemctl start redis-server
redis-cli ping # Should return: PONG
npm run dev
or
npm start
cd ../frontend
npm install
Create a .env
file in the frontend/
directory:
VITE_API_BASE_URL=http://localhost:8000
npm run dev
The app will be available at http://localhost:5173.
- users: Stores user credentials and roles (
host
orclient
) - articles: Stores articles submitted by clients
- article_status: Tracks the status (
pending
,accepted
,rejected
) of each article and who updated it
Backend .env
example:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USERNAME=your_mysql_user
MYSQL_PASSWORD=your_mysql_password
MYSQL_DATABASE=inter_boat
SESSION_SECRET=your_session_secret
EXPRESS_PORT=8000
FRONTEND_URL=http://localhost:5173
REDIS_URL=redis://localhost:6379
Frontend .env
example:
VITE_API_BASE_URL=http://localhost:8000
See backend/package.json
:
- express, cors, dotenv, mysql2, express-session, express-mysql-session
- ioredis, react-icons, nodemon (dev)
- react, react-dom, react-router-dom, axios, tailwindcss
- @tailwindcss/vite, vite, vite-plugin-qrcode, react-icons
- @tanstack/react-query, eslint (dev), @vitejs/plugin-react (dev)
- Client Registration & Login
- Host & Client Dashboards
- Article Submission, Editing, Deletion
- Host Moderation (Accept/Reject/Pending)
- Status Filtering & Article Expansion
- Session-based Authentication
- Responsive UI with TailwindCSS
- Role-based Access Control
- Persistent MySQL-backed Sessions
- Server-side caching with Redis
- Client-side caching with React Query
- Live QR code for dev server (via vite-plugin-qrcode)
- 404 Not Found Page
- Reusable Header & Footer
- Loading Spinners for Data Fetching
- ESLint and code quality tools
- Make sure MySQL and Redis are running and accessible with the credentials you provide.
- Use different browsers or incognito mode to test host and client roles simultaneously.
- For production, use hashed passwords and secure session management.
- Environment files (
.env
) are ignored by git for security.
This project is licensed under the MIT License. See LICENSE for details.
Pull requests and suggestions are welcome! Please open an issue first to discuss what you would like to change.
Enjoy using Inter-Boat!