Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/typeheim/fire-legion
DDD framework for Firebase
https://github.com/typeheim/fire-legion
ddd fire-legion firebase firestore firestore-orm orm rxjs
Last synced: 3 months ago
JSON representation
DDD framework for Firebase
- Host: GitHub
- URL: https://github.com/typeheim/fire-legion
- Owner: typeheim
- License: mit
- Created: 2020-04-18T06:57:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:55:26.000Z (about 2 years ago)
- Last Synced: 2024-09-28T17:02:20.247Z (3 months ago)
- Topics: ddd, fire-legion, firebase, firestore, firestore-orm, orm, rxjs
- Language: TypeScript
- Homepage:
- Size: 1.78 MB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DDD framework for Firebase applications that includes ORMOnFire and FireAuth libraries.# Getting Started
Install root package that adds all of the latest FireLegion packages to dependencies
```shell
yarn add @typeheim/fire-legion
//or
npm -i @typeheim/fire-legion
```# ORMOnFire
ORMOnFire is a powerful Firestore ORM.
```typescript
import {
Agregate,
Entity,
Collection,
CollectionRef,
ID,
Field
} from '@typeheim/orm-on-fire'@Agregate()
export class User {
@ID() id: string@Field() firstName: string
@Field() lastName: string
@Field() status: string
@CollectionRef(UserFile) files: Collection
}@Entity({ collection: 'user-files' })
export class UserFile {
@ID() id: string@Field() name: string
}export const UsersCollection = Collection.of(User)
//.......
// with promise-like interface
let markus = await UsersCollection.one('markus').get()// with Rx interface
UsersCollection.one('tom').get().subscribe((tom: User) => {
tom.files.forEach((file: UserFile) => {
// some cool stuff
})
})
```
[Read more...](https://github.com/typeheim/fire-legion/tree/master/packages/orm-on-fire)# FireAuth
FireAuth is Firebase auth library based on Rx principles.
```typescript
import { FireAuth, FireAuthSession, AuthProvidersList } from '@typeheim/fire-auth'// through provider
FireAuth.throughProvider(AuthProvidersList.Google).signInWithPopup()// using email/password flow
FireAuth.signIn(new PasswordAuth('email', 'password'))// getting user object
FireAuthSession.userStream.subscribe(user => /*do your magick*/)// gedding auth status
FireAuthSession.isLoggedInStream.subscribe(isLoggedIn => /*do your magick*/)// gedding access token
FireAuthSession.accessTokenStream.subscribe(token => /*do your magick*/)
```
[Read more...](https://github.com/typeheim/fire-legion/tree/master/packages/fire-atuh)