Enterprise communication platform β CSGY 6083 Spring 2026, Project #2
Sarah Rakhamimov (sr5649) & Kanthimathi Sundararajan (ks8555)
A Slack-like web application backed by a PostgreSQL relational database.
Users can register, create workspaces and channels, post messages, send and respond to invitations, and search message history.
snickr/
βββ backend/ # Node.js + Express REST API
β βββ server.js # Entry point
β βββ db/
β β βββ pool.js # pg connection pool
β β βββ schema.sql # Full schema + seed data
β βββ middleware/
β β βββ auth.js # Session auth guard
β βββ routes/
β βββ auth.js # /api/auth/*
β βββ workspaces.js # /api/workspaces/*
β βββ channels.js # /api/channels/*
β βββ messages.js # /api/messages/*
β βββ invitations.js # /api/invitations/*
β βββ search.js # /api/search
βββ frontend/ # Vanilla JS SPA (served by Express)
βββ index.html
βββ css/main.css
βββ js/
βββ api.js # Fetch wrapper
βββ app.js # Bootstrap + utilities
βββ auth.js
βββ workspaces.js
βββ channels.js
βββ messages.js
βββ invitations.js
βββ search.js
- Node.js v18+
- PostgreSQL v14+
git clone <your-repo-url>
cd snickr/backend
npm installpsql postgres -c "DROP DATABASE snickr;"
psql postgres -c "CREATE DATABASE snickr;"
psql -d snickr -f db/schema.sql# Edit .env with your DB credentials and a session secretnpm run dev # development (nodemon auto-reload)
# or
npm start # productionOpen http://localhost:3000 in your browser.
All demo users have the password: password123
| Username | Role | |
|---|---|---|
| alice | [email protected] | CEO, admin of both workspaces |
| bob | [email protected] | CFO |
| cathy | [email protected] | Product Manager |
| daniel | [email protected] | SysAdmin, admin of ABC_Company |
| ethan | [email protected] | Data Engineer |
| frank | [email protected] | Sales Manager |
| greg | [email protected] | Chairman, admin of ABC_CSuite |
| Feature | Status |
|---|---|
| User registration & login | β |
| Password hashing (bcrypt) | β |
| Session-based authentication | β |
| Create / browse workspaces | β |
| Create channels (public / private / direct) | β |
| Post & view messages | β |
| Invite users to workspaces | β |
| Invite users to channels | β |
| Accept / reject invitations | β |
| Search messages (keyword + workspace filter) | β |
| SQL injection prevention (parameterized queries) | β |
| XSS prevention (input validation + HTML escaping) | β |
| Transactions (workspace/channel creation + invitation acceptance) | β |
| Stored procedures (accept_workspace_invitation, accept_channel_invitation) | β |
| Access control (workspace/channel membership checks) | β |
All database queries use parameterized statements via the pg library's $1, $2, β¦ placeholders. No string concatenation is used for queries. Input is additionally validated with express-validator before reaching the DB layer.
- Server:
express-validatorsanitizes and escapes all user inputs before they're stored. - Client: all user-generated content is rendered through the
escapeHtml()utility, which escapes&,<,>,", and'before insertion into the DOM.
Multi-step operations (creating a workspace and auto-enrolling the creator, accepting an invitation and adding the member) are wrapped in explicit BEGIN / COMMIT / ROLLBACK transactions to ensure consistency under concurrent usage.
| Method | Path | Description |
|---|---|---|
| POST | /api/auth/register |
Register a new user |
| POST | /api/auth/login |
Login |
| POST | /api/auth/logout |
Logout |
| GET | /api/auth/me |
Get current session user |
| Method | Path | Description |
|---|---|---|
| GET | /api/workspaces |
List user's workspaces |
| POST | /api/workspaces |
Create workspace |
| GET | /api/workspaces/:wID |
Workspace details + members |
| Method | Path | Description |
|---|---|---|
| GET | /api/channels/workspace/:wID |
List accessible channels |
| POST | /api/channels |
Create channel |
| GET | /api/channels/:cID |
Channel details + members |
| POST | /api/channels/:cID/join |
Join a public channel |
| Method | Path | Description |
|---|---|---|
| GET | /api/messages/:cID |
Get messages (paginated) |
| POST | /api/messages/:cID |
Post a message |
| Method | Path | Description |
|---|---|---|
| GET | /api/invitations/pending |
Get pending invitations |
| POST | /api/invitations/workspace |
Invite user to workspace |
| POST | /api/invitations/channel |
Invite user to channel |
| POST | /api/invitations/workspace/:wiID/respond |
Accept/reject workspace invite |
| POST | /api/invitations/channel/:ciID/respond |
Accept/reject channel invite |
| Method | Path | Description |
|---|---|---|
| GET | /api/search?q=keyword&wID=1 |
Search messages |
See backend/db/schema.sql for the full DDL, stored procedures, indexes, and seed data.
Key tables: Member, Workspace, WorkspaceMember, Channel, ChannelMember, Message, WorkspaceInvitation, ChannelInvitation
Academic project β CSGY 6083 NYU, Spring 2026.