Skip to content

Commit d8937e5

Browse files
committed
Merge branch 'main' of github.com:CSEC-ASTU/HackScore-AI into frontend-v1
2 parents ad3d23d + fc1bcc3 commit d8937e5

23 files changed

Lines changed: 2959 additions & 77 deletions

File tree

.env.example

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,30 @@ OPENAI_API_KEY=your_openai_api_key_here
1010
# ============================================
1111
# PostgreSQL connection string
1212
# Format: postgresql://user:password@host:port/database
13-
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/hackscore_dev
13+
DATABASE_URL=postgresql://postgres:postgres@localhost:5433/hackscore_dev
1414

1515
# ============================================
1616
# AUTHENTICATION
1717
# ============================================
1818
# Secret key for JWT/session signing (generate with: openssl rand -base64 32)
1919
AUTH_SECRET=your_auth_secret_here
2020

21-
# OAuth Provider Configuration (Google/GitHub)
22-
AUTH_PROVIDER_ID=your_oauth_client_id_here
23-
AUTH_PROVIDER_SECRET=your_oauth_client_secret_here
21+
# Google OAuth Configuration
22+
GOOGLE_CLIENT_ID=your_google_client_id_here
23+
GOOGLE_CLIENT_SECRET=your_google_client_secret_here
24+
25+
# GitHub OAuth Configuration (optional)
26+
GITHUB_CLIENT_ID=your_github_client_id_here
27+
GITHUB_CLIENT_SECRET=your_github_client_secret_here
2428

2529
# ============================================
2630
# APPLICATION
2731
# ============================================
28-
# Base URL for the application
29-
BASE_URL=http://localhost:3000
32+
# Base URL for API server (used for OAuth callbacks)
33+
BASE_URL=http://localhost:4000
34+
35+
# Frontend URL (used for CORS)
36+
FRONTEND_URL=http://localhost:3000
3037

3138
# Node environment
3239
NODE_ENV=development

README.md

Lines changed: 143 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,167 @@
1-
# Turborepo starter
1+
# HackScore-AI
22

3-
This Turborepo starter is maintained by the Turborepo core team.
3+
**Real-Time AI Judging for Hackathon Pitches**
44

5-
## Using this example
5+
HackScore-AI is a chat-based AI judging system that simulates a real hackathon judging panel using multi-agent AI evaluation, providing structured, rubric-driven feedback for hackathon projects.
66

7-
Run the following command:
7+
## 🚀 Project Status
88

9-
```sh
10-
npx create-turbo@latest
11-
```
9+
-**Phase 1: Project Setup & Infrastructure** - Complete
10+
-**Phase 2: Database & Authentication** - Complete
11+
- 🔄 **Phase 3: Backend API Foundation** - In Progress
12+
-**Phase 4: LangGraph Agent System** - Pending
13+
-**Phase 5: Frontend Core** - Pending
14+
15+
See [docs/steps.md](docs/steps.md) for detailed progress tracking.
1216

13-
## What's inside?
17+
## 🏗️ Architecture
1418

15-
This Turborepo includes the following packages/apps:
19+
This is a **pnpm workspace monorepo** managed with **Turborepo**.
1620

1721
### Apps and Packages
1822

