https://github.com/Zastinian/better-auth-typeorm
A typeorm adapter for better-auth
https://github.com/Zastinian/better-auth-typeorm
adapter better-auth typeorm
Last synced: 16 days ago
JSON representation
A typeorm adapter for better-auth
- Host: GitHub
- URL: https://github.com/Zastinian/better-auth-typeorm
- Owner: Zastinian
- License: mit
- Created: 2025-03-27T04:35:39.000Z (20 days ago)
- Default Branch: master
- Last Pushed: 2025-03-27T05:12:25.000Z (20 days ago)
- Last Synced: 2025-03-27T05:24:50.932Z (20 days ago)
- Topics: adapter, better-auth, typeorm
- Language: TypeScript
- Homepage:
- Size: 0 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - Link
README
📦 @hedystia/better-auth-typeorm
TypeORM adapter for Better Auth - Powerful database integration for your auth system! 🚀
## 🌟 Features
- 🗄️ **Database Agnostic**: Works with all TypeORM-supported databases (MySQL, PostgreSQL, SQLite, etc.)
- 🔄 **CRUD Operations**: Full support for create, read, update, and delete operations
- ⚡ **Efficient Queries**: Built-in pagination, sorting, and filtering support
- 🔒 **Secure Operations**: Proper transaction handling and error management## 🚀 Quick Start
1. Install the package:
```bash
npm install @hedystia/better-auth-typeorm typeorm
```2. Create your TypeORM DataSource configuration:
```typescript
import { DataSource } from "typeorm";
import { migrations } from "@hedystia/better-auth-typeorm";export const dataSource = new DataSource({
type: "mysql",
host: "localhost",
port: 3306,
username: "your_username",
password: "your_password",
database: "your_database",
migrations: [...migrations],
migrationsRun: true,
});await dataSource.initialize();
```3. Set up your Better Auth configuration:
```typescript
import { betterAuth } from "better-auth";
import { typeormAdapter } from "@hedystia/better-auth-typeorm";
import { dataSource } from "./data-source";export const auth = betterAuth({
database: typeormAdapter(dataSource),
});
```## 🌟 Why use this adapter?
- **Seamless Integration**: Direct mapping between Better Auth entities and TypeORM
- **Flexible Database Support**: Use with any TypeORM-supported database
- **Production Ready**: Built-in error handling and transaction support
- **Performance Optimized**: Efficient query building and data transformation## 📝 License
This project is licensed under the [MIT License](LICENSE).
## 🙏 Acknowledgements
- [TypeORM](https://typeorm.io/)
- [Better Auth](https://github.com/better-auth/better-auth)