~ $ cat work/jicnic.md
Jicnic
Live availability voting for planning a picnic.
Full-stack · 2026BCIT course assignment, built on my own.
- OUTCOME
- Answers appear live for everyone, with its API key kept private
- SCOPE
- Course project
Built with
- Node.js
- Express
- WebSockets
- JavaScript
- OpenWeatherMap API
What it is
Jicnic is a website for planning a picnic with friends. Everyone says which days they can come, and everyone sees each other’s answers the moment they change, without refreshing the page.
I built it to combine several things in one small app: signing in, live updates, and a weather forecast from another service.
What it can do
Vote for each day
For every day, choose Yes or No, or leave it unset. Your own votes are highlighted so you can see what you picked.
Live updates
When anyone votes, every other person with the page open sees it straight away.
Weather forecast
Each day shows the expected high temperature and a weather icon, so you can pick a nice day.
Sign in
Your votes are saved under your name, and the weather forecast only shows while you are signed in.
Private key
The weather service’s secret key never sits in the page. The server hands it only to people who are signed in.
Gentle on the weather service
Forecasts are saved in your browser for a while, so the app does not keep asking for the same thing.
How a request flows
- Browserfetch + WebSocket
- ExpressSessions, bcrypt
- ws serverChange notifications
- OpenWeatherMapKey stays server-side
How it works
- 01
You sign in with a username and password.
- 02
The page asks the server for the latest votes and shows them.
- 03
When you vote, your choice is sent to the server and saved.
- 04
The server sends a short “something changed” message to everyone else who has the page open.
- 05
Each of those pages asks the server for the latest votes again, so they all match.
- 06
Forecasts are fetched with a key the server gives only to signed-in people.
Screenshots
Why
I wanted to combine AJAX, WebSockets, sign-in, and a third-party API in one small app.
What I built
- 01
Built a Node and Express backend with cookie sessions and bcrypt, and a vanilla JavaScript front end using fetch.
- 02
Used WebSocket messages only as a signal to re-fetch, which kept real-time logic separate from data logic.
- 03
Served the OpenWeatherMap key from a sign-in-protected route and cached forecasts to respect rate limits.
The code
// when our client votes, we will send it to all other clients (like a radio (broadcasting it) to them)
wss.on("connection", (ws) => {
ws.on("message", (message) => {
// sending to everyone except the sender
for (const client of wss.clients) {
if (client !== ws && client.readyState === 1) {
client.send(message);
}
}
});
});Outcome
Every connected person sees vote changes immediately, and forecasts quietly disappear when signed out.
The trade-off
WebSocket messages carry no data, only “something changed”. That costs an extra request per update but means there is only one code path for loading votes.
What I learned
Request order and failure states mattered more than the happy path, especially around keeping the API key private.
What I'd fix next
Add multiple events, a “best day” summary, and tests for the vote and socket flow.
