A Twitter-style app exercising every InsForge module: auth (email/password + PKCE OAuth deep link), database (joined feed, like/unlike, pagination), storage (tweet image upload), and ai (streaming caption via OpenRouter).
Edit lib/config.dart:
backendUrl— your InsForge project base URL (no trailing slash, no module path). For the Android emulator talking to a local backend usehttp://10.0.2.2:7130; for the iOS simulator usehttp://localhost:7130.anonKey— your project's anon (public) key.openRouterApiKey— (optional) an OpenRouter key to enable "Suggest caption". Leave empty to hide the AI button.oauthScheme— the custom URI scheme for the OAuth redirect (defaultinsforgetwitter). Must match the platform config below.
Create these tables in your InsForge project:
create table profiles (
id uuid primary key references auth_users(id),
name text,
bio text,
avatar_url text
);
create table tweets (
id uuid primary key default gen_random_uuid(),
user_id uuid not null references profiles(id),
content text not null,
image_url text,
created_at timestamptz not null default now()
);
create table likes (
tweet_id uuid not null references tweets(id) on delete cascade,
user_id uuid not null references profiles(id) on delete cascade,
created_at timestamptz not null default now(),
primary key (tweet_id, user_id)
);The feed query joins via the FK constraint name
tweets_user_id_fkey. If your FK is named differently, update theselect('*, author:profiles!<your_fk_name>(...)')string inlib/screens/feed_screen.dart.
Create a public storage bucket named tweet-images (Compose uploads images
there and stores the returned public URL on the tweet row).
The OAuth flow opens the provider URL in the system browser and captures the
redirect back into the app via a custom URI scheme. Register the scheme on each
platform so the OS routes insforgetwitter://auth-callback to the app.
Add an intent-filter inside the existing <activity android:name=".MainActivity">:
<intent-filter android:autoVerify="false">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="insforgetwitter" android:host="auth-callback" />
</intent-filter>Add a CFBundleURLTypes entry:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>dev.insforge.twitterapp.oauth</string>
<key>CFBundleURLSchemes</key>
<array>
<string>insforgetwitter</string>
</array>
</dict>
</array>When configuring the provider in the InsForge dashboard, add
insforgetwitter://auth-callback to the allowed redirect URIs.
flutter pub get
cd samples/twitter_app
flutter run| Screen | Modules | SDK calls |
|---|---|---|
| AuthScreen | auth | signUp, signIn, getOAuthUrl + handleOAuthCallback |
| FeedScreen | database | from('tweets').select(join).order().range().execute(), like via insert/delete |
| ComposeScreen | storage, database, ai | storage.from('tweet-images').uploadAutoKey/getPublicUrl, database insert, ai.chat.completions.createStream |
| ProfileScreen | auth | getProfile, updateProfile |