Skip to content
devnaldoPublic

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

HackMatch

Find teammates for a hackathon, or host a team of your own.

HackMatch is a React and Express team finder. Guests can explore a small upcoming-event preview; an account unlocks event details, teammate search, team browsing, join requests, follows, notifications, and team chat. The interface uses a warm editorial style with light and dark themes.

What works today

  • Public landing page: introduction and up to three upcoming events. Preview cards show only the event name, date, registration deadline, location, and tags; opening details requires sign-in.
  • Accounts and profiles: email/password registration and sign-in, skills, experience, bio, links, availability, and optional uploaded avatar. There is no OAuth sign-in.
  • Hackathons: searchable, filterable, paginated event list with a city filter remembered in localStorage, details pages, an Apply/Official-site link that opens safely in a new tab, and a small cached community-news section when the feed is available.
  • People and teams: search people by name, college, bio, or skill (including custom skills); browse and filter teams; follow people; host a team, set needed skills, and view its roster.
  • Join requests: applicants see their own current request status on the team page. Leaders accept or decline pending requests on their dashboard or the team page. Dashboard teams, requests, and events load and retry independently.
  • Notifications: navbar bell with an unread badge and the latest 20 notifications, a full paginated page, mark-one and mark-all actions, and links to the related page. Notifications are created for join requests, accepted/declined requests, new followers, and new team-chat messages. Chat messages are grouped per team and skipped while that chat is open.
  • Team chat: members-only Chat tab with Socket.IO, JWT-authenticated sockets, server-side membership checks, the last 50 messages plus older history on scroll, plain-text messages up to 1000 characters, and a 5-messages-per-5-seconds limit.
  • Admin panel: /admin for admins with Hackathons, Teams, Users, Admins, and Audit log tabs. Admins can create/edit/hide/delete hackathons, delete teams and users, promote/demote admins, run an import sync, and inspect the last 50 admin actions. Destructive actions confirm first, and the last admin cannot be demoted or deleted.
  • Hackathon feed sync: a server-side import from Hack Club's public upcoming-events JSON every 6 hours, on startup when the last sync is stale, and on demand from the admin panel. Imported rows are deduplicated and admin-created/edited rows are never overwritten.
  • Session handling: expired sessions show one notification and return you to the page you were visiting after sign-in. Logging out clears cached API data and avatars, including pending avatar loads.
  • Accessibility and performance: keyboard-accessible menus, notification bell, and chat; associated form errors; live regions; reduced-motion support; larger touch targets; paginated responses; lazy-loaded admin and chat chunks; and short-lived caches.

Stack

  • Client: React 19, TypeScript, Vite, Tailwind CSS v4, Zustand, React Router, Socket.IO client
  • API: Node.js 20, Express, TypeScript, Prisma, PostgreSQL, Zod, JWT, Socket.IO, node-cron
  • Testing: Vitest, Supertest, Testing Library, Playwright

Run locally

You need Node.js 20+, npm, and PostgreSQL 16 (Docker Compose can provide Postgres).

npm run install-all
docker compose up -d postgres
cp backend/.env.example backend/.env
npm run db:generate
npm run migrate
npm run db:seed
npm run dev

The client runs at http://localhost:3000 and the API at http://localhost:5000. The example DATABASE_URL matches the Docker Compose Postgres service on port 5432; change backend/.env if your local database uses another address or credentials. Set a local JWT_SECRET of at least 32 characters. Seeding is an explicit command; AUTO_SEED defaults to false.

Prisma migrations in backend/prisma/migrations define the schema. The repeatable npm run db:seed command populates 13 demo users (1 admin), 12 hackathons, 12 teams, pending requests and memberships, 7 follows, 10 chat messages, and 6 notifications. Seed data uses fixed IDs and upserts, so it is idempotent and does not overwrite accounts or teams you create later. Demo records are seed data, not schema migrations: run both migration and seed commands on each fresh database. Resetting a database permanently deletes its accounts and teams; only do this to a disposable local database you intend to replace.

Demo accounts

Seeded accounts use the password Demo1234!.

