Skip to content

Repository files navigation

HackClub VIT API (hc-api)

Backend REST API service for the HackClub VIT Chennai ecosystem.

Tech Stack

  • Runtime: Node.js v20+
  • Framework: Express.js (ES Modules)
  • Database: PostgreSQL (Neon Serverless)
  • ORM: Prisma v5
  • Package Manager: pnpm
  • Authentication: JWT + Email OTP (nodemailer)

Getting Started

1. Installation

Ensure you have pnpm installed:

pnpm install

2. Environment Configuration

Copy .env.example to .env and fill in your database and auth credentials:

cp .env.example .env

Required environment variables:

  • DATABASE_URL: Neon PostgreSQL pooled connection string (?sslmode=require)
  • JWT_SECRET: Secret token for signing member sessions
  • SMTP_USER / SMTP_PASS: SMTP credentials for OTP mail delivery
  • PORT: Server port (default 5000)
  • FRONTEND_URL: Allowed frontend origin for CORS (e.g. http://localhost:5173)

3. Database Sync & Seed

# Push schema to database
pnpm run db:push

# (Optional) Seed demo accounts and starter data
pnpm run db:seed

# (Optional) Open Prisma Studio database viewer
pnpm run db:studio

4. Running the API Server

# Start the server
pnpm start

# Or with dev hot-reload
pnpm run dev

API will be running at http://localhost:5000.

API Endpoints

  • Health Check: GET /api/health
  • Auth: POST /api/login, POST /api/login/otp/request, POST /api/login/otp/verify, POST /api/signup, POST /api/logout
  • Password Reset: POST /api/auth/forgot-password, POST /api/auth/reset-password
  • User Portal: GET /api/profile, POST /api/projects, GET /api/projects, GET /api/events, GET /api/announcements
  • Admin Portal: GET /api/admin/users, POST /api/admin/users, GET /api/admin/projects, POST /api/admin/projects/:id/approve, GET /api/allowlist
  • Leaderboard: GET /api/leaderboard, GET /api/leaderboard/weekly, GET /api/leaderboard/monthly, GET /api/leaderboard/badges

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages