Skip to content

Initial virtual world project setup - #1

Open
ghanshyam2005singh wants to merge 2 commits into
alphaonelabs:mainfrom
ghanshyam2005singh:feat/initial-project-setup
Open

Initial virtual world project setup#1
ghanshyam2005singh wants to merge 2 commits into
alphaonelabs:mainfrom
ghanshyam2005singh:feat/initial-project-setup

Conversation

@ghanshyam2005singh

@ghanshyam2005singh ghanshyam2005singh commented Aug 4, 2026

Copy link
Copy Markdown

Project Setup

  • Initialize the project with TypeScript
  • Configure Vite for development and production builds
  • Configure Wrangler for Cloudflare Workers deployment
  • Add SPA asset serving configuration
  • Configure npm scripts for development, build, preview, and deployment

Virtual World

  • Set up the initial Three.js scene
  • Add the basic virtual world structure
  • Configure the project for future expansion of interactive environments

Authentication

  • Integrate login and signup using the existing Learn platform API
  • Reuse the existing authentication flow instead of creating a separate backend
  • Configure API base URL through environment variables

Steps to actually deploy to Cloudflare:

  • npm install
  • Set up your .env from .env.example (only affects the build-time VITE_LEARN_API_BASE value)
  • wrangler login
  • npm run deploy — this is just npm run build && wrangler deploy per your package.json. It builds to dist/ then pushes it live via wrangler.

Summary

  • Initialized a TypeScript virtual world application with Vite and Three.js.
  • Added a Three.js scene with first-person controls, portals, activity data, lighting, fog, and responsive rendering.
  • Added login and registration flows that use the Learn platform API.
  • Added client-side authentication, session storage, logout, redirects, validation, and error handling.
  • Added interactive overlays for cursor lock, portal prompts, activity details, links, and logout.
  • Added Cloudflare Workers deployment with Wrangler and SPA asset serving.
  • Added environment-based API configuration and setup documentation.

The change provides the initial user experience for an interactive Alpha One Labs virtual world. Users can authenticate, enter the scene, move through the environment, and open activity links. Deployment requires dependency installation, .env configuration, Wrangler authentication, and npm run deploy.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ghanshyam2005singh, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 29 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b97c6377-3a62-410a-9f76-bb5e5e0279b1

📥 Commits

Reviewing files that changed from the base of the PR and between 7d5d01c and dd2c7fb.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • README.md
  • index.html
  • login.html
  • package.json
  • src/config.ts
  • src/login.ts
  • src/main.ts
  • src/ui/overlay.ts
  • src/world/controls.ts
  • src/world/scene.ts
  • tsconfig.json

Walkthrough

Added a Vite and TypeScript virtual world with Alpha One Labs authentication, a Three.js first-person scene, activity portals, interactive overlays, and Cloudflare deployment configuration.

Changes

Virtual experience

