Documentation Index
Fetch the complete documentation index at: https://mintlify.com/astrxnomo/tourify/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Tourify has a two-part notification system:Push notifications
Delivered in real-time via the Expo Push Service. The mobile app registers its device token with the server; the server uses that token to dispatch pushes.
In-app notification center
A persistent list of notifications stored in the database. Users can read and mark them as read from inside the app using the notifications API.
Push token registration
POST /api/push-token
After login, the mobile app obtains an Expo push token from the device and registers it with the server. The token is stored on theusers table in the push_token column so the server knows where to deliver future pushes for that user.
Required body field
A valid Expo push token in the form
ExponentPushToken[xxxxxxxxxxxxxxxxxxxx].How the frontend registers push tokens
TheusePushNotifications hook handles the full permission request and token registration lifecycle. It runs automatically when the app mounts after login.
hooks/usePushNotifications.js
Configure Android channel
On Android, creates a
"default" notification channel with MAX importance so notifications are shown as heads-up banners.Request permission
Calls
Notifications.requestPermissionsAsync() if the permission is not already "granted". If the user denies, the hook exits early without registering.Obtain push token
Calls
Notifications.getExpoPushTokenAsync() to get the unique Expo device token (format: ExponentPushToken[...]).Register with the server
POSTs the token to
POST /api/push-token. Failures are silently swallowed so a push-token issue never breaks the login flow.An admin with access to the Tourify admin panel can broadcast a push notification to all registered users at once. The server iterates over all
push_token values stored in the users table and sends the message via the Expo Push API.In-app notification center
GET /api/notifications
Returns all notifications for the authenticated user, ordered bycreated_at descending (newest first).
The notification’s unique ID. Used in the mark-as-read endpoints.
The ID of the user this notification belongs to.
Short notification title (e.g.
"Nuevo evento en Barcelona").Full notification body text.
Whether the user has marked this notification as read. Starts as
false.The ID of the related entity (e.g. an event ID), if applicable.
The type of the related entity (e.g.
"event"), if applicable.PATCH /api/notifications//read
Mark a single notification as read (is_read: true). Returns 403 if the notification does not belong to the authenticated user.
PATCH /api/notifications/read-all
Mark all unread notifications for the authenticated user as read in a single request. Only notifications whereis_read is currently false are updated.
Frontend integration
TheuseNotifications hook loads the notification list, exposes an unreadCount derived value, and provides markAsRead / markAllAsRead helpers that optimistically update local state without requiring a full reload.
hooks/useNotifications.js
NotificationsScreen.jsx (excerpt)
Endpoint reference
| Method | Path | Auth | Description |
|---|---|---|---|
POST | /api/push-token | ✅ Required | Register or update the device’s Expo push token |
GET | /api/notifications | ✅ Required | List all notifications for the user (newest first) |
PATCH | /api/notifications/{notification}/read | ✅ Required | Mark one notification as read |
PATCH | /api/notifications/read-all | ✅ Required | Mark all unread notifications as read |