Database Support
Flexible database layer supporting MongoDB, PostgreSQL, and SQLite.
The Repository Pattern
fe uses a repository pattern to decouple the application logic from the database implementation. This allows you to switch databases with minimal code changes.
The core interfaces are defined in src/lib/database/repositories.
Supported Databases
MongoDBSupabase (PostgreSQL)SQLite
MongoDB
Great for rapid prototyping and flexible data schemas.
env
DATABASE_TYPE=mongodbSupabase (PostgreSQL)
Robust relational database with built-in auth and realtime capabilities.
env
DATABASE_TYPE=supabaseSQLite
Perfect for local development and small-scale deployments.
env
DATABASE_TYPE=sqliteAdding a New Repository
To add a new data model (e.g., `Products`), you need to:
- Define the interface in
src/lib/database/repositories/product-repository.ts. - Implement the adapter for your chosen database (e.g., in
src/lib/database/adapters/mongodb/repositories/product-repository.ts). - Register the repository in the main database adapter.