# How does Discourse handle the Read/Unread for users?

**URL:** https://meta.discourse.org/t/how-does-discourse-handle-the-read-unread-for-users/214048
**Category:** Development
**Created:** [January 6, 2022, 1:39pm UTC](https://meta.discourse.org/t/how-does-discourse-handle-the-read-unread-for-users/214048 "2022-01-06T13:39:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nilox](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@nilox](https://meta.discourse.org/u/nilox)
#### Post date: [January 6, 2022, 1:39pm UTC](https://meta.discourse.org/t/how-does-discourse-handle-the-read-unread-for-users/214048/1 "2022-01-06T13:39:51Z")

</div>

Hey guys!

I’m currently learning coding and I’m wondering what is the schema or technique for read / unread posts in Discourse?

I’ve seen how SMF does it, through a combination of Mark Board Read, Mark All Read, and marked read when seen the last post.. etc.

How does Discourse handle this?

Thanks! =)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [January 6, 2022, 2:16pm UTC](https://meta.discourse.org/t/how-does-discourse-handle-the-read-unread-for-users/214048/2 "2022-01-06T14:16:07Z")

</div>

It’s best to delve into the Source:

[https://github.com/discourse/discourse](https://github.com/discourse/discourse)

Topic read state (by user) is tracked by the TopicUser model?:

> <https://github.com/discourse/discourse/blob/main/app/models/topic_user.rb>

(the data of which is stored in the Postgres DB).

You can interact with this on the rails console, from the discourse directory in dev, go `rails c`  
then you can do something like `TopicUser.first` and look at the data …

---

<div class="post-metadata">

### Author: ![nilox](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@nilox](https://meta.discourse.org/u/nilox)
#### Post date: [January 7, 2022, 9:57am UTC](https://meta.discourse.org/t/how-does-discourse-handle-the-read-unread-for-users/214048/3 "2022-01-07T09:57:33Z")

</div>

Sweet. I see the schema right down there thanks!
