Commit is a mobile-first social productivity application that bridges the gap between personal ambition and community accountability. By leveraging the Google Gemini API, we moved beyond simple "chatbots" to create an application where AI actively architects the user's database state and daily schedule. 💡 Inspiration The inspiration for Commit came from a shared frustration: Habit trackers are isolating, and social media is distracting. We live in a world where we get dopamine hits for scrolling, but zero validation for reading a book, going for a run, or learning to code. We wanted to build "Strava for Life"—a place where the "Proof of Work" mechanism found in fitness apps could be applied to any domain (Career, Mental Health, Learning). However, the biggest friction point in self-improvement is Decision Paralysis. People want to "get fit" but don't know what exercises to do today. We realized that by using Gemini 1.5 Flash, we could solve the "what do I do?" problem instantly, while the social feed solves the "why should I do it?" problem. ⚙️ How We Built It The application is built as a responsive Single Page Application (SPA) using React (TypeScript), Vite, and Tailwind CSS. The Core Engine: Gemini as a Backend Logic Layer The most innovative part of Commit is how we utilize the @google/genai SDK. Instead of treating the LLM as a text generator, we treated it as a deterministic logic processor. Structured Plan Generation: When a user inputs a vague goal (e.g., "Learn Python"), we don't just ask Gemini for advice. We use the responseSchema and responseMimeType: "application/json" configuration to enforce a strict recursive data structure. Gemini generates a schedule_cycle array containing setup_tasks and daily routines. The app parses this JSON and immediately renders it into interactive checklists and calendar views. Natural Language State Mutation (Hot-Swapping): The "AI Coach" feature allows users to modify their app state via conversation. If a user tells the coach, "I injured my knee," Gemini analyzes the context of the current day's tasks and returns a JSON payload with a suggested_tasks array. The frontend detects this key and hot-swaps the database entry for that specific date in real-time. This turns natural language directly into application state updates. The Algorithm: Streak Calculation To make the gamification robust, we implemented a custom streak calculation engine. The challenge was handling "Skipped Days" (which shouldn't break a streak) versus "Missed Days." We define the set of completed dates as and the set of legitimate skip dates as . The streak for a given date is calculated by traversing backwards from today ( ): Where the indicator function represents a valid streak day: This logic ensures that users aren't punished for using their earned "Skip Days," maintaining the psychological momentum required for habit formation. 🚧 Challenges We Faced The "Hallucination" of Structure: Early on, the AI would occasionally return valid JSON that didn't match our TypeScript interfaces (e.g., missing the day_title key). Solution: We utilized the SystemInstruction feature in Gemini 1.5 to provide one-shot examples of the exact JSON structure required, significantly increasing reliability. Date Math & Timezones: Mapping a static "Day 1, Day 2" cycle generated by AI to a real-world calendar with skipped dates was complex. Solution: We built a "Virtual Day" mapping engine. The app calculates an effectiveDayNum by subtracting the count of skipped dates ( ) from the raw calendar duration. Visual Latency: Generative AI can take a few seconds. To prevent user drop-off during plan generation, we implemented optimistic UI updates and a skeleton loading state that explains what the AI is "thinking" (e.g., "Designing schedule cycle...", "Calculating rest days..."). 🧠 What We Learned Gemini 1.5 Flash is a UI Builder: We learned that LLMs are incredible at generating configuration objects. Instead of building a complex "Edit Schedule" UI form, we just let the user talk to the schedule, and let Gemini rewrite the JSON object behind the scenes. Social + AI is the Future: AI apps often feel lonely. By combining the AI utility with a "Stories" feature (viewable by friends), the app feels alive. The AI provides the path, but the community provides the fuel. Prompt Engineering is Logic Programming: crafting the prompt for the coach wasn't about writing good English; it was about writing good logic constraints (e.g., "If the user asks to change the routine, you MUST output the suggested_tasks key").

Built With

Share this project:

Updates