{"id":24617835,"url":"https://github.com/jacoblincool/pea","last_synced_at":"2026-03-17T15:40:28.854Z","repository":{"id":159341953,"uuid":"634604438","full_name":"JacobLinCool/pea","owner":"JacobLinCool","description":"Pure Email Auth.","archived":false,"fork":false,"pushed_at":"2025-05-31T04:02:51.000Z","size":362,"stargazers_count":3,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-31T15:45:20.644Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JacobLinCool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-30T17:04:29.000Z","updated_at":"2025-04-26T18:09:47.000Z","dependencies_parsed_at":"2023-11-15T09:27:58.875Z","dependency_job_id":"276f1d5f-769b-4d81-b1c0-646e880c8778","html_url":"https://github.com/JacobLinCool/pea","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JacobLinCool/pea","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2Fpea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2Fpea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2Fpea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2Fpea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JacobLinCool","download_url":"https://codeload.github.com/JacobLinCool/pea/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2Fpea/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260901167,"owners_count":23079720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-24T23:41:17.638Z","updated_at":"2026-03-17T15:40:23.828Z","avatar_url":"https://github.com/JacobLinCool.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# PEA\n\n_Pure Email Auth._\n\n![icon](static/icon-256.png)\n\n\u003c/div\u003e\n\n## Features\n\n- [x] Authenticate users with email.\n- [x] Restrict the email domain(s) / pattern(s) of the users.\n- [x] Support multiple applications.\n- [x] Asymmetric JWT signing.\n- [x] Fully serverless.\n- [x] A developer dashboard for managing applications.\n- [x] A public showboard for each developer.\n\n\u003e Using PEA, all of your users' email addresses are verified by nature.\n\n\u003e You can use [D1 Manager](https://github.com/JacobLinCool/d1-manager) to manage the underlying D1 database.\n\n## Setup\n\nRequirements:\n\n- A Cloudflare account (with a domain, so we can send emails)\n- A Cloudflare D1 database\n\n1. Execute the SQL in [here](prisma/migrations/20230608181442_init/migration.sql) in your D1 database to create the tables.\n2. Fork this repository.\n3. Create a new Cloudflare Pages project with the forked repository.\n4. Setup the environment variables and D1 binding (`D1`) in the Cloudflare Pages project.\n5. Trigger `/api/sys/setup` to check if the setup is successful.\n\n## Configuration\n\nPEA uses environment variables for some configurations.\n\n| Name            | Description                                            | Example         |\n| --------------- | ------------------------------------------------------ | --------------- |\n| `PEA_APP_EMAIL` | The email address of the system use for sending email. | `pea@csie.cool` |\n\n## Authentication Model\n\n### For Application Developers\n\nAfter creating an application on PEA, you can use the provided login page or the API to authenticate users.\n\nThe provided login page is located at `/app/\u003cyour-app\u003e` and you can use the `cb` query parameters to customize the callback URL, for example `/app/your-app?cb=https://your.app/callback/url`.\n\nYou can also use the API to authenticate users. The API is located at `/api/app/\u003cyour-app\u003e/login` and you can use the `callback` field in the request body to customize the callback URL.\n\n```bash\ncurl -X POST \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\": \"user@csie.cool\", \"callback\": \"https://your.app/callback/url\"}' \\\n    https://pea.csie.cool/api/app/your-app-id/login\n```\n\nThen, PEA will send an email to the user with the callback URL and a JWT token in the following format:\n\n```bash\nhttps://your.app/callback/url?token=\u003cJWT_TOKEN\u003e\n```\n\n\u003e Both methods require the callback URL matches the pattern in the application settings.\n\n#### Verify the JWT Token\n\nYou can verify the JWT token using the public key provided by PEA.\n\nFollows the JWT standard, the JWK sets can be found at `jku` field in the JWT token header.\n\n```json\n{\n  \"jku\": \"https://pea.csie.cool/jwks.json\"\n}\n```\n\nEvery JWT library should be able to verify the JWT token using the JWK sets.\n\n\u003e If you are using SvelteKit, you can use the [`sveltekit-jwt`](https://github.com/JacobLinCool/sveltekit-jwt) package to verify the JWT token.\n\n```ts\n\n### For Users\n\n1. Open the application you want to log in to.\n2. Enter your email address and click the login button (or something similar).\n3. Receive an email from PEA and click the link in the email.\n4. Done! You are now logged in to the application.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacoblincool%2Fpea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacoblincool%2Fpea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacoblincool%2Fpea/lists"}