Try Email
Admin admin@hackmatch.dev
Regular user aisha.rahman@hackmatch.dev
Team leader (Neural Sync) priya.menon@example.com
Team leader (CareBridge AI) marcus.lee@example.com
Applicant with a pending request yuki.tanaka@example.com

Priya's Neural Sync team and Marcus's CareBridge AI team have pending requests and seeded chat messages, so you can try the leader and chat flows without creating new accounts.

Demo data on a live site

Use the demo seeder when you want a production-like database to look active for recruiters or testing. It creates 12 non-admin accounts at @demo.hackmatch.dev, 6 teams on upcoming hackathons, sample hackathons only when fewer than three upcoming events exist, team memberships, join requests, follows, and short team-chat messages. It never overwrites or deletes existing rows, and it only adds data for demo accounts.

From the repository root, set a password of at least 12 characters and confirm the run:

DEMO_SEED_CONFIRM=yes DEMO_PASSWORD="<at-least-12-characters>" npm run seed:demo

The command prints the database host and the counts it will create before writing anything. The password is never stored in the repository, hardcoded in the script, or printed. Keep demo credentials separate from any real account password.

To remove the demo data:

DEMO_SEED_CONFIRM=yes npm run seed:demo:remove

The removal command deletes only users whose email ends with @demo.hackmatch.dev. Their teams, memberships, requests, follows, messages, and notifications are removed by the existing cascade rules. It prints how many users it will delete first, and it refuses to run without DEMO_SEED_CONFIRM=yes.

These accounts are fake. Do not use them for real communication, and do not reuse a password from a real account. Never run npm run db:seed against production; that command is for the local development database only. The demo seeder is create-only and safe to repeat, and the removal command only deletes demo-domain accounts. Always confirm the printed database host before approving a run.

Admin setup

The local seed creates one admin (admin@hackmatch.dev) with the demo password above. This account is for local demos only; do not reuse that password in production.

For production, register the person normally, then promote their existing account by email:

cd backend
npm run make-admin -- person@example.com

The script updates User.role to admin. Every admin API request re-reads the role from the database, so an old JWT does not keep admin access after a demotion.

Hackathon and news sources

Source behavior was verified by making real requests while building this feature:

Source Result Decision
Hack Club upcoming events JSON (hackathons.hackclub.com/api/events/upcoming) 200 JSON with upcoming events Used for hackathon imports
dev.to articles API (dev.to/api/articles?tag=hackathon) 200 JSON Used for the community-news list, cached server-side
Kontests API 404 Not used
Brabble Developers API DNS resolution failure Not used
Devpost / MLH public listings HTML listing pages only Not scraped
NewsAPI / GNews Requires a key and has production restrictions Not used

No third-party call is made from the browser. The API fetches, normalizes, and caches external data. A failing source is isolated: it records an error in the sync status but never breaks the app or another source. Imports are deduplicated by source plus externalId, and rows with isEditedByAdmin are skipped.

Tests

npm run build:backend
npm run test:backend
npm --prefix client run lint
npm run build:client
npm run test:client
npm run test:e2e

Backend tests need a separate local Postgres database configured with DATABASE_URL_TEST (see backend/.env.example). Playwright needs a separate local database set with E2E_DATABASE_URL; its default is hackmatch_e2e on localhost:5433, so override it if you use the Compose database on port 5432. Create these test databases before running the suites. Playwright builds, migrates, and seeds its E2E database; it starts the API on port 5000 and the client on port 3100. Stop other servers on those ports first so it does not reuse an older instance. The test configuration rejects Neon/production-style database URLs.

The automated suites cover admin authorization and the last-admin rule, notification ownership/grouping/polling, follow rules and counts, skill normalization, chat membership/rate limits/history, hackathon normalization/dedupe/edit protection/source failure/filters, and two-browser-context chat plus admin and follow/custom-skill journeys.

For backend coverage, run npm --prefix backend run test:coverage. CI runs backend build and coverage tests, client lint/build/tests, and the Playwright journeys on pushes and pull requests.

API overview

Except for the public event preview, cities, news, and auth endpoints, these routes require a JWT.

Method Route Purpose
POST /api/auth/register Create an account
POST /api/auth/login Sign in and receive a JWT
GET /api/auth/me Current user
GET /api/hackathons/upcoming Public upcoming preview (limit, max 6; restricted fields)
GET /api/hackathons Paginated events (search, mode, city, tag, upcoming)
GET /api/hackathons/cities Distinct city options for the filter
GET /api/hackathons/news Cached dev.to hackathon articles
GET /api/hackathons/:id Event details
POST /api/hackathons/:id/register Toggle event registration
GET /api/users Paginated people (search, skill, experience, following)
GET /api/users/:id Profile details with follower counts
GET /api/users/:id/avatar Cached WEBP avatar
PUT /api/users/profile Update profile, avatar, or skills
POST /api/users/:id/follow Follow a person
DELETE /api/users/:id/follow Unfollow a person
GET /api/users/:id/followers Paginated followers
GET /api/users/:id/following Paginated following
GET /api/teams Paginated teams (search, skill, hackathonId, memberId)
POST /api/teams Create a team
GET /api/teams/:id Team details and members
PUT /api/teams/:id Update team (leader)
DELETE /api/teams/:id Disband team (leader)
GET /api/teams/:id/messages Chat history (before, limit; members only)
GET /api/requests Received or sent requests
POST /api/requests Send a join request
GET /api/requests/team/:teamId/mine Current user's latest join-request status only
GET /api/requests/team/:teamId Pending team requests (leader)
PUT /api/requests/:id/respond Accept or decline (leader)
GET /api/notifications Paginated notifications and unread count
GET /api/notifications/unread-count Fresh unread count
PUT /api/notifications/:id/read Mark one as read (owner only)
PUT /api/notifications/read-all Mark all as read
GET /api/admin/hackathons Admin hackathon list (search, pagination)
POST /api/admin/hackathons Create a hackathon
PUT /api/admin/hackathons/:id Edit or hide a hackathon
DELETE /api/admin/hackathons/:id Delete a hackathon
POST /api/admin/hackathons/sync Run the import now
GET /api/admin/hackathons/sync-status Last sync time and errors
GET /api/admin/teams Admin team list
DELETE /api/admin/teams/:id Delete a team
GET /api/admin/users Admin user list
DELETE /api/admin/users/:id Delete a user (last admin blocked)
POST /api/admin/users/:id/promote Promote to admin
POST /api/admin/users/:id/demote Demote to user (last admin blocked)
GET /api/admin/audit Last 50 audit-log entries

All /api/admin/* routes return 403 for authenticated non-admins and 401 without a token.

Socket.IO events

The client connects with the JWT in the handshake auth payload. The server verifies the token and the user on connect.

Direction Event Purpose
Client → server chat:join Join a team room after a server-side membership check
Client → server chat:leave Leave a team room
Client → server chat:message Send { teamId, content } with an acknowledgement callback
Server → client chat:new Broadcast a persisted message to the team room
Server → client chat:error Report validation, membership, or rate-limit errors
Server → client chat:removed Tell clients a team/room is no longer available
Server → client notification:new Push a new notification to the user room

Deployment configuration

The repository includes render.yaml and client build configuration for a Render API and Vercel client, but their presence does not mean the app is deployed.

Production checklist:

  1. Apply the additive migration with the direct (non-pooled) Neon connection string:
    cd backend
    DATABASE_URL="postgresql://...neon.tech/neondb?sslmode=require" npx prisma migrate deploy
  2. Register the first production admin normally, then promote them:
    cd backend
    DATABASE_URL="postgresql://...neon.tech/neondb?sslmode=require" npm run make-admin -- person@example.com
  3. Set these API environment variables on Render:
    • DATABASE_URL — Neon direct connection string with ?sslmode=require
    • JWT_SECRET — at least 32 random characters
    • CLIENT_URL — the Vercel origin, e.g. https://your-app.vercel.app
    • AUTO_SEED=false
    • NODE_ENV=production
  4. Set the client variable on Vercel:
    • VITE_API_URL — the Render API origin, e.g. https://your-service.onrender.com
  5. Redeploy/restart the API after the migration.

Do not put database secrets in client environment variables. Do not run prisma migrate reset or db:seed against production. The import cron runs inside the API process every 6 hours, and the startup check catches up after Render free-tier sleep.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages