Skip to content

getlarge/cat-fostering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev.to Ory NodeJS NestJS Angular Jest Postgres Nx Docker

fork with dotenv-vault

CatFostering-min

CatFostering

This demonstration app is a web-based platform (REST API) called CatFostering. The CatFoster application is a simplified example that demonstrates the integration of Ory in a NestJS application with the NestJS Ory Integration libraries.

Note If this is your first time working with Ory, I recommend reading the Introduction to Ory article to familiarize yourself with the core components and concepts of Ory.

Key Features

  1. User Authentication and Profile Management:

    • Ory Integration: Utilize Ory's authentication system to handle user registrations, logins, password resets, and profile management.
    • User Roles: There is one static user role, Admin, that a super admin can assign to users after registration.
  2. Cat Profiles:

    • Listing and Management: Cat owners can create profiles for their cats, including photos, descriptions, special care instructions, and availability for fostering. Admins can edit and delete cat profiles.
    • Search and Filters: Users looking to foster cats can search for them based on filters.
  3. Fostering Matchmaking:

    • Requests and Approvals: Cat fosters can send fostering requests to cat owners, who can review and approve or deny them based on the foster's profiles.
    • Authorization Checks: Use Ory to manage authorization, ensuring that only cat owners can approve fostering requests and only registered users can send requests.

Design phase

Architecture

---
config:
  fontFamily: ''
  theme: base
  themeVariables:
    primaryColor: '#5d9fd8'
    textColor: black
    secondaryColor: '#f8f8f8'
    fontSize: "12px"
---

flowchart TD
    UI("fa:fa-laptop Self-service UI -")
    OryKratos(["fa:fa-shield Ory Kratos -"])
    OryKeto(["fa:fa-shield Ory Keto -"])
    NestJSApp("fa:fa-code NestJS App -")
    AngularApp("fa:fa-code Angular App -")
    Postgres[("fa:fa-database Postgres -")]

    UI -- Register/Login <br>Manage Account --> OryKratos
    NestJSApp -- Verify cookie \nor JWT --> OryKratos
    NestJSApp -- Create relationships <br> Check permissions --> OryKeto
    NestJSApp -- CRUD Operations \n Store User and \nCat Profiles --> Postgres
    OryKratos -. Send webhooks .-> NestJSApp
    AngularApp -->|REST interactions| NestJSApp
    AngularApp -->|Redirect to authenticate| UI

    style UI fill:#a0c8e8,stroke:#333,stroke-width:2px,stroke-dasharray: 0
    style OryKratos fill:#ffdd57,stroke:#333,stroke-width:2px
    style NestJSApp fill:#ff6f61,stroke:#333,stroke-width:2px
    style AngularApp fill:#ff6f61,stroke:#333,stroke-width:2px
    style OryKeto fill:#6accbc,stroke:#333,stroke-width:2px
    style Postgres fill:#5d9fd8,stroke:#333,stroke-width:2px
Loading
  • Self-service UI: This is the frontend where users can log in and manage their accounts. It communicates directly with Ory Kratos for authentication-related tasks.
  • Ory Kratos: Handles authentication. It's responsible for user login, account management, and session management. It interacts with the NestJS app via HTTP webhooks to replicate user data on signup.
  • HTTP Webhooks: Serve as the communication link between Ory Kratos and the NestJS app, ensuring the user is replicated in the local database upon signup.
  • NestJS App: The core of your application is handling business logic, CRUD operations with the Postgres database, authentication checks with Ory Kratos, and authorization with Ory Keto.
  • Ory Keto: Manages authorization, determining what authenticated users are allowed to do within the application.
  • Postgres: The database where user data (replicated from Ory on signup), cat profiles and fostering requests are stored. The NestJS app interacts with Postgres for all data storage and retrieval operations.

Check out the complete Ory Integration guide to learn how to integrate Ory Kratos and Ory Keto into your NestJS application.