19-
- `docs`: a [Next.js](https://nextjs.org/) app
20-
- `web`: another [Next.js](https://nextjs.org/) app
21-
- `@repo/ui`: a stub React component library shared by both `web` and `docs` applications
22-
- `@repo/eslint-config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
23-
- `@repo/typescript-config`: `tsconfig.json`s used throughout the monorepo
23+
- `apps/api` - Express.js backend with Prisma ORM (Port: 4000)
24+
- `apps/web` - Vite + React frontend (Port: 3000)
25+
- `apps/docs` - Next.js documentation site
26+
- `@hackscore/shared` - Shared TypeScript types
27+
- `@hackscore/ui` - shadcn/ui component library
28+
- `@repo/eslint-config` - Shared ESLint configurations
29+
- `@repo/typescript-config` - Shared TypeScript configurations
30+
31+
### Tech Stack
2432

25-
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
33+
**Backend:**
34+
- Node.js + Express + TypeScript
35+
- PostgreSQL + Prisma ORM
36+
- Passport.js (Authentication)
37+
- LangGraph (AI Agent Orchestration)
38+
- OpenAI/Gemini (LLM Provider)
2639

27-
### Utilities
40+
**Frontend:**
41+
- React + Vite + TypeScript
42+
- Tailwind CSS v4
43+
- shadcn/ui components
2844

29-
This Turborepo has some additional tools already setup for you:
45+
**Infrastructure:**
46+
- Docker Compose (PostgreSQL, Redis)
47+
- pnpm workspaces
48+
- Turborepo
3049

31-
- [TypeScript](https://www.typescriptlang.org/) for static type checking
32-
- [ESLint](https://eslint.org/) for code linting
33-
- [Prettier](https://prettier.io) for code formatting
50+
## 🚀 Quick Start
3451

35-
### Build
52+
### Prerequisites
3653

37-
To build all apps and packages, run the following command:
54+
- Node.js 18+
55+
- pnpm 9+
56+
- Docker & Docker Compose
3857

58+
### 1. Clone and Install
59+
60+
```bash
61+
git clone <repository-url>
62+
cd HackScore-AI
63+
pnpm install
3964
```
40-
cd my-turborepo
4165

42-
# With [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation) installed (recommended)
43-
turbo build
66+
### 2. Environment Setup
4467

45-
# Without [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation), use your package manager
46-
npx turbo build
47-
yarn dlx turbo build
48-
pnpm exec turbo build
68+
```bash
69+
# Copy environment template
70+
cp .env.example apps/api/.env
71+
72+
# Generate secure AUTH_SECRET
73+
openssl rand -base64 32
74+
75+
# Update apps/api/.env with:
76+
# - DATABASE_URL (already configured)
77+
# - AUTH_SECRET (generated above)
78+
# - GOOGLE_CLIENT_ID (from Google Console)
79+
# - GOOGLE_CLIENT_SECRET (from Google Console)
80+
```
81+
82+
### 3. Start Database
83+
84+
```bash
85+
docker compose up -d postgres
86+
```
87+
88+
### 4. Run Migrations & Seed
89+
90+
```bash
91+
cd apps/api
92+
pnpm prisma migrate dev
93+
pnpm db:seed
94+
```
95+
96+
### 5. Start Development Servers
97+
98+
```bash
99+
# Option 1: Start all apps with Turborepo
100+
cd ../..
101+
pnpm dev
102+
103+
# Option 2: Start API only
104+
cd apps/api
105+
pnpm dev
106+
```
107+
108+
### 6. Verify Setup
109+
110+
```bash
111+
# Check API health
112+
curl http://localhost:4000/health
113+
114+
# Check authentication
115+
curl http://localhost:4000/api/auth/session
116+
```
117+
118+
## 📚 Documentation
119+
120+
- [Project Overview](docs/project-overview.md) - Detailed specification
121+
- [Development Steps](docs/steps.md) - Task tracking
122+
- [Authentication Guide](docs/authentication.md) - Auth setup & API
123+
- [Database Reference](docs/database-reference.md) - Database commands
124+
- [Phase 2 Summary](docs/phase-2-summary.md) - Latest progress
125+
126+
## 🔐 Authentication
127+
128+
The system supports:
129+
130+
- **Google OAuth 2.0** (production-ready)
131+
- **Magic Link Email** (simplified for MVP)
132+
133+
See [Authentication Guide](docs/authentication.md) for setup instructions.
134+
135+
## 💾 Database
136+
137+
### Schema
138+
139+
- `users` - User accounts
140+
- `chat_sessions` - Evaluation sessions
141+
- `messages` - Chat messages (user + agent)
142+
- `uploaded_files` - File uploads metadata
143+
- `session` - Session storage (auto-created)
144+
145+
### Commands
146+
147+
```bash
148+
cd apps/api
149+
150+
# Open Prisma Studio
151+
pnpm db:studio
152+
153+
# Create migration
154+
pnpm prisma migrate dev --name migration_name
155+
156+
# Reset database
157+
pnpm db:reset
158+
159+
# Seed data
160+
pnpm db:seed
49161
```
50162

163+
See [Database Reference](docs/database-reference.md) for more commands.
164+
51165
You can build a specific package by using a [filter](https://turborepo.dev/docs/crafting-your-repository/running-tasks#using-filters):
52166

53167
```

apps/api/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
# Keep environment variables out of version control
3+
.env
4+
5+
/src/generated/prisma

apps/api/package.json

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,46 @@
88
"build": "tsc",
99
"start": "node dist/index.js",
1010
"check-types": "tsc --noEmit",
11-
"lint": "eslint ."
11+
"lint": "eslint .",
12+
"db:migrate": "prisma migrate dev",
13+
"db:seed": "tsx prisma/seed.ts",
14+
"db:reset": "prisma migrate reset --force",
15+
"db:studio": "prisma studio"
16+
},
17+
"prisma": {
18+
"seed": "tsx prisma/seed.ts"
1219
},
1320
"dependencies": {
14-
"express": "^4.21.2",
21+
"@hackscore/shared": "workspace:*",
22+
"@prisma/adapter-pg": "^7.3.0",
23+
"@prisma/client": "^7.3.0",
24+
"@types/connect-pg-simple": "^7.0.3",
25+
"bcrypt": "^6.0.0",
26+
"connect-pg-simple": "^10.0.0",
1527
"cors": "^2.8.5",
1628
"dotenv": "^16.4.7",
17-
"@hackscore/shared": "workspace:*"
29+
"express": "^4.21.2",
30+
"express-session": "^1.19.0",
31+
"jsonwebtoken": "^9.0.3",
32+
"passport": "^0.7.0",
33+
"passport-google-oauth20": "^2.0.0",
34+
"passport-local": "^1.0.0",
35+
"pg": "^8.17.2"
1836
},
1937
"devDependencies": {
20-
"@types/express": "^5.0.0",
21-
"@types/cors": "^2.8.17",
22-
"@types/node": "^22.10.5",
23-
"@repo/typescript-config": "workspace:*",
2438
"@repo/eslint-config": "workspace:*",
39+
"@repo/typescript-config": "workspace:*",
40+
"@types/bcrypt": "^6.0.0",
41+
"@types/cors": "^2.8.17",
42+
"@types/express": "^5.0.0",
43+
"@types/express-session": "^1.18.2",
44+
"@types/jsonwebtoken": "^9.0.10",
45+
"@types/node": "^22.15.3",
46+
"@types/passport": "^1.0.17",
47+
"@types/passport-google-oauth20": "^2.0.17",
48+
"@types/passport-local": "^1.0.38",
49+
"@types/pg": "^8.16.0",
50+
"prisma": "^7.3.0",
2551
"tsx": "^4.19.2",
2652
"typescript": "5.9.2"
2753
}

apps/api/prisma.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This file was generated by Prisma, and assumes you have installed the following:
2+
// npm install --save-dev prisma dotenv
3+
import "dotenv/config";
4+
import { defineConfig } from "prisma/config";
5+
6+
export default defineConfig({
7+
schema: "prisma/schema.prisma",
8+
migrations: {
9+
path: "prisma/migrations",
10+
},
11+
datasource: {
12+
url: process.env["DATABASE_URL"],
13+
},
14+
});
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
-- CreateTable
2+
CREATE TABLE "users" (
3+
"id" TEXT NOT NULL,
4+
"email" TEXT NOT NULL,
5+
"auth_provider" TEXT NOT NULL,
6+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
7+
8+
CONSTRAINT "users_pkey" PRIMARY KEY ("id")
9+
);
10+
11+
-- CreateTable
12+
CREATE TABLE "chat_sessions" (
13+
"id" TEXT NOT NULL,
14+
"user_id" TEXT NOT NULL,
15+
"title" TEXT NOT NULL,
16+
"status" TEXT NOT NULL DEFAULT 'evaluating',
17+
"final_score" DOUBLE PRECISION,
18+
"verdict" TEXT,
19+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
20+
21+
CONSTRAINT "chat_sessions_pkey" PRIMARY KEY ("id")
22+
);
23+
24+
-- CreateTable
25+
CREATE TABLE "messages" (
26+
"id" TEXT NOT NULL,
27+
"chat_session_id" TEXT NOT NULL,
28+
"role" TEXT NOT NULL,
29+
"subtype" TEXT NOT NULL,
30+
"content" JSONB NOT NULL,
31+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
32+
33+
CONSTRAINT "messages_pkey" PRIMARY KEY ("id")
34+
);
35+
36+
-- CreateTable
37+
CREATE TABLE "uploaded_files" (
38+
"id" TEXT NOT NULL,
39+
"chat_session_id" TEXT NOT NULL,
40+
"filename" TEXT NOT NULL,
41+
"mime_type" TEXT NOT NULL,
42+
"storage_url" TEXT NOT NULL,
43+
"extracted_text" TEXT NOT NULL,
44+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
45+
46+
CONSTRAINT "uploaded_files_pkey" PRIMARY KEY ("id")
47+
);
48+
49+
-- CreateIndex
50+
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
51+
52+
-- CreateIndex
53+
CREATE INDEX "chat_sessions_user_id_idx" ON "chat_sessions"("user_id");
54+
55+
-- CreateIndex
56+
CREATE INDEX "chat_sessions_status_idx" ON "chat_sessions"("status");
57+
58+
-- CreateIndex
59+
CREATE INDEX "messages_chat_session_id_idx" ON "messages"("chat_session_id");
60+
61+
-- CreateIndex
62+
CREATE INDEX "messages_created_at_idx" ON "messages"("created_at");
63+
64+
-- CreateIndex
65+
CREATE INDEX "uploaded_files_chat_session_id_idx" ON "uploaded_files"("chat_session_id");
66+
67+
-- AddForeignKey
68+
ALTER TABLE "chat_sessions" ADD CONSTRAINT "chat_sessions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
69+
70+
-- AddForeignKey
71+
ALTER TABLE "messages" ADD CONSTRAINT "messages_chat_session_id_fkey" FOREIGN KEY ("chat_session_id") REFERENCES "chat_sessions"("id") ON DELETE CASCADE ON UPDATE CASCADE;
72+
73+
-- AddForeignKey
74+
ALTER TABLE "uploaded_files" ADD CONSTRAINT "uploaded_files_chat_session_id_fkey" FOREIGN KEY ("chat_session_id") REFERENCES "chat_sessions"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Please do not edit this file manually
2+
# It should be added in your version-control system (e.g., Git)
3+
provider = "postgresql"

0 commit comments

Comments
 (0)