# pocketbase-vite-serverside

> Hey there, I made this light version to have a way to call authorization once to pocketbase while building my static site [NPM package](https://www.npmjs.com/package/pocketbase-vite-serverside)

Latest version **0.1.1** (published 2023-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install pocketbase-vite-serverside
pnpm add pocketbase-vite-serverside
yarn add pocketbase-vite-serverside
bun add pocketbase-vite-serverside
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2023-02-07 |
| First published | 2023-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=15 |
| Dependencies | 2 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 (+7 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Chris King |
| Maintainers | morzaram |
| Keywords | vite, astro, pocketbase, auth |

## Links

- npm: https://www.npmjs.com/package/pocketbase-vite-serverside
- Repository: https://github.com/Morzaram/pocketbase-vite-serverside
- Homepage: https://github.com/Morzaram/pocketbase-vite-serverside#readme
- Issues: https://github.com/Morzaram/pocketbase-vite-serverside/issues
- npm.io page: https://npm.io/package/pocketbase-vite-serverside

## Dependencies (2)

- [vite](https://npm.io/package/vite.md) ^4.1.1
- [pocketbase](https://npm.io/package/pocketbase.md) ^0.10.1

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2023-02-07
- 0.1.0 — 2023-02-07

## README

# PocketBase Vite Serverside

Hey there, I made this light version to have a way to call authorization once to pocketbase while building my static site
[NPM package](https://www.npmjs.com/package/pocketbase-vite-serverside)

1. Install by one of the following

   `yarn add pocketbast-vite-serverside`

   `npm i pocketbase-vite-serverside`

2. Add the env variables (see examples below)
3. call `import { authPb } from "pocketbase-vite-serverside";` in the files you want to make a requst from
4. Call `authPb` like the normal `pb` client

   ```typescript
   import { authPb } from "pocketbase-vite-serverside";
   const records = await authPb
     .collection("events")
     .getFullList(200, { sort: "-created" });
   ```

All you need to do is in your `.env` file is to fill out the following env vars. Here's a template below
For using admin login add the following

```env
PB_USERNAME="admin@email.com"
PB_PASSWORD="adminpassowrd"
PB_AUTH_METHOD="admin-email" #This is to declare which login method
PB_URL="https://your.pocketbase.url"
```

## Next up

I will be implementing table based login such as 'users' and token based login.
If anyone wants to contribute feel free to make a PR with these implementations!

---
_Source: https://npm.io/package/pocketbase-vite-serverside · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
