A comprehensive web application for BRAC University admission candidates to practice with mock exams, track their progress, and prepare effectively for admission tests.
- User Authentication: Sign up, login, and logout with email/password or Google OAuth
- Mock Test Plans: Browse and purchase different mock test plans
- Online Exams: Take timed mock exams with real-time timer
- Results & Analytics: View detailed results with subject-wise breakdown
- Performance Tracking: Track your progress across multiple exams
- Exam Management: Create and manage mock exams
- Question Bank: Add and manage questions for exams
- Dashboard: View system statistics and analytics
- Frontend: Next.js 14 (App Router), TypeScript, TailwindCSS, ShadCN UI
- Backend: Next.js API Routes
- Database: PostgreSQL (via Supabase or local)
- ORM: Prisma
- Authentication: NextAuth.js
- Payments: Stripe (Test Mode)
- Deployment: Vercel
- Node.js 18+ and npm/yarn
- PostgreSQL database (Supabase free tier recommended)
- Stripe account (for test mode)
- (Optional) Google OAuth credentials
-
Clone the repository
git clone <repository-url> cd MockVerse
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env
Edit
.envand add your configuration:# Database DATABASE_URL="postgresql://user:password@localhost:5432/mockverse?schema=public" # NextAuth NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="your-secret-key-here-generate-with-openssl-rand-base64-32" # Google OAuth (Optional) GOOGLE_CLIENT_ID="" GOOGLE_CLIENT_SECRET="" # Stripe NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..." STRIPE_SECRET_KEY="sk_test_..." STRIPE_WEBHOOK_SECRET="whsec_..." # Supabase (if using Supabase) NEXT_PUBLIC_SUPABASE_URL="" NEXT_PUBLIC_SUPABASE_ANON_KEY="" SUPABASE_SERVICE_ROLE_KEY=""
-
Set up the database
# Generate Prisma Client npx prisma generate # Push schema to database npx prisma db push # Seed the database npm run db:seed
-
Run the development server
npm run dev
Open http://localhost:3000 in your browser.
- Create a free account at supabase.com
- Create a new project
- Go to Project Settings > Database
- Copy the connection string and update
DATABASE_URLin.env - Run
npx prisma db pushto create tables
- Install PostgreSQL locally
- Create a database:
CREATE DATABASE mockverse;
- Update
DATABASE_URLin.env - Run
npx prisma db pushto create tables
The app uses NextAuth.js with credentials provider. User passwords are handled through NextAuth's built-in mechanisms.
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/google - Copy Client ID and Client Secret to
.env
- Create a free account at stripe.com
- Go to Developers > API keys
- Copy your test keys:
- Publishable key β
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY - Secret key β
STRIPE_SECRET_KEY
- Publishable key β
- Set up webhook (for production):
- Go to Developers > Webhooks
- Add endpoint:
https://yourdomain.com/api/webhooks/stripe - Copy webhook secret β
STRIPE_WEBHOOK_SECRET
MockVerse/
βββ app/ # Next.js App Router
β βββ api/ # API routes
β βββ auth/ # Authentication pages
β βββ dashboard/ # User dashboard
β βββ admin/ # Admin pages
β βββ pricing/ # Pricing page
βββ components/ # React components
β βββ ui/ # ShadCN UI components
βββ lib/ # Utility functions
βββ prisma/ # Prisma schema and migrations
βββ public/ # Static assets
- Sign Up: Create an account at
/auth/signup - Browse Plans: View available plans at
/pricing - Purchase Plan: Click "Purchase Plan" to checkout with Stripe
- Take Exams: Go to Dashboard > Exams and start an exam
- View Results: Check your results and analytics after completing an exam
- Login: Use an admin account (created via seed script)
- Create Exam: Go to Admin > Create Exam
- Add Questions: Go to Admin > Add Questions
- Manage: View statistics and manage content from Admin Dashboard
The seed script creates an admin user:
- Email:
admin@mockverse.com - You'll need to set up authentication separately
To create an admin user manually:
UPDATE "User" SET role = 'admin' WHERE email = 'your-email@example.com';- Push your code to GitHub
- Import project in Vercel
- Add environment variables in Vercel dashboard
- Deploy!
Make sure to set all environment variables in your hosting platform:
DATABASE_URLNEXTAUTH_URL(your production URL)NEXTAUTH_SECRETSTRIPE_SECRET_KEYNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYSTRIPE_WEBHOOK_SECRET
npm run dev- Start development servernpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLintnpm run db:push- Push Prisma schema to databasenpm run db:studio- Open Prisma Studionpm run db:seed- Seed database with sample data
- Verify
DATABASE_URLis correct - Ensure database is running
- Check firewall settings if using remote database
- Verify
NEXTAUTH_SECRETis set - Check
NEXTAUTH_URLmatches your domain - Ensure OAuth credentials are correct (if using Google)
- Use test mode keys (starts with
pk_test_andsk_test_) - Verify webhook endpoint is configured correctly
- Check Stripe dashboard for payment logs
This project is open source and available under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.
For support, please open an issue in the repository.
Built with β€οΈ for BRAC University admission candidates