Skip to content
appdev-at-mitPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

SideQuest

SideQuest is a React and TypeScript app with an Express API and MongoDB persistence. It helps users agree on local tasks and records the participants’ self-reported progress, completion, and external reward confirmations.

Local development

Use Node.js 22.12+ and Docker, start the local MongoDB replica set with docker compose up -d --wait, then copy backend/.env.example to backend/.env and set a random SESSION_SECRET of at least 32 characters. MAX_QUEST_REWARD_CENTS optionally configures the maximum reward in cents (default 100000, or $1,000.00; quests currently require at least $3.00). Start the API with npm start from backend and the frontend with npm run dev from frontend.

Identity and payment boundaries

Accounts use a local username and password. A Kerberos-style username or @mit.edu-looking name is not authentication by MIT, and this app currently does not verify school affiliation. Do not describe users as verified students. Backend controllers use a provider-neutral req.auth principal with the MongoDB user ID, alias, and application roles. Passport sessions store that stable ID; existing sessions that contain a Kerberos alias remain readable. User records reserve provider and verified identity identifiers for a future approved provider, but local signup always creates an unverified identity. New quest, message, notification, review, report, and moderation relationships include stable user IDs while legacy Kerberos references remain available during migration.

Rewards are amounts the two participants agree to pay directly using their chosen external method, such as cash, PayPal, Venmo, Cash App, or Zelle. SideQuest does not process, escrow, hold, guarantee, reverse, verify, or insure payment. The requester reports when they sent a reward and the completer confirms only if they actually received it. Those statements are self-reported. The app stores only a selected method and user-entered payment instructions; users should not enter passwords, account credentials, or sensitive financial data. Browser sessions use HTTP-only, SameSite=Lax cookies; production requires HTTPS.

Production operators should use a MongoDB deployment with TLS and encryption at rest, keep secrets in a secret manager, and back up transaction records with an appropriate retention policy. Quest photos and completion receipt images use a private MongoDB-backed image store. The API accepts only bounded JPEG, PNG, and WebP uploads, validates their signatures and decoded image content, re-encodes them to WebP without source metadata, and checks authorization on every image download. Unattached uploads are removed after 24 hours; per-user and global storage quotas can be configured with MAX_USER_IMAGE_STORAGE_BYTES and MAX_GLOBAL_IMAGE_STORAGE_BYTES. Upload decoding limits can be configured with MAX_IMAGE_BYTES, MAX_IMAGE_WIDTH, MAX_IMAGE_HEIGHT, MAX_IMAGE_PIXELS, and MAX_CONCURRENT_IMAGE_UPLOADS.

No payment encryption API is required because the app does not collect card or bank credentials. If a future product decision introduces payment processing, use a payment provider’s hosted checkout or hosted onboarding so the SideQuest servers never receive card numbers or bank credentials. Do not add client-side encryption as a substitute for a payment provider or TLS.

Quest workflow

Quest state progresses through open, in_progress, pending_review, awaiting_payment, payment_sent, and completed. Either participant can open a dispute while the transaction is active. Completion reviews are tied to the quest and can be submitted once by each participant after receipt is confirmed. Quest agreements snapshot the description, category, reward in integer cents, locations, timing, and the completer’s payment preference at acceptance. Open listings stop appearing after their deadline; unattended quests are soft-deleted 24 hours after that deadline, while accepted transaction records remain for accountability.

Delivery quests use these stages within the existing quest lifecycle.

flowchart LR
  A[Accepted] --> B[Heading to pickup]
  B --> C[Arrived at pickup]
  C -->|Confirm| D[Picked up]
  D --> E[Heading to drop-off]
  E -->|Confirm| F[Delivered]
  B --> A
  C --> B
  E --> D
  D -. Requester approves correction .-> C
  F -. Requester approves correction .-> E
  F --> G[Requester approves completion]
  G --> H[Requester reports external payment sent]
  H --> I[Deliverer confirms receipt]
