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.
- 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
- 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
npm install
cp .env.example .env.local
npm run db:push
npm run devRequired 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- Import this repo in Vercel.
- Add
DATABASE_URL,HF_API_TOKEN,HF_MODEL_ID. - Provision Neon DB and copy connection string.
- Run Prisma schema push once:
- local:
npm run db:push - or Vercel build command extension if preferred.
- local:
PWA files:
public/manifest.webmanifestpublic/sw.jspublic/icons/*
Install prompt appears on supported browsers after first load.
Generate premium class branding assets:
npm run assets:brandOutputs:
public/brand/premium-icon.pngpublic/brand/app-preview.gif
If GEMINI_API_KEY is set, script also attempts Gemini image generation and writes:
public/brand/premium-icon-gemini.png
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.
- 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.tsto call your endpoint/provider.
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
npm run dev- local developmentnpm run build- production buildnpm run start- start servernpm run lint- lint projectnpm run db:push- push Prisma schema to Neonnpm run db:studio- open Prisma Studionpm run mobile:sync- sync Capacitornpm run mobile:open- open Android projectnpm run assets:brand- generate icon + preview GIF assets
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.ymlLegacy plain-JS files are still present in history; v4 runtime uses the new Next.js codepath.
