Skip to content

prakash-218/two-pointers

Repository files navigation

Two Pointers

Minimalist 1v1 competitive coding dashboard built with React, Tailwind, and Firebase.

Local setup

  1. Install dependencies:
    • npm install
  2. Create a .env file in the project root and add:
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_APP_ID=your_app_id
VITE_ALLOWED_UIDS=first_uid,second_uid
VITE_CHALLENGE_EDITOR_UIDS=first_uid
  1. Start the app:
    • npm run dev

Auth behavior

  • Sign-in uses Firebase Auth (Google popup).
  • Dashboard access is restricted to UIDs listed in VITE_ALLOWED_UIDS.
  • Signed-in but unauthorized users see a restricted-access card and can sign out.

Firestore schema

Use these collections and fields:

  • users/{uid}:
    • uid: string
    • name: string
    • avatar: string
    • streak: number
    • lastCompletedDate: string (optional, YYYY-MM-DD)
  • challenges/{YYYY-MM-DD}:
    • date: string (same as document ID)
    • title: string
    • problemLink: string
    • playerAId: string
    • playerBId: string
  • results/{challengeId_userId}:
    • challengeId: string
    • userId: string
    • runtime: number
    • memory: number
    • completedAt: string
  • progress/{challengeId_userId}:
    • challengeId: string
    • userId: string
    • completedAt: string

Security rules

The repo includes server-side Firestore rules in firestore.rules that enforce:

  • only participant users can access data
  • a player can always read their own result
  • opponent result is readable only after both players submitted

Deploy with Firebase CLI:

  • firebase deploy --only firestore:rules

Curate Blind 75 for next 75 days

  • Open the Challenge Admin card.
  • Set a start date in Blind 75 Scheduler.
  • Click Schedule Blind 75 (Next 75 Days).

This bulk-writes one challenge per day into challenges/{YYYY-MM-DD} using a curated 75-problem list.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors