মনচিত্র প্রজেক্ট গাইড
সিস্টেম আর্কিটেকচার
অ্যাপ্লিকেশন সীমা, data flow, trust zone ও deployment দায়িত্ব।
আর্কিটেকচার পরিচিতি
ওয়েব client হলো Next.js App Router application। browser-only reader dynamic ভাবে load হয়; public sample content credential ছাড়াই render হতে পারে। authenticated account data Supabase Auth, RLS ও validated server route দিয়ে যেতে হবে।
01
Browser / PWA → Next.js route ও server action → Supabase Auth + Postgres (RLS)
02
Next.js AI route → Vercel AI Gateway → নির্বাচিত model → moderated response শিক্ষার্থীর কাছে
03
Service worker → app shell ও স্পষ্টভাবে সংরক্ষিত chapter → IndexedDB
04
ভবিষ্যৎ collaboration: authenticated room token → Yjs provider → room persistence
Trust boundary
| সীমা | যে data যায় | প্রয়োজনীয় নিয়ন্ত্রণ |
|---|---|---|
| Browser → server | user input ও access token | validation, CSRF/origin policy, rate limit |
| Server → database | scoped query ও অনুমোদিত mutation | RLS, user scope, parameterized query |
| Server → AI Gateway | ন্যূনতম lesson context ও prompt | PII নয়, request limit, moderation |
| Device → offline store | ব্যবহারকারী-নির্বাচিত বইয়ের text ও progress | স্পষ্ট opt-in, versioning, delete control |
Runtime ও rendering
- server component স্থিতিশীল route shell ও public documentation content render করে।
- client component speech, fullscreen ও flipbook gesture-এর মতো browser interaction পরিচালনা করে।
- শুধু browser-only code-এ ssr:false-সহ dynamic import ব্যবহার করুন।
- database, PDF বা SDK package দরকার হলে API route handler Node runtime ব্যবহার করবে।
Request flow text
1. Request arrives at localized Next.js route
2. Server validates path and input schema
3. Supabase session identifies caller
4. RLS and application authorization scope the data
5. Response returns only the fields needed by the UI
6. Client updates accessible state and announces statusDeployment topology
- Vercel Next.js web app ও server route host করে।
- অনুমোদিত schema migration-এর পর Supabase authentication ও Postgres দেয়।
- Vercel AI Gateway server-side model boundary।
- Cloudflare R2 ও Yjs/WebSocket ঐচ্ছিক ভবিষ্যৎ service; কোনো production integration ধরে নেওয়া হয়নি।
- Vercel environment variable-এ secret রাখুন।
- নতুন table পড়ে এমন code deploy করার আগে migration দিন।
- least-privilege account দিয়ে preview ও production smoke test করুন।