Loading
  • POST /api/requests/:id/delivery accepts an action, the current version, and a unique operationId. The deliverer can advance, return from a reversible stage, undo within 10 seconds, or request a correction. The requester can approve or decline corrections. Pending delivery corrections block completion approval. Physical milestones require explicit confirmation.
  • MongoDB stores deliveryStage, deliveryVersion, deliveryMilestones, deliveryUndoUntil, deliveryCorrection, and append-only deliveryAudit on the quest. Older accepted deliveries derive their starting stage from the existing progress and quest status fields. Delivery transitions and their notifications commit together. Forward and ordinary backward notifications are deduplicated per stage and assignment. Correction requests and decisions have separate notifications.
  • The requester can see the address they posted. Other viewers see a broad destination estimate before acceptance, and the assigned deliverer receives the precise drop-off address after confirming pickup. The estimate uses a straight-line distance band. A correction can hide the address again from later responses. Information already seen cannot be recalled.
  • GET /api/quests/:id supplies the current stage, timeline, and eligible shared location. GET /api/requests/:id/directions uses recent shared location. POST to the same endpoint lets an assigned deliverer route with a private origin that SideQuest does not retain. Both select the destination on the server and use the existing routing limits. DELIVERY_PICKUP_RADIUS_METERS defaults to 100. A sufficiently accurate location well outside that radius prompts for another confirmation. Pickup still relies on the deliverer’s statement.
  • Before pickup, cancellation by the deliverer reopens an eligible listing or expires it if the deadline has passed. Once pickup is confirmed, participants can report a problem and coordinate a return or other resolution through the quest. Confirming delivery opens requester review and stops location sharing. The external reward and review flow follows requester approval.

User discovery

Search matches lowercased username prefixes and name-token prefixes, prioritizes an exact username, returns ten results per page, and allows twenty pages at most. The UI debounces search by 300 ms and aborts stale requests. Suggestions rank a bounded pool of up to 40 eligible accounts (public metrics are loaded for at most 30 candidates) with configured weights: interests 0.30, campus region 0.25, quest-category Jaccard similarity 0.20, successful completed interactions 0.15, and rating plus recent account activity 0.10. Missing signals are omitted and remaining weights are renormalized. The backend returns short evidence-based reasons, never scores. Recent searches record only profiles the user selects, expire after 30 days, and can be cleared at any time. Search and suggestion eligibility exclude self, either-side blocks, suspended/deactivated/deleted accounts, and users who disable public discovery. Users may opt out of personalized ranking separately.

Discovery fields are interests, coarse voluntary campusRegion, personalizedRecommendationsEnabled, publicDiscoveryEnabled, and server-maintained kerbSearch, namePrefixes, and lastActiveAt. Indexes cover normalized username search, name prefixes, activity ordering, reverse-block lookup, and private recent/impression records. Default weights can be overridden with USER_RECOMMENDATION_WEIGHTS containing JSON keys interests, campus, activity, interactions, and reputationActivity; for example {"interests":0.3,"campus":0.25,"activity":0.2,"interactions":0.15,"reputationActivity":0.1}. Invalid configuration falls back to defaults. Cold-start users use recent activity/account age ordering and any available campus signal; an explanation is omitted unless backed by a real matching signal. Recommendation impressions are retained for 30 days and apply a modest seven-day repeat penalty to reduce showing the same users every visit.

Moderation configuration

Set ADMIN_KERBS to an explicit comma-separated allowlist of administrator usernames. Moderation can issue a warning, add a strike, temporarily suspend, permanently suspend, or reinstate an account. MODERATION_STRIKES_FOR_SUSPENSION controls the strike threshold (default 3; 0 disables automatic strike suspension) and MODERATION_SUSPENSION_HOURS controls temporary suspension duration (default 72). Administrative actions and dispute decisions are recorded in the audit collection. Reports and disputes accept text notes only; avoid uploading or sharing sensitive evidence.

Quest publication supports server-side MODERATION_MODE=auto_approve|basic|full. It defaults to local-only auto_approve in development and full in production. Auto-approval refuses production, hosted runtimes, public app URLs, or non-loopback MongoDB. Basic mode uses the existing versioned rules, adds lightweight spam checks and optional literal review phrases, and routes uncertain content and all quest images to human review. It does not provide contextual or image moderation. Full mode retains the current policy and manual review flow. All modes retain backend validation, sanitization, upload security, authorization, CSRF, rate limits, deadline/reward checks, and suspension enforcement. Give trusted moderator accounts the moderator role or set MODERATOR_KERBS to a comma-separated allowlist; ADMIN_KERBS remains supported. Moderators can review text and sanitized quest images in the Admin review page. Policy version, approval source, and decisions are retained with moderation history and the audit collection. A local-only administrator utility in that page can publish selected eligible pending test quests; it excludes removed, reported, or previously rejected quests.

For a deployed app, set APP_BASE_URL or FRONTEND_ORIGIN to its exact HTTPS origin. The API checks request origins for writes and applies per-process IP request limits. Local Vite ports are allowed only outside production. A multi-instance production deployment should replace the in-memory limiter with a shared store.

See DEPLOYMENT.md for the Cloudflare Pages, Render, MongoDB, GitHub, health-check, and scheduled-job setup. Hosted credentials belong in provider secret settings, never in a Vite variable or committed .env file.

Checks

From backend, run node --test quest-lifecycle.test.js. From frontend, run npm run build.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages