Skip to content

Commit b701bc1

Browse files
authored
Merge pull request #1 from Sachinchaurasiya360/main
Picture is getting uploaded crop is getting failed,
2 parents f1d10e8 + 8611468 commit b701bc1

216 files changed

Lines changed: 13481 additions & 11193 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# InternHack · root environment template (Docker Compose + reference for local dev)
2+
#
3+
# Quick start:
4+
# cp .env.example .env
5+
# Fill in at least JWT_SECRET plus any OAuth/API keys you need.
6+
# docker compose up --build
7+
#
8+
# Redis is intentionally not documented here — InternHack does not use Redis yet.
9+
#
10+
11+
# ── Docker Compose: PostgreSQL ─────────────────────────────────────────
12+
POSTGRES_USER=postgres
13+
POSTGRES_PASSWORD=postgres
14+
POSTGRES_DB=internhack
15+
16+
# Used by docker compose compose-time interpolation (healthchecks, URLs).
17+
# The server container also receives DATABASE_URL from docker-compose.yml (postgres hostname).
18+
19+
# ── Database (required) ────────────────────────────────────────────────
20+
# Non-Docker / host Node: keep localhost here. Compose overrides this inside the API container.
21+
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/internhack
22+
23+
# ── Server (minimum boot: DATABASE_URL + JWT_SECRET in server/src/index.ts) ──
24+
JWT_SECRET=
25+
26+
DODO_PAYMENTS_API_KEY=
27+
DODO_PAYMENTS_WEBHOOK_KEY=
28+
DODO_PAYMENTS_ENVIRONMENT=live_mode
29+
DODO_PRODUCT_ID_MONTHLY=
30+
DODO_PRODUCT_ID_YEARLY=
31+
ADZUNA_APP_ID=
32+
ADZUNA_APP_KEY=
33+
GEMINI_API_KEY=
34+
AWS_REGION=
35+
AWS_ACCESS_KEY_ID=
36+
AWS_SECRET_ACCESS_KEY=
37+
AWS_S3_BUCKET=
38+
CALENDLY_URL=
39+
VITE_API_URL=
40+
ALLOWED_ORIGINS=http://localhost:5173
41+
GOOGLE_CLIENT_ID=
42+
RESEND_API_KEY=
43+
EMAIL_FROM=
44+
GROQ_API_KEY=
45+
OPENROUTER_API_KEY=
46+
CODESTRAL_API_KEY=
47+
JUDGE0_RAPIDAPI_KEY_1=
48+
JUDGE0_RAPIDAPI_KEY_2=
49+
JUDGE0_RAPIDAPI_KEY_3=
50+
JUDGE0_RAPIDAPI_KEY_4=
51+
INBOUND_FORWARD_TO=
52+
RESEND_WEBHOOK_SECRET=
53+
CLAUDE_API=
54+
EXA_API_KEY=
55+
EXTERNAL_JOB_API_KEY=
56+
# LeetCode import server flag — false to disable (default: enabled)
57+
LEETCODE_IMPORT_ENABLED=true
58+
59+
# ── Client (Vite · exposed to the browser — prefix required) ────────────
60+
VITE_GOOGLE_CLIENT_ID=
61+
VITE_DODO_MODE=test_mode
62+
# LeetCode import client flag — set to false to disable (default: enabled)
63+
VITE_LEETCODE_IMPORT_ENABLED=true

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
typecheck-client:
10+
name: Typecheck Client
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
cache: "npm"
20+
cache-dependency-path: client/package-lock.json
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
working-directory: client
25+
26+
- name: Run TypeScript check
27+
run: npx tsc --noEmit
28+
working-directory: client
29+
30+
typecheck-server:
31+
name: Typecheck Server
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 20
40+
cache: "npm"
41+
cache-dependency-path: server/package-lock.json
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
working-directory: server
46+
47+
- name: Generate Prisma client
48+
run: npx prisma generate --schema=src/database/prisma/schema
49+
working-directory: server
50+
51+
- name: Run TypeScript check
52+
run: npx tsc --noEmit
53+
working-directory: server
54+
55+
lint-client:
56+
name: Lint Client
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Setup Node.js
62+
uses: actions/setup-node@v4
63+
with:
64+
node-version: 20
65+
cache: "npm"
66+
cache-dependency-path: client/package-lock.json
67+
68+
- name: Install dependencies
69+
run: npm ci
70+
working-directory: client
71+
72+
- name: Run ESLint
73+
run: npx eslint . --ext .ts,.tsx
74+
working-directory: client

AGENTS.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# InternHack, Codex Instructions
2+
3+
## Project Overview
4+
InternHack is a full-stack internship/career platform for students with AI-powered tools, learning modules, and recruiter features.
5+
6+
## Quick Start
7+
- **Server:** `cd server && npm run dev` (runs `tsx watch src/index.ts`)
8+
- **Client:** `cd client && npm run dev` (Vite on port 5173)
9+
- **Migrations:** Must run from `server/src/database/`, that's where `prisma.config.ts` lives
10+
11+
## Repo Map
12+
**Always read `.Codex/REPO_MAP.md` before any editing task.** It maps every module, route, model, and component.
13+
14+
## Stack
15+
- **Client:** React 18 + Vite 7 + TailwindCSS 4 + React Router 7 + Framer Motion + Zustand + React Query
16+
- **Server:** Express 5 + TypeScript 5 + Prisma 7 + PostgreSQL
17+
- **AI:** Google Gemini (`gemini-2.5-flash-lite`)
18+
- **Auth:** JWT in `Authorization: Bearer <token>` header; Zustand auth store on client
19+
- **Payments:** dodo payment
20+
- **Storage:** AWS S3 with local fallback
21+
22+
## Code Style Rules
23+
24+
### TailwindCSS v4
25+
- Use canonical TW v4 classes only
26+
- No `bg-gradient-*` shorthand, use `bg-linear-to-*` instead
27+
- No arbitrary bracket sizes like `text-[17px]`, use standard scale classes
28+
- No gradient backgrounds on icons, use flat color or bare colored icons
29+
30+
### UI Conventions
31+
- **No pill badges**, do not use `rounded-full` category/section tag pills above page headings. Use `mt-6` on the header wrapper for top spacing instead
32+
- Company avatars: first-letter initial in neutral box, not generic icon
33+
- DRY: no duplicate helpers, shared animation variants per file
34+
35+
### TypeScript
36+
- Strict mode enabled on both client and server
37+
- Use Zod for all server-side validation (see `*.validation.ts` files)
38+
- Client types mirror server models in `client/src/lib/types.ts`
39+
40+
### Module Pattern (Server)
41+
Every server module follows: `<name>.routes.ts``<name>.controller.ts``<name>.service.ts`
42+
- Routes: Express router with middleware chain (auth, role, usage-limit, validation)
43+
- Controller: Handles request/response, calls service, formats errors
44+
- Service: Business logic, DB queries, external API calls
45+
46+
### Premium Gating Pattern
47+
For premium-only features (see `latex-chat.controller.ts`):
48+
```typescript
49+
const user = await prisma.user.findUnique({
50+
where: { id: req.user.id },
51+
select: { subscriptionPlan: true, subscriptionStatus: true },
52+
});
53+
const isPremium =
54+
(user.subscriptionPlan === "MONTHLY" || user.subscriptionPlan === "YEARLY") &&
55+
user.subscriptionStatus === "ACTIVE";
56+
```
57+
58+
### Usage Limits
59+
Daily usage limits are enforced via `usageLimit(action)` middleware.
60+
Actions: `ATS_SCORE`, `COVER_LETTER`, `GENERATE_RESUME`, `JOB_APPLICATION`, `MOCK_INTERVIEW`
61+
Config in `server/src/config/usage-limits.ts`.
62+
63+
## Key Patterns
64+
65+
### Adding a New API Endpoint
66+
1. Create/update `*.routes.ts` with Express router
67+
2. Create/update `*.controller.ts` with request handling
68+
3. Create/update `*.service.ts` with business logic
69+
4. Create/update `*.validation.ts` with Zod schemas
70+
5. Register routes in `server/src/index.ts`
71+
72+
### Adding a New Client Page
73+
1. Create page component in `client/src/module/<area>/<PageName>.tsx`
74+
2. Add lazy import in `client/src/App.tsx`
75+
3. Add route in the appropriate route group (public/student/recruiter/admin)
76+
77+
### AI Integration (Gemini)
78+
- Use `GoogleGenerativeAI` from `@google/generative-ai`
79+
- Model: `gemini-2.5-flash-lite`
80+
- For structured responses with LaTeX content, use XML tags (`<reply>`, `<latex>`) instead of JSON
81+
- Always handle parse failures with fallbacks
82+
83+
### Button Component
84+
Use the reusable `Button` from `client/src/components/ui/button.tsx` (CVA-based) for all new buttons.
85+
- Variants: `primary`, `secondary`, `mono`, `ghost`, `danger`
86+
- Modes: `button` (default), `icon`, `link`
87+
- Sizes: `sm`, `md`, `lg`
88+
- Supports `asChild` (Radix Slot) for composing with `<Link>` or other elements
89+
- Import: `import { Button } from "../../components/ui/button"`
90+
91+
### SEO on Internal Pages
92+
All admin and recruiter pages must include `<SEO title="Page Title" noIndex />`. Public pages use full SEO props.
93+
94+
### File Upload Validation
95+
`DynamicFieldRenderer.tsx` validates file uploads client-side (size ≤ 5 MB, allowed types). Follow this pattern for any new file upload UI.
96+
97+
### React.memo Convention
98+
Wrap list-rendered child components (cards, badges, list items) with `React.memo` when they receive stable props and don't have internal state that changes frequently. Use named function form:
99+
```tsx
100+
export const MyCard = React.memo(function MyCard({ data }: Props) { ... });
101+
```
102+
103+
### Repo Request Approval Flow
104+
Students can suggest repos via `POST /api/opensource/requests`. Admin reviews at `/admin/repo-requests`. On approval, the repo is auto-created and the student gets an email. Routes are in `opensource.routes.ts`, `/requests/*` routes must appear BEFORE `/:id` to avoid route conflicts.
105+
106+
## Do NOT
107+
- Create Prisma migrations without confirming, run from `server/src/database/`
108+
- Use `bg-gradient-*` in TailwindCSS, use `bg-linear-to-*`
109+
- Add `rounded-full` pill badges above headings
110+
- Fabricate new UsageAction enum values, reuse existing ones to avoid migrations
111+
- Push to remote without explicit permission

