| title | Arifa Updates - Paystack Checkout, Rate Limits, and Bug Fixes | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| date | 2026-05-26 | ||||||||||||||
| author | pmutua | ||||||||||||||
| tags |
|
||||||||||||||
| commit | d1208bb | ||||||||||||||
| type | dev-diary |
This update brings significant improvements to the Arifa platform, including the integration of Paystack checkout for seamless subscription upgrades, the addition of rate limits to prevent abuse of analytics, intelligence, subscription, and user routes, and several bug fixes to enhance the overall user experience.
Arifa is an AI-powered news aggregation, analysis, and distribution platform designed for Kenya and Global Tech & Science news. It leverages a range of technologies including React Native, Expo, Astro, Cloudflare Workers, Hono, D1, Drizzle, KV, R2, and Rag, among others, to provide a comprehensive news experience.
The UpgradePrompt component has been updated to wire the Paystack checkout flow, allowing users to upgrade their plans seamlessly. This change involves the use of usePlans, useInitializeSubscription, and useVerifySubscription hooks to manage the subscription process.
const handleUpgrade = async (planId: string) => {
setLoadingPlanId(planId);
await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
try {
const result = await initMutation.mutateAsync({ planId });
const browserResult = await WebBrowser.openBrowserAsync(result.authorizationUrl, {
dismissButtonStyle: 'close',
});
if (browserResult.type === 'cancel' || browserResult.type === 'dismiss') {
// User closed browser -- attempt to verify in case payment completed
try {
await verifyMutation.mutateAsync(result.reference);
Alert.alert('Payment Confirmed', 'Your plan has been upgraded successfully!');
} catch {
// Payment wasn't completed -- no-op
}
}
} catch (err) {
Alert.alert('Error', 'Unable to start checkout. Please try again.');
} finally {
setLoadingPlanId(null);
}
};Rate limits have been added to analytics, intelligence, subscription, and user routes to prevent abuse. This involves the use of the rateLimit middleware in routes such as analyticsRoutes, intelligenceRoutes, subscriptionRoutes, and userRoutes.
analyticsRoutes.get('/sentiment', authMiddleware, rateLimit(30), async (c) => {
// ...
});
intelligenceRoutes.get('/briefing/today', optionalAuthMiddleware, rateLimit(60), async (c) => {
// ...
});
subscriptionRoutes.get('/plans', rateLimit(30), async (c) => {
// ...
});
userRoutes.get('/profile', authMiddleware, rateLimit(30), async (c) => {
// ...
});Several bug fixes have been implemented, including replacing the notification bell coming-soon alert with navigation to preferences, updating audio tests to expect WAV format, and resolving silent error swallowing in empty catch blocks.
One of the challenges faced during this update was ensuring that the Paystack checkout integration was seamless and secure. This required careful handling of payment verification and error handling to prevent any potential issues.
- The importance of rate limiting in preventing abuse of API routes.
- How to integrate Paystack checkout into a React Native application using Expo.
- The need for thorough error handling in asynchronous operations.
The next steps involve further enhancing the user experience through additional features and improvements, such as expanding the analytics capabilities and introducing more personalized content recommendations.
Given the changes to the data schema, particularly with the introduction of rate limits and the integration of Paystack checkout, an erDiagram illustrating these changes is necessary. However, due to the complexity and the nature of the changes, which are more functional and less about altering the database schema directly, the focus shifts towards understanding how these changes impact the system's architecture and user interaction.
erDiagram
USER ||--o{ SUBSCRIPTION : has
SUBSCRIPTION }|..|{ PLAN : includes
PLAN ||--|{ RATE_LIMIT : applies
RATE_LIMIT }|..|{ ANALYTICS_ROUTE : restricts
ANALYTICS_ROUTE ||--|{ INTELLIGENCE_ROUTE : complements
INTELLIGENCE_ROUTE }|..|{ USER_ROUTE : serves
USER_ROUTE ||--o|{ PAYSTACK_CHECKOUT : integrates
PAYSTACK_CHECKOUT }|..|{ SUBSCRIPTION : upgrades
This diagram illustrates the relationship between users, subscriptions, plans, rate limits, and the various routes (analytics, intelligence, user), as well as the integration of Paystack checkout for subscription upgrades. It highlights how these components interact within the Arifa platform to provide a secure, personalized, and feature-rich experience.
All commits are SSH-signed (Ed25519) and show a Verified badge on GitHub. The source repository is private — commit URLs are not publicly accessible.
| Commit | Date | Message | Verified |
|---|---|---|---|
e97a4dc |
2026-05-25 20:09 +03:00 | feat(mobile): wire UpgradePrompt to Paystack checkout flow (closes #41) | ✓ |
85f38d2 |
2026-05-25 20:18 +03:00 | fix(api): add rate limits to analytics, intelligence, subscription, and user routes (closes #43, closes #44, closes #47, closes #49) | ✓ |
21c1ca7 |
2026-05-25 20:21 +03:00 | fix(mobile): replace notification bell coming-soon alert with navigation to preferences (closes #42) | ✓ |
a854056 |
2026-05-25 20:24 +03:00 | fix(shared): update audio tests to expect WAV format (closes #46) | ✓ |
d1208bb |
2026-05-25 20:28 +03:00 | fix(web): resolve silent error swallowing in empty catch blocks (closes #45) | ✓ |