<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rahul kumar</title>
    <description>The latest articles on DEV Community by rahul kumar (@rahulshiraj).</description>
    <link>https://dev.to/rahulshiraj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3974321%2Ffe3e391a-bc6a-42b7-b833-aae3b00a1fcc.png</url>
      <title>DEV Community: rahul kumar</title>
      <link>https://dev.to/rahulshiraj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rahulshiraj"/>
    <language>en</language>
    <item>
      <title>How I Built an Offline-First AI Gym App in Flutter with SQLCipher + Gemini AI</title>
      <dc:creator>rahul kumar</dc:creator>
      <pubDate>Mon, 08 Jun 2026 14:10:17 +0000</pubDate>
      <link>https://dev.to/rahulshiraj/how-i-built-an-offline-first-ai-gym-app-in-flutter-with-sqlcipher-gemini-ai-g5h</link>
      <guid>https://dev.to/rahulshiraj/how-i-built-an-offline-first-ai-gym-app-in-flutter-with-sqlcipher-gemini-ai-g5h</guid>
      <description>&lt;blockquote&gt;
&lt;h2&gt;
  
  
  The Problem I Was Solving
&lt;/h2&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most fitness apps sync your health data to the cloud. I wanted an app where everything stays on-device — encrypted and private. No subscriptions, no cloud dependency.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;AI Gym Mentor&lt;/strong&gt; in Flutter.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Encrypted Local Database with Drift + SQLCipher
&lt;/h3&gt;

&lt;p&gt;The biggest technical challenge was implementing encrypted local storage. I used &lt;strong&gt;Drift&lt;/strong&gt; (formerly Moor) as the ORM and &lt;strong&gt;SQLCipher&lt;/strong&gt; for encryption on top of SQLite.&lt;/p&gt;

&lt;p&gt;This means all workout logs, body measurements, and user data are AES-256 encrypted on-device.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Google Gemini AI Integration
&lt;/h3&gt;

&lt;p&gt;I integrated the &lt;strong&gt;Gemini AI&lt;/strong&gt; API to provide real-time coaching. After a workout, the app sends your session data to Gemini and returns personalized feedback, recovery suggestions, and progression advice.&lt;/p&gt;

&lt;p&gt;The key was keeping the prompt context tight — sending only relevant recent session data rather than the full history.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Riverpod 3.0 State Management
&lt;/h3&gt;

&lt;p&gt;The app uses &lt;strong&gt;Riverpod 3.0&lt;/strong&gt; with annotated generators for clean, scalable state management. This was essential given the complexity of syncing Wear OS data, chart state, and AI responses.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Full Tech Stack
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Flutter 3.22+ (iOS, Android, Web)&lt;/li&gt;
&lt;li&gt;Riverpod 3.0 (Annotated Generators)&lt;/li&gt;
&lt;li&gt;Drift + SQLCipher (encrypted local DB)&lt;/li&gt;
&lt;li&gt;Google Gemini AI&lt;/li&gt;
&lt;li&gt;GoRouter 17.2+&lt;/li&gt;
&lt;li&gt;Wear OS sync&lt;/li&gt;
&lt;li&gt;fl_chart for analytics (1RM, volume, body measurements)&lt;/li&gt;
&lt;li&gt;Lottie + Shimmer animations&lt;/li&gt;
&lt;li&gt;1,000+ exercise database&lt;/li&gt;
&lt;li&gt;Multi-language: English, Hindi, Marathi&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why I Packaged It as a Template
&lt;/h2&gt;

&lt;p&gt;After finishing the app, I realized it had taken months to build all these pieces together correctly. The SQLCipher setup alone took days. The Gemini integration required multiple iterations.&lt;/p&gt;

&lt;p&gt;So I packaged the complete source code as a developer template — &lt;strong&gt;AI Gym Mentor&lt;/strong&gt; — so other developers can build on top of it instead of starting from scratch.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Included
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Complete, buildable Flutter source code&lt;/li&gt;
&lt;li&gt;README with full setup guide&lt;/li&gt;
&lt;li&gt;Seeded exercise database (exercises.json)&lt;/li&gt;
&lt;li&gt;.env.example for Gemini API key setup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The template is available here: &lt;a href="https://rahulsaroh.gumroad.com/l/sovgjy" rel="noopener noreferrer"&gt;https://rahulsaroh.gumroad.com/l/sovgjy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Launch price: &lt;strong&gt;$29&lt;/strong&gt;. Use code &lt;strong&gt;LAUNCH30&lt;/strong&gt; for 30% off (first 10 buyers).&lt;/p&gt;

&lt;h2&gt;
  
  
  Happy to Discuss
&lt;/h2&gt;

&lt;p&gt;If you have questions about the SQLCipher + Drift setup, the Gemini integration pattern, or the Riverpod architecture — drop a comment below!&lt;/p&gt;

</description>
      <category>flutter</category>
    </item>
  </channel>
</rss>