CODE_OF_CONDUCT.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Code of Conduct
2+
3+
## Our Commitment
4+
5+
We are committed to creating a welcoming, respectful, and inclusive environment for everyone participating in this project.
6+
7+
All contributors, maintainers, and community members are expected to treat each other with kindness and professionalism.
8+
9+
## Expected Behavior
10+
11+
Examples of positive behavior include:
12+
13+
- Being respectful to others
14+
- Using inclusive and professional language
15+
- Accepting constructive feedback
16+
- Helping other contributors
17+
- Collaborating positively
18+
- Respecting different opinions and experiences
19+
- Supporting a healthy open-source community
20+
- Writing clear and meaningful discussions
21+
22+
## Unacceptable Behavior
23+
24+
Examples of unacceptable behavior include:
25+
26+
- Harassment or discrimination
27+
- Offensive comments or personal attacks
28+
- Trolling or insulting behavior
29+
- Sharing private information without permission
30+
- Spamming or disruptive actions
31+
- Using inappropriate language
32+
- Any behavior that creates an unsafe environment
33+
34+
## Responsibilities
35+
36+
Project maintainers are responsible for:
37+
38+
- Enforcing this Code of Conduct
39+
- Reviewing reported issues fairly
40+
- Maintaining a respectful environment
41+
- Taking action against harmful behavior when necessary
42+
43+
## Scope
44+
45+
This Code of Conduct applies to:
46+
47+
- GitHub issues
48+
- Pull requests
49+
- Discussions and comments
50+
- Community interactions related to this project
51+
52+
## Enforcement
53+
54+
Unacceptable behavior may result in:
55+
56+
1. A warning
57+
2. Temporary restriction from participation
58+
3. Permanent removal from the community
59+
60+
The action taken will depend on the severity of the violation.
61+
62+
## Reporting Issues
63+
64+
If you experience or witness unacceptable behavior, please report it to the project maintainers.
65+
66+
All reports will be handled respectfully and confidentially.
67+
68+
## Final Note
69+
70+
By participating in this project, you agree to follow this Code of Conduct and help create a positive and collaborative environment for everyone.

CONTRIBUTING.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ This guide walks you through everything from setting up the project to submittin
4343
| PostgreSQL | 14+ | Database |
4444
| Git | 2.30+ | Version control |
4545

46+
**Docker Compose shortcut:** You can run Postgres + API + client with only Docker by following the README “Docker Compose (alternative)” section (root `.env.example` plus `docker compose up`). That path does **not** use Redis — the app stack is PostgreSQL only.
47+
4648
You'll also need:
4749
- A **Google Cloud Console** project for OAuth (client ID)
4850
- A **Gemini API key** ([free at aistudio.google.com](https://aistudio.google.com/apikey))
@@ -57,14 +59,20 @@ cd InternHack
5759

5860
### Step 2: Set up environment variables
5961

62+
**Docker Compose:** copy the template at the repo root:
63+
6064
```bash
61-
# Server environment
62-
cp server/.env.example server/.env
65+
cp .env.example .env
66+
```
6367

64-
# Client environment
68+
**Classic setup:** separate client and server copies:
69+
70+
```bash
71+
cp server/.env.example server/.env
6572
cp client/.env.example client/.env
6673
```
6774

75+
6876
Open `server/.env` and fill in the **required** values:
6977

7078
```env

0 commit comments

Comments
 (0)