Skip to content

palveVaishnav/newQuizrr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

Quizrr

Quizrr is a project that leverages Go, Prisma, PostgreSQL, and Next.js to create a quiz platform. This README will guide you through the setup and installation process for both the backend and frontend.

Getting Started

Clone the Repository

git clone https://github.com/palveVaishnav/newQuizrr.git
cd newQuizrr

Database Setup

PostgreSQL database using Docker:

docker run --name quizrr \
   -e POSTGRES_USER=postgres \
   -e POSTGRES_PASSWORD=password \
   -e POSTGRES_DB=quizrr-new \
   -p 5432:5432 \
   -d postgres

DB URL:

docker exec -it quizrr psql -U postgres -d quizrr-new

Prisma ORM and Database Migration

Whenever you make changes to the Prisma schema, you need to migrate your database and re-generate the Prisma Go client.

  1. Set the .env file for the backend:

    DATABASE_URL="postgresql://postgres:password@localhost:5432/quizrr-new"
  2. Prisma Commands:

    • To re-generate the Go client:
      go run github.com/steebchen/prisma-client-go generate
    • To sync the database with your schema for development:
      go run github.com/steebchen/prisma-client-go db push
    • To create a Prisma schema from your existing database:
      go run github.com/steebchen/prisma-client-go db pull
    • For production, create a migration:
      go run github.com/steebchen/prisma-client-go migrate dev
    • To sync your production database with your migrations:
      go run github.com/steebchen/prisma-client-go migrate deploy

Backend Setup

  1. Navigate to the backend directory:

    cd backend
  2. Install dependencies and tidy up modules:

    go mod tidy
  3. Start the backend server:

    cd cmd
    air # or go run main.go

Seeding the Database

To seed the database, send a GET request to the /seed route:

http://127.0.0.1:8080/seed

Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Run the development server:

    npm run dev

Environment Variables

Create a .env file in the frontend directory with the following content:

NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=password_nextauth
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
NEXT_PUBLIC_API="http://127.0.0.1:8080"

Progress

  • Home page: Placeholder page, not functional.
  • Packs and Results: Fully working.
  • Tests: Pixel-perfect design with functional testing and result viewing.
  • Timer: works,
  • No Payment Gateway: Not implemented yet.

Releases

No releases published

Packages

No packages published

Languages