Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
ea84071
chore(deps): update dependency firebase-admin to v13.6.0 (#405)
renovate[bot] Nov 6, 2025
0b05d56
chore(deps): update dependency sharp to v0.34.5 (#407)
renovate[bot] Nov 6, 2025
26961fc
chore(deps): update typescript-eslint monorepo to v8.46.4 (#409)
renovate[bot] Nov 11, 2025
fb0d6ee
chore(deps): update dependency @types/node to v22.19.1 (#411)
renovate[bot] Nov 12, 2025
f30e333
chore(deps): update dependency mjml to v4.17.0 (#412)
renovate[bot] Nov 14, 2025
3746919
chore(deps): update dependency firebase to v12.6.0 (#413)
renovate[bot] Nov 14, 2025
82fd827
chore(deps): update dependency fast-xml-parser to v5.3.2 (#414)
renovate[bot] Nov 14, 2025
ea7dc4f
chore(deps): update nest monorepo to v11.1.9 (#383)
renovate[bot] Nov 15, 2025
9e3a0bb
chore(deps): update dependency @nestjs/swagger to v11.2.2 (#415)
renovate[bot] Nov 16, 2025
41ff8b2
chore(deps): update dependency mjml to v4.17.1 (#416)
renovate[bot] Nov 18, 2025
334c0ab
chore(deps): update actions/checkout action to v5.0.1 (#417)
renovate[bot] Nov 18, 2025
4364d1c
chore(deps): update dependency @nestjs/swagger to v11.2.3 (#419)
renovate[bot] Nov 19, 2025
55ac134
chore(deps): update dependency @nestjs/cli to v11.0.11 (#421)
renovate[bot] Nov 19, 2025
791be33
chore(deps): update dependency webpack to v5.103.0 (#420)
renovate[bot] Nov 19, 2025
d7f6df2
chore(deps): update dependency @nestjs/cli to v11.0.12 (#422)
renovate[bot] Nov 19, 2025
7d51717
chore(deps): update typescript-eslint monorepo to v8.47.0 (#418)
renovate[bot] Nov 19, 2025
b8ab2d4
chore(deps): update dependency rimraf to v6.1.2 (#423)
renovate[bot] Nov 19, 2025
d8b91b8
chore(deps): update dependency mime-types to v3.0.2 (#424)
renovate[bot] Nov 20, 2025
78de1f6
chore(deps): update dependency @types/lodash to v4.17.21 (#426)
renovate[bot] Nov 22, 2025
455a8b3
chore(deps): update dependency class-validator to v0.14.3 (#427)
renovate[bot] Nov 24, 2025
a0d451b
chore(deps): update typescript-eslint monorepo to v8.48.0 (#428)
renovate[bot] Nov 24, 2025
d31918e
chore(deps): update dependency @nestjs/cli to v11.0.13 (#431)
renovate[bot] Nov 27, 2025
d2880d5
chore(deps): update dependency prettier to v3.7.1 (#432)
renovate[bot] Nov 27, 2025
bfe20fe
chore(deps): update dependency passkit-generator to v3.5.6 (#433)
renovate[bot] Nov 28, 2025
1e8b877
chore(deps): update dependency @nestjs/cli to v11.0.14 (#434)
renovate[bot] Nov 28, 2025
e1e4ccf
chore(deps): update dependency @eslint/eslintrc to v3.3.3 (#435)
renovate[bot] Nov 28, 2025
ffce6f5
chore(deps): update dependency prettier to v3.7.2 (#436)
renovate[bot] Nov 29, 2025
f25d37a
chore(deps): update dependency prettier to v3.7.3 (#437)
renovate[bot] Nov 29, 2025
adb970f
chore(deps): update dependency ts-jest to v29.4.6 (#438)
renovate[bot] Dec 1, 2025
c976691
chore(deps): update dependency @types/express to v5.0.6 (#439)
renovate[bot] Dec 2, 2025
54bce4d
chore(deps): update typescript-eslint monorepo to v8.48.1 (#440)
renovate[bot] Dec 2, 2025
26f3587
chore(deps): update actions/checkout action to v6
renovate[bot] Dec 2, 2025
10395cf
chore(deps): update dependency prettier to v3.7.4 (#441)
renovate[bot] Dec 3, 2025
ceed065
chore(deps): update dependency @types/node to v24
renovate[bot] Dec 3, 2025
316873b
fix(deps): update dependency googleapis to v167
renovate[bot] Dec 4, 2025
1331667
feat: initialize @hackpsu/react-sdk with TypeScript configuration, bu…
kensac Dec 4, 2025
1f9b6ee
chore: exclude 'sdk' directory from build process in tsconfig.build.json
kensac Dec 4, 2025
d4c50d9
feat: implement Apple Auth API with refresh and revoke token function…
kensac Dec 4, 2025
6622dff
feat: add capacity field to location in EventEntityResponse
kensac Dec 4, 2025
eff4383
refactor: remove ExtraCreditAssignmentEntity and update related queri…
kensac Dec 4, 2025
643262b
feat: enhance finance and hackathon entities with new update function…
kensac Dec 4, 2025
54534f3
feat: add drive and mail API modules with hooks and provider functions
kensac Dec 4, 2025
f3a7028
refactor: streamline reservation and scan APIs by removing unused ent…
kensac Dec 4, 2025
eeafe99
feat: implement inventory management API with entities, hooks, and pr…
kensac Dec 4, 2025
33423ac
feat: add inventory and organizer-application API modules with entiti…
kensac Dec 4, 2025
3a80fdf
fix: increase memory limit for build script to prevent build failures
kensac Dec 4, 2025
ef04a06
chore: update version to 0.2.0 in package.json and package-lock.json
kensac Dec 4, 2025
7442f83
chore: update version to 0.2.1 in package.json and package-lock.json
kensac Dec 4, 2025
6262e3a
chore(deps): update dependency mjml to v4.17.2 (#444)
renovate[bot] Dec 4, 2025
5f1d796
Merge pull request #390 from Hack-PSU/renovate/node-24.x
kensac Dec 4, 2025
a206647
Merge pull request #425 from Hack-PSU/renovate/actions-checkout-6.x
kensac Dec 4, 2025
ce3f915
Merge pull request #442 from Hack-PSU/renovate/googleapis-167.x
kensac Dec 4, 2025
d646f83
Merge pull request #443 from Hack-PSU/sdk
kensac Dec 4, 2025
aeac4cc
chore(deps): update dependency @tanstack/react-query to v5.90.12 (#447)
renovate[bot] Dec 4, 2025
fd30397
chore(deps): update dependency jsonwebtoken to v9.0.3 (#445)
renovate[bot] Dec 4, 2025
5cd54de
migration for new registration questions
joeboppell Dec 4, 2025
f98c43b
added registration entity fields for new questions
joeboppell Dec 4, 2025
dea7023
oopsy, mistake with migration
joeboppell Dec 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
IMAGE_NAME: us-east4-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/api-v3/${{ secrets.GCP_PRODUCTION_SERVICE_NAME }}:${{ github.sha }}
steps:
- name: Checkout
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1

- id: 'auth'
name: Authenticate to Google Cloud
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
IMAGE_NAME: us-east4-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/api-v3/${{ secrets.GCP_STAGING_SERVICE_NAME }}:${{ github.sha }}
steps:
- name: Checkout
uses: actions/checkout@v5.0.0
uses: actions/checkout@v6.0.1

- id: 'auth'
name: Authenticate to Google Cloud
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ cloud-sql-proxy
.yarn/*

# Cert
certs/*
certs/*

# SDK Artifacts
sdk/node_modules/
sdk/dist/
24 changes: 24 additions & 0 deletions db/migrations/20251204204114_add_registration_questions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Knex } from "knex";


export async function up(knex: Knex): Promise<void> {
await knex.schema.alterTable("registrations", (table) => {
table.string("excitement").nullable();
table.string("zip_code").nullable();
table.integer("travel_cost").nullable();
table.string("travel_method").nullable();
table.string("travel_additional").nullable();
});
}


export async function down(knex: Knex): Promise<void> {
await knex.schema.alterTable("registrations", (table) => {
table.dropColumn("excitement");
table.dropColumn("zip_code");
table.dropColumn("travel_cost");
table.dropColumn("travel_method");
table.dropColumn("travel_additional");
});
}

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"fast-xml-parser": "^5.2.3",
"firebase": "^12.0.0",
"firebase-admin": "^13.0.2",
"googleapis": "^164.0.0",
"googleapis": "^167.0.0",
"handlebars": "^4.7.8",
"jsonwebtoken": "^9.0.2",
"jwt-decode": "^4.0.0",
Expand Down Expand Up @@ -79,7 +79,7 @@
"@types/luxon": "^3.4.2",
"@types/mock-knex": "^0.4.8",
"@types/multer": "^2.0.0",
"@types/node": "^22.10.5",
"@types/node": "^24.0.0",
"@types/passport-jwt": "^4.0.1",
"@types/sharp": "^0.32.0",
"@types/supertest": "^6.0.2",
Expand All @@ -94,7 +94,7 @@
"rimraf": "^6.0.1",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "29.4.5",
"ts-jest": "29.4.6",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
Expand Down
15 changes: 15 additions & 0 deletions sdk/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Source files (only publish dist/)
**/*.ts
**/*.tsx
!**/*.d.ts

# Config files
tsconfig.json
tsup.config.ts

# Development files
node_modules/
*.log
.DS_Store

# Only publish the dist folder and package files
200 changes: 200 additions & 0 deletions sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
# @hackpsu/react-sdk

Shared React hooks, providers, and API clients for HackPSU projects. This package provides a consistent way to interact with the HackPSU API, manage authentication with Firebase, and share common UI patterns across all HackPSU web applications.

## Installation

```bash
npm install @hackpsu/react-sdk
```

## Required Environment Variables

All projects using this SDK need these environment variables in your `.env.local` or `.env` file:

```env
# Firebase Configuration
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_auth_domain
NEXT_PUBLIC_FIREBASE_DATABASE_URL=your_database_url
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_storage_bucket
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id

# API Configuration
NEXT_PUBLIC_BASE_URL_V3=https://api.hackpsu.org/v3
NEXT_PUBLIC_AUTH_SERVICE_URL=https://auth.hackpsu.org
```

## Usage

### 1. Setup Providers

Wrap your application with the `LayoutProvider` to get Firebase authentication, React Query, and auth guards:

```tsx
// app/layout.tsx or pages/_app.tsx
import { LayoutProvider } from '@hackpsu/react-sdk/context';

export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<LayoutProvider>{children}</LayoutProvider>
</body>
</html>
);
}
```

### 2. Use Authentication

Access Firebase auth state using the `useFirebase` hook:

```tsx
import { useFirebase } from '@hackpsu/react-sdk/context';

export default function ProfilePage() {
const { user, isLoading, logout } = useFirebase();

if (isLoading) return <div>Loading...</div>;
if (!user) return <div>Not authenticated</div>;

return (
<div>
<h1>Welcome, {user.email}</h1>
<button onClick={logout}>Sign Out</button>
</div>
);
}
```

### 3. Use API Hooks

The SDK provides React Query hooks for all API endpoints:

```tsx
import { useAllRegistrations, useCreateRegistration } from '@hackpsu/react-sdk/api/registration';

export default function RegistrationsPage() {
const { data: registrations, isLoading } = useAllRegistrations();
const createMutation = useCreateRegistration();

const handleCreate = async () => {
await createMutation.mutateAsync({
// registration data
});
};

if (isLoading) return <div>Loading...</div>;

return (
<div>
{registrations?.map(reg => (
<div key={reg.id}>{reg.name}</div>
))}
<button onClick={handleCreate}>Create Registration</button>
</div>
);
}
```

### 4. Custom Auth Guard

You can also use the `AuthGuard` component directly with custom role requirements:

```tsx
import { AuthGuard, Role } from '@hackpsu/react-sdk/context';

export default function AdminPage() {
return (
<AuthGuard config={{ minimumRole: Role.EXEC }}>
<div>Admin content - only visible to executives</div>
</AuthGuard>
);
}
```

## Available Modules

### Context

- `FirebaseProvider` - Firebase authentication context
- `useFirebase` - Hook to access Firebase auth state
- `LayoutProvider` - Complete layout setup with Firebase, React Query, and auth
- `AuthGuard` - Component to protect routes with role-based access
- `Role` - Enum for role levels

### Config

- `auth` - Initialized Firebase auth instance
- `getEnvironment` - Function to get environment configuration

### API Modules

Each API module exports:
- Entity types (TypeScript interfaces)
- Provider functions (raw API calls)
- React Query hooks (useQuery/useMutation)

Available modules:
- `api/analytics`
- `api/event`
- `api/extra-credit`
- `api/finance`
- `api/flag`
- `api/hackathon`
- `api/judging`
- `api/location`
- `api/organizer`
- `api/photos`
- `api/registration`
- `api/reservation`
- `api/scan`
- `api/sponsor`
- `api/team`
- `api/user`
- `api/wallet`

## Examples

### Import specific modules

```tsx
// Import from specific subpaths
import { useFirebase } from '@hackpsu/react-sdk/context';
import { auth } from '@hackpsu/react-sdk/config';
import { useAllEvents } from '@hackpsu/react-sdk/api/event';
```

### Import everything (not recommended for production)

```tsx
// Import everything at once (larger bundle size)
import { useFirebase, useAllEvents, auth } from '@hackpsu/react-sdk';
```

## Development

To build the package:

```bash
cd lib
npm install
npm run build
```

## Publishing

This package is published to npm under the `@hackpsu` organization:

```bash
cd lib
npm version patch # or minor, or major
npm publish
```

## License

MIT
46 changes: 46 additions & 0 deletions sdk/api/analytics/entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export interface CountsResponse {
count: number;
}

export interface RegistrationCounts extends CountsResponse {
id: string;
name: string;
}

export interface GenderCounts extends CountsResponse {
gender: string;
}

export interface RaceCounts extends CountsResponse {
race: string;
}

export interface AcademicYearCounts extends CountsResponse {
academicYear: string;
}

export interface CodingExpCounts extends CountsResponse {
codingExperience: string;
}

export interface AnalyticsSummaryResponse {
registrations: RegistrationCounts[];
gender: GenderCounts[];
race: RaceCounts[];
academicYear: AcademicYearCounts[];
codingExp: CodingExpCounts[];
}

export interface AnalyticsScansResponse {
id: string;
firstName: string;
lastName: string;
count: number;
}

export interface AnalyticsEventsResponse {
type: string;
id: string;
name: string;
count: number;
}
38 changes: 38 additions & 0 deletions sdk/api/analytics/hook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useQuery } from "@tanstack/react-query";
import {
getAnalyticsSummary,
getEventsAnalytics,
getOrganizerScans,
} from "./provider";
import {
AnalyticsSummaryResponse,
AnalyticsEventsResponse,
AnalyticsScansResponse,
} from "./entity";

export const analyticsQueryKeys = {
summary: ["analytics", "summary"] as const,
events: ["analytics", "events"] as const,
scans: ["analytics", "scans"] as const,
};

export function useAnalyticsSummary() {
return useQuery<AnalyticsSummaryResponse>({
queryKey: analyticsQueryKeys.summary,
queryFn: getAnalyticsSummary,
});
}

export function useEventsAnalytics() {
return useQuery<AnalyticsEventsResponse[]>({
queryKey: analyticsQueryKeys.events,
queryFn: getEventsAnalytics,
});
}

export function useOrganizerScans() {
return useQuery<AnalyticsScansResponse[]>({
queryKey: analyticsQueryKeys.scans,
queryFn: getOrganizerScans,
});
}
3 changes: 3 additions & 0 deletions sdk/api/analytics/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./entity";
export * from "./provider";
export * from "./hook";
Loading