Skip to content

MrAtomAYT/studysprint

Repository files navigation

StudySprint

Free AI-powered study tools for Indian school students (Class 6–10) — paragraph writer, essay writer, speech writer, leave application generator, timetable maker, grammar improver, word meaning helper, answer simplifier, quiz generator, and topic explainer.

Built with Next.js 14 (App Router), TypeScript, Tailwind CSS, and a swappable AI provider layer (OpenAI / Claude / Gemini). Supabase is used for optional accounts, generation history, and saved timetables.


1. Project architecture

User → Tool page (app/tools/[slug]/page.tsx)
     → ToolShell (client component, renders form from lib/tools-config.ts)
     → POST /api/generate
         → lib/prompts.ts   (builds the prompt for that tool)
         → lib/ai.ts        (calls the configured AI provider)
         → lib/supabase.ts  (logs the generation, if Supabase is configured)
     ← { output, provider }
     → ToolShell renders result, copy / regenerate / reset

Every tool page is generated from a single dynamic route (app/tools/[slug]/page.tsx) driven by the central registry in lib/tools-config.ts. This keeps all 10 tools consistent (same layout, FAQ, related tools, how-to-use) while giving each one a unique URL, <title>, meta description, and content for SEO — edit one array to add a new tool or change copy on an existing one.

2. Folder structure

app/
  layout.tsx              Root layout, fonts, global metadata
  page.tsx                Homepage
  sitemap.ts              Dynamic sitemap.xml
  robots.ts               robots.txt
  tools/
    page.tsx              All-tools listing page
    [slug]/page.tsx        Dynamic tool page (SEO + form)
  api/generate/route.ts   Generation endpoint (validates + calls AI + logs)
  about/, contact/, privacy-policy/, terms/, disclaimer/
components/
  Navbar.tsx, Footer.tsx, AdSlot.tsx, FAQ.tsx, ToolCard.tsx, ToolShell.tsx
lib/
  tools-config.ts         Central registry: fields, copy, FAQs per tool
  prompts.ts              Prompt builder per tool
  ai.ts                   Swappable AI provider abstraction
  supabase.ts             Supabase client + generation logging
  utils.ts                Small shared helpers
types/
  tool.ts                 Shared TypeScript types
supabase/
  schema.sql              Full DB schema (profiles, tool_generations, saved_timetables, feedback)

3. Database schema (Supabase)

Table Purpose
profiles Extends auth.users with name, class, school
tool_generations One row per AI generation (analytics + history)
saved_timetables Saved timetables for logged-in users
feedback Contact/feedback form submissions

Row-Level Security is enabled on every table. Run supabase/schema.sql in your Supabase project's SQL editor to set everything up.

4. AI prompt system

lib/prompts.ts exports one buildPrompt(slug, inputs) function. Internally it shares a BASE_RULES block (school-appropriate content, class-matched vocabulary, non-robotic tone) across every tool, then applies a tool-specific builder function. Add a new tool by adding an entry to PROMPT_BUILDERS and a matching config in lib/tools-config.ts.


5. Running locally

npm install
cp .env.example .env.local
# fill in at least one AI provider key in .env.local (see below)
npm run dev

Visit http://localhost:3000. The app runs even with no AI key configuredlib/ai.ts falls back to a clearly-labelled demo response so you can see the full UI before wiring up a real provider.

Environment variables

Variable Required Notes
AI_PROVIDER No openai, claude, or gemini. Leave unset for demo mode.
OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY Yes (one) Only the key matching AI_PROVIDER is used.
NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY No Enables accounts, saved timetables, feedback form writes from the browser.
SUPABASE_SERVICE_ROLE_KEY No Server-only. Enables generation history logging from /api/generate. Never expose this to the client.
NEXT_PUBLIC_SITE_URL Recommended Used for canonical URLs, sitemap, and Open Graph tags.
NEXT_PUBLIC_ADS_ENABLED No Set to true once AdSense is approved to render <AdSlot /> placeholders.

Supabase setup

  1. Create a free project at supabase.com.
  2. Go to SQL Editor → New query, paste the contents of supabase/schema.sql, and run it.
  3. Copy your Project URL and anon key from Project Settings → API into .env.local.
  4. Copy the service_role key (also under Project Settings → API) into SUPABASE_SERVICE_ROLE_KEY — keep this secret, server-side only.

Adding your AI provider key

  • OpenAI: get a key from platform.openai.com, set AI_PROVIDER=openai and OPENAI_API_KEY.
  • Claude: get a key from console.anthropic.com, set AI_PROVIDER=claude and ANTHROPIC_API_KEY.
  • Gemini: get a key from Google AI Studio, set AI_PROVIDER=gemini and GEMINI_API_KEY.

6. Deploying to Vercel

  1. Push this project to a GitHub repository.
  2. Go to vercel.com/new and import the repo.
  3. Add the same environment variables from .env.local in the Vercel project settings.
  4. Deploy. Vercel will run next build automatically.
  5. Point your custom domain (e.g. studysprint.in) at the Vercel project, and update NEXT_PUBLIC_SITE_URL accordingly.

7. Post-MVP roadmap

Top pages to build next for SEO

  1. /tools/paragraph-writer/class-8 style class-specific landing pages for top 5 tools
  2. Blog: "How to Write a Good Paragraph for Class 8"
  3. Blog: "Best Timetable Tips for School Students"
  4. Blog: "How to Improve Grammar for School Answers"
  5. Blog: "How to Write a Leave Application to Your Principal"
  6. Blog: "CBSE vs ICSE: How to Write Essays for Each Board"
  7. /tools/paragraph-writer/examples — a gallery of sample outputs by topic
  8. Comparison/landing page: "Best AI Homework Helper for Indian Students"
  9. /subjects/science, /subjects/social-science, /subjects/english topic hubs
  10. City/board-specific landing pages if you expand into tutoring or courses later

Extra tools to consider

  • Debate / GD argument generator
  • Story writer (for English creative writing sections)
  • Letter writer (informal letters, not just leave applications)
  • Notes summarizer (long chapter → bullet notes)
  • Flashcard generator from a topic
  • Diary entry writer
  • Project report outline generator

Growing traffic

  • Publish 2–4 blog posts a week targeting long-tail, homework-style queries ("how to write a paragraph on...")
  • Get each tool page indexed via Google Search Console and submit the sitemap
  • Build internal links between blog posts and the relevant tool page
  • Add FAQ schema (JSON-LD) to tool pages to earn rich snippets
  • Share useful outputs (timetables, quizzes) as shareable images for social platforms popular with students

Improving ad revenue later

  • Apply for AdSense once you have consistent organic traffic and full legal pages (already included)
  • Turn on NEXT_PUBLIC_ADS_ENABLED=true and replace AdSlot internals with real AdSense <ins> tags
  • Test ad density carefully — keep below-result and between-sections slots only at first
  • Consider a lightweight "StudySprint Plus" tier (saved history, unlimited generations, no ads) once traffic is meaningful

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors