Skip to content

shiroonigami23-ui/Smart-Study

Repository files navigation

Smart Study Hub v4

Next.js TypeScript Neon Prisma PWA Ready Android APK

Modern full-stack rebuild of Smart Study from plain JavaScript into a Vercel + Neon architecture with server-side AI routing, persistence, installable PWA, and Android APK pipeline.

Smart Study Preview

Live Stack

  • Frontend/Backend: Next.js App Router (TypeScript)
  • Hosting: Vercel
  • Database: Neon Postgres via Prisma
  • AI Inference: Hugging Face Inference API (HF_API_TOKEN)
  • AI Inference (Primary): Gemini API (GEMINI_API_KEY)
  • AI Fallback: Hugging Face Inference API (HF_API_TOKEN)
  • Fallback: Local deterministic generators if model call fails
  • PWA: Manifest + Service Worker + app icons
  • Android: Capacitor + GitHub Actions APK release attachment

Core Features

  • AI summary, notes, quiz, flashcards, and chat
  • File ingestion: TXT, PDF, DOCX, EPUB, image OCR
  • Server-side model calls (no browser-exposed API key)
  • Progress tracking (XP, streak, saved outputs) in Neon
  • Study library persistence
  • Google sign-in via NextAuth + Prisma sessions
  • Mobile-first responsive UI
  • Installable PWA assets

Quick Start

npm install
cp .env.example .env.local
npm run db:push
npm run dev

Required env:

DATABASE_URL=postgresql://...
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
NEXTAUTH_SECRET=...
NEXTAUTH_URL=http://localhost:3000
GEMINI_API_KEY=...
GEMINI_MODEL=gemini-2.5-flash
HF_API_TOKEN=hf_xxx
HF_MODEL_ID=mistralai/Mistral-7B-Instruct-v0.3

Deploy To Vercel + Neon

  1. Import this repo in Vercel.
  2. Add DATABASE_URL, HF_API_TOKEN, HF_MODEL_ID.
  3. Provision Neon DB and copy connection string.
  4. Run Prisma schema push once:
    • local: npm run db:push
    • or Vercel build command extension if preferred.

PWA

PWA files:

  • public/manifest.webmanifest
  • public/sw.js
  • public/icons/*

Install prompt appears on supported browsers after first load.

Brand Assets (Icon + GIF)

Generate premium class branding assets:

npm run assets:brand

Outputs:

  • public/brand/premium-icon.png
  • public/brand/app-preview.gif

If GEMINI_API_KEY is set, script also attempts Gemini image generation and writes:

  • public/brand/premium-icon-gemini.png

Android APK (Real Native Package)

This repo includes Capacitor and CI workflow:

  • Config: capacitor.config.ts
  • Mobile web bundle: mobile-web/
  • Release workflow: .github/workflows/android-release.yml

On GitHub Release publish, workflow builds app-debug.apk and attaches it to the release assets.

Hugging Face / Custom Model Notes

  • Default uses HF hosted model via HF_MODEL_ID.
  • You can switch to your own fine-tuned model by changing HF_MODEL_ID.
  • For advanced hosted custom endpoints, extend lib/ai.ts to call your endpoint/provider.

Repo Description & Tags (GitHub settings suggestion)

Description: AI-powered study platform with Next.js, Neon Postgres, Hugging Face inference, PWA install support, and Android APK releases.

Topics/Tags: nextjs, typescript, vercel, neon, postgres, prisma, pwa, android, capacitor, ai, huggingface, study-app

Scripts

  • npm run dev - local development
  • npm run build - production build
  • npm run start - start server
  • npm run lint - lint project
  • npm run db:push - push Prisma schema to Neon
  • npm run db:studio - open Prisma Studio
  • npm run mobile:sync - sync Capacitor
  • npm run mobile:open - open Android project
  • npm run assets:brand - generate icon + preview GIF assets

Project Structure

app/
  api/
    ai/
    profile/
    study-items/
  layout.tsx
  page.tsx
lib/
  ai.ts
  db.ts
  fallback.ts
prisma/
  schema.prisma
public/
  icons/
  manifest.webmanifest
  sw.js
mobile-web/
.github/workflows/android-release.yml

Legacy plain-JS files are still present in history; v4 runtime uses the new Next.js codepath.