Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions ben-kaufman/p2pjobs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
3 changes: 3 additions & 0 deletions ben-kaufman/p2pjobs/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
v22.12.0


21 changes: 21 additions & 0 deletions ben-kaufman/p2pjobs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 P2PJobs contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
89 changes: 89 additions & 0 deletions ben-kaufman/p2pjobs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# P2PJobs

Decentralized job board using Pubky for identity and storage. Employers publish jobs and candidates apply using their own keys. Data lives under each user’s Pubky namespace; the local server indexes peers for fast reads.

## Stack

- React + TypeScript + Vite + TailwindCSS
- Pubky SDK `@synonymdev/pubky@0.6.0-rc.6`
- Node.js Express indexer (reads peers, aggregates jobs/profiles/applications)

## Data model (Pubky paths)

- Jobs list: `pubky://<pubkey>/pub/p2pjobs/jobs.json` (array)
- Profile: `pubky://<pubkey>/pub/p2pjobs/profile.json`
- Applications: pointers stored in indexer; application bodies written by applicants to their own Pubky space

## Requirements

- Node.js 20.19+ (recommended 22.12+)
- npm (or yarn/pnpm)

## Setup

1) Install deps

```bash
npm install
```

2) Configure environment

Copy `.env.example` to `.env.local` (or set shell env vars) and review:

Frontend (Vite):

- `VITE_REGISTRY_URL` – local indexer URL (default `http://localhost:8787`)
- `VITE_PUBKY_HOME_PK` – homeserver public key (staging)
- `VITE_PUBKY_ADMIN_ENDPOINT` – signup token endpoint (staging)
- `VITE_PUBKY_ADMIN_PASSWORD` – admin password to generate signup tokens (staging)

Server (Indexer):

- `PORT` – default `8787`
- `PUBKY_HOME_HOST` – optional fallback homeserver origin for reads (e.g. `https://homeserver.staging.pubky.app`)

3) Run dev

```bash
# Terminal A: indexer
npm run server

# Terminal B: frontend
npm run dev
```

Open `http://localhost:5173`.

## How it works

- Signup generates an Ed25519 keypair and creates a Pubky user (staging uses an admin-generated invite token).
- Posting a job writes only your jobs array to your `pub/p2pjobs/jobs.json`.
- The server indexer reads jobs from all registered pubkeys and exposes `GET /jobs` for the UI.
- Profiles are read via `GET /profiles/:pk` with no-cache to avoid stale profile data.
- Applications: applicants write to their own Pubky, then submit a pointer to `POST /applications`; employers read via `GET /applications?employer=<pk>`.

## Server API

- `POST /pubkeys` body `{ pubkey, host? }` – register a user (and optional homeserver host)
- `GET /jobs` – aggregated list from all registered pubkeys
- `GET /profiles/:pk` – user profile (no cache)
- `POST /applications` – register application pointer `{ id, employerPubkey, applicantPubkey, url, jobId?, jobTitle? }`
- `GET /applications?employer=<pk>` – list employer’s incoming applications
- `PATCH /applications/:id` – update application status `{ status }`

## Troubleshooting

- Wrong passphrase when restoring: ensure the same passphrase used to create the recovery file.
- 401 No session cookie: retry signup/signin; ensure browser allows cookies.
- PKDNS/PKARR resolution issues: set `PUBKY_HOME_HOST` on the server as a fallback, or use testnet.
- Stale reads: server and profile endpoints set `no-store` and add cache-busting query params.

## Security

- Do not commit invite tokens, passwords, or recovery files.
- Keys are generated client-side; users are responsible for backups via recovery file/base64 secret.

## License

MIT
23 changes: 23 additions & 0 deletions ben-kaufman/p2pjobs/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
])
13 changes: 13 additions & 0 deletions ben-kaufman/p2pjobs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>p2pjobs</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading