A simple full‑stack web application where users can set a username and post messages to a shared message board. Messages are persisted in a PostgreSQL database and usernames are stored per session using express‑session.
- Set and update a username per session
- Post messages to a public message board
- Messages are stored permanently in PostgreSQL
- Server‑side rendering with EJS
- Session management using express‑session
- Timestamped messages (localized to Toronto time)
Live demo:
👉 https://mini-message-board-oybc.onrender.com/
- Node.js
- Express.js
- EJS
- PostgreSQL
- pg
- express-session
- HTML & CSS
git clone https://github.com/your-username/mini-message-board.git
cd mini-message-boardnpm installCreate a .env file in the root directory with the following values:
POSTGRES_HOST=localhost
POSTGRES_DB=mini_message_board
POSTGRES_USERNAME=your_username
POSTGRES_PASSWORD=your_password
POSTGRES_PORT=5432Run the database seed script to create the table and insert sample data:
node db/populatedb.jsnpm startVisit the app at:
http://localhost:3000
- Open the homepage.
- Set a username (stored in session).
- Click New Message to post a message.
- Messages appear instantly and persist across server restarts.
- You can update your username at any time.
mini-message-board/
├── server.js # App entry point
├── routes/
│ └── indexRouter.js # Express routes
├── controllers/
│ └── indexController.js # Route logic
├── db/
│ ├── pool.js # PostgreSQL connection pool
│ ├── queries.js # SQL queries
│ └── populatedb.js # DB initialization script
├── views/ # EJS templates
│ ├── index.ejs
│ ├── newMessage.ejs
│ ├── newMessageForm.ejs
│ ├── setUserNameForm.ejs
│ └── updateUserNameForm.ejs
├── public/
│ └── styles/ # CSS files
└── README.md
CREATE TABLE messages (
id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
username VARCHAR(225),
message VARCHAR(10000),
added TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
);Aryan Parmar
Computer Science student @ University of Windsor
🔗 LinkedIn: https://www.linkedin.com/in/aryan-parmar-a0634b299/