Layer / File(s) Summary
Project foundation
package.json, tsconfig.json, vite.config.ts, wrangler.toml, .gitignore, .env.example, README.md
Added project scripts, dependencies, compiler settings, Vite entry points, Wrangler asset serving, environment configuration, ignore rules, and setup documentation.
Authentication flow
src/auth.ts, src/config.ts, src/vite-env.d.ts, src/login.ts, login.html
Added login and registration behavior, API requests, validation, session storage, logout, same-origin redirects, and responsive authentication UI.
Three.js world runtime
src/types.ts, src/data/activities.ts, src/world/*
Added activity contracts and data, scene creation, first-person controls, portal rendering, labels, and nearest-portal detection.
Experience integration and overlay
index.html, src/ui/overlay.ts, src/main.ts
Added the virtual-world page, DOM overlay controls, authentication gating, pointer-lock interactions, portal panels, logout handling, and the animation loop.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Visitor
  participant LoginPage
  participant LearnAPI
  participant BrowserStorage
  participant VirtualApp
  Visitor->>LoginPage: submit login or registration form
  LoginPage->>LearnAPI: POST authentication request
  LearnAPI-->>LoginPage: return token and user or registration result
  LoginPage->>BrowserStorage: store authentication session
  LoginPage->>VirtualApp: redirect to virtual experience
  VirtualApp->>BrowserStorage: read authentication session
  VirtualApp->>VirtualApp: initialize scene and controls
  VirtualApp->>Visitor: show portal interaction overlay
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the initial virtual world project setup covered by the changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@index.html`:
- Around line 142-155: Update the HTML around `#blocker` to provide a native
keyboard-operable entry button and an always-available semantic activity list or
equivalent controls outside the canvas, with accessible labels and links for
screen-reader users. Review the surrounding template’s ARIA attributes and
semantic elements, and preserve the existing canvas interaction path for pointer
users.
- Around line 157-164: Update index.html at lines 157-164 so `#panel-card` has
dialog semantics using role="dialog", aria-modal="true",
aria-labelledby="panel-title", and aria-describedby="panel-description". Update
src/ui/overlay.ts at lines 59-81 in showPanel and hidePanel to save the invoking
element, focus a panel control after opening, trap Tab navigation within the
panel while open, and restore focus to the invoker after hiding.

In `@login.html`:
- Around line 233-235: Update the logo markup in the brand link by removing the
invalid closing </img> tag and adding an empty alt attribute to the logo image,
since the adjacent “Alpha One Labs” text provides the link label.

In `@package.json`:
- Around line 16-20: Add an engines.node declaration to the package manifest
requiring Node.js 20.19+ or 22.12+, and update README.md to document the same
supported Node.js range. Keep the requirement consistent between the manifest
and documentation.
- Line 19: Change the vite dependency declaration from the caret range to a
minor-line-constrained range such as ~8.2.0, then regenerate and commit the
corresponding lockfile so resolved dependency metadata matches the updated
constraint.

In `@README.md`:
- Around line 18-24: Update the README “Build & deploy” section to invoke the
locally installed Wrangler through npm or npx, remove the redundant npm run
build command because npm run deploy already performs the build, and document
VITE_LEARN_API_BASE setup or its fallback behavior alongside the deployment
command.

In `@src/config.ts`:
- Around line 1-2: Update the initialization of LEARN_API_BASE to parse the
configured or default URL and reject any non-HTTPS value before exporting it.
Preserve the existing HTTPS default, allow only an explicitly documented
loopback development exception if required, and verify production Wrangler
configuration cannot provide an HTTP API base.

In `@src/login.ts`:
- Around line 167-180: Update the registration-success UI flow around heading
and panel.replaceChildren so heading is programmatically focusable with tabIndex
= -1, then focus heading immediately after replacing the panel contents.
Preserve the existing success message and action-button behavior.
- Around line 63-74: Update callApi to bound fetch duration with an
AbortController and timeout, ensuring the timer is cleared in a finally block.
Detect abort timeouts and throw a clear retryable timeout error while preserving
existing API error handling for completed responses.

In `@src/main.ts`:
- Around line 31-38: Update the Escape branch in the keydown handler to restore
the world-entry state after overlay.hidePanel(), using the existing blocker
display or relock path used by the Close button so controls.lock() remains
available.

In `@src/world/controls.ts`:
- Around line 35-48: Normalize the combined forwardInput and rightInput vector
before applying movement in the control update. Adjust the values used by both
camera.position.addScaledVector calls so simultaneous forward/right input has
total speed MOVE_SPEED while preserving single-axis movement and zero-input
early return.
- Around line 18-21: Update the pointer-lock handling around onLockChange and
onKeyDown so movement key presses are ignored while the pointer is unlocked, and
reset all move state flags when pointer lock is lost. Register a window blur
handler to clear movement flags when focus leaves the document, preventing stale
move.<state> values when keyup events are missed.

In `@src/world/scene.ts`:
- Around line 22-24: Cap the value passed to renderer.setPixelRatio in the scene
initialization to a tested maximum device-pixel ratio, using the lower of
window.devicePixelRatio and that cap. Keep the existing renderer setup and
sizing behavior unchanged.

In `@tsconfig.json`:
- Line 15: Update the TypeScript project configuration’s include list to
type-check the root vite.config.ts alongside src. Ensure the widened project has
the required Node typings for node:path and import.meta.dirname, while
preserving the existing build type-check behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a9d1cd56-7759-4afe-89ec-dcadb73ddc77

📥 Commits

Reviewing files that changed from the base of the PR and between c161975 and 7d5d01c.

⛔ Files ignored due to path filters (2)
  • images/logo.png is excluded by !**/*.png
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (20)
  • .env.example
  • .gitignore
  • README.md
  • index.html
  • login.html
  • package.json
  • src/auth.ts
  • src/config.ts
  • src/data/activities.ts
  • src/login.ts
  • src/main.ts
  • src/types.ts
  • src/ui/overlay.ts
  • src/vite-env.d.ts
  • src/world/controls.ts
  • src/world/portals.ts
  • src/world/scene.ts
  • tsconfig.json
  • vite.config.ts
  • wrangler.toml

Comment thread index.html
Comment thread index.html
Comment thread login.html
Comment thread package.json
Comment thread package.json Outdated
Comment thread src/main.ts
Comment thread src/world/controls.ts
Comment thread src/world/controls.ts
Comment thread src/world/scene.ts
Comment thread tsconfig.json Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant