A modern web application built with SvelteKit and PocketBase, demonstrating user authentication and profile management.
- SvelteKit: A framework for building web applications with a focus on simplicity and performance.
- PocketBase: A lightweight backend platform for building web applications.
- Tailwind CSS: A utility-first CSS framework for rapidly building custom designs.
- Node.js and bun (bun.sh) installed on your machine.
- Clone the repository:
git clone https://github.com/queaxtra/svelte-oauth-example.git
- Navigate to the project directory:
cd svelte-oauth-example
- Install the dependencies:
bun install
- Start the development server:
bun run dev
Create a .env
file in the root directory of the project and add the following environment variables:
VITE_APP_PBURL=http://localhost:8090
Database connection is handled through db.ts
using PocketBase client:
import PocketBase from 'pocketbase';
const url = import.meta.env.VITE_APP_PBURL;
const db = new PocketBase(url);
export default db;
The user.ts
module provides the following functionality:
-
User Authentication
- Login with email/password
- Automatic session management
- Logout functionality
-
User Operations
- Create a new user
- Edit user profile
- Delete user account
-
Session Validation
- Check if the user is logged in
- Validate user sessions
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.