AI Vita is a full-stack web application built with Next.js (frontend) and Express (backend). It includes chat, diagnostics, personality assessment, reporting, subscription flows, and integrations such as Supabase, OpenAI, Stripe, and LINE.
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- Backend: Express, TypeScript, Prisma
- Database/Auth: Supabase, PostgreSQL
- Integrations: OpenAI, Stripe, LINE Messaging API, Redis (optional)
src/: Frontend application (Next.js App Router)backend/: Backend API serverbackend/prisma/: Prisma schema and migrations.env.example: Frontend environment templatebackend/.env.example: Backend environment template
- Node.js 20+ (Node 22 is recommended)
- npm
- PostgreSQL (for backend database)
Install frontend dependencies in the project root:
npm installInstall backend dependencies:
cd backend
npm installFrontend:
- Copy
.env.exampleto.env.local. - Set at least:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYNEXT_PUBLIC_LINE_OFFICIAL_ID
Backend:
- Copy
backend/.env.exampletobackend/.env. - Configure:
PORTDATABASE_URLSUPABASE_JWKS_URLSUPABASE_ISSUERSUPABASE_AUDIENCEOPENAI_API_KEY- Stripe and LINE variables if those features are used
cd backend
npm run migrate:devStart backend API:
cd backend
npm run devIn another terminal, start frontend:
npm run devDefault URLs:
- Frontend:
http://localhost:3000 - Backend:
http://localhost:5000(or the value ofPORT)
Frontend:
npm run build
npm run startBackend:
cd backend
npm run build
npm run startFrontend (root):
npm run dev- Start Next.js in development modenpm run build- Build frontend for productionnpm run start- Start frontend in production modenpm run lint- Run Next.js lint
Backend (backend/):
npm run dev- Start backend with watch modenpm run build- Compile backend TypeScriptnpm run start- Start backendnpm run migrate:dev- Create/apply Prisma migration in developmentnpm run migrate:deploy- Apply migrations in deploymentnpm run prisma:studio- Open Prisma Studio
- Do not commit real secrets in
.envfiles. - Update
FRONTEND_URLand callback/webhook URLs for your environment. - If webhooks are used (Stripe/LINE), ensure your public endpoint is reachable and correctly configured.