# Modelling Authorization for a Social Network with Postgres RLS and Drizzle ORM

DevFeed: [Modelling Authorization for a Social Network with Postgres RLS and Drizzle ORM](<https://devfeed.tech/articles/modelling-authorization-for-a-social-network-with-postgres-rls-and-drizzle-orm-5575.md>)

Original publisher: [Read original article](<https://neon.com/blog/modelling-authorization-for-a-social-network-with-postgres-rls-and-drizzle-orm>)

Author: David Gomes

Published: 2024-11-11T19:21:18Z

Content type: article

Language: en

Sources: [Blog -- Neon Docs](<https://devfeed.tech/sources/blog-neon-docs.md>)

Topics: [Authorization](<https://devfeed.tech/topics/authorization.md>), [Drizzle](<https://devfeed.tech/topics/drizzle.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [Security](<https://devfeed.tech/topics/security.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [authentication](<https://devfeed.tech/tags/authentication.md>), [authorization](<https://devfeed.tech/tags/authorization.md>), [code](<https://devfeed.tech/tags/code.md>), [drizzle](<https://devfeed.tech/tags/drizzle.md>), [github](<https://devfeed.tech/tags/github.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [orm](<https://devfeed.tech/tags/orm.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [product](<https://devfeed.tech/tags/product.md>), [security](<https://devfeed.tech/tags/security.md>)

## AI overview

This article models authorization for a Twitter-inspired social network using Postgres Row-Level Security and Drizzle ORM. It explains access policies for users, profiles, posts, comments, and private chats, along with authentication through the pg_session_jwt Postgres extension.

## Source excerpt

Postgres's Row-Level Security feature allows us to set up the access rules for our data. In other words, it can be used to declare the authorization model for an application or a service. As I've been trying to better understand RLS and its pros and cons, I decided to work on an...