Skip to content

docs: add backend API setup guide for Verilog and backend features#827

Open
Me-Priyank wants to merge 6 commits intoCircuitVerse:mainfrom
Me-Priyank:docs/backend-api-setup
Open

docs: add backend API setup guide for Verilog and backend features#827
Me-Priyank wants to merge 6 commits intoCircuitVerse:mainfrom
Me-Priyank:docs/backend-api-setup

Conversation

@Me-Priyank
Copy link
Contributor

@Me-Priyank Me-Priyank commented Jan 19, 2026

Fixes #826

Describe the changes you have made in this PR -

This PR adds comprehensive backend API setup documentation to help new contributors configure the development environment for backend-dependent features (Verilog compilation, Save/Load, Authentication, etc.).

Changes Made:

✅ Added .env.example template with clear backend configuration options
✅ Added "Backend API Setup" section to README.md (72 lines)
✅ Enhanced vite.config.ts proxy with environment variable support and logging
✅ Updated .gitignore to prevent committing .env secrets

Impact:

  • Helps every new contributor set up development environment
  • Documents 12 API endpoints (Verilog, Save/Load, Auth, Permissions, Issues)
  • Faster onboarding, fewer setup questions

Screenshots of the UI changes (If any) -

Verilog working:

Screen.Recording.2026-01-19.223303.mp4

Auth working:

Screen.Recording.2026-01-19.224906.mp4

Code Understanding and AI Usage

Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?

  • No, I wrote all the code myself
  • Yes, I used AI assistance (continue below)

If you used AI assistance:

  • I have reviewed every single line of the AI-generated code
  • I can explain the purpose and logic of each function/component I added
  • I have tested edge cases and understand how the code handles them
  • I have modified the AI output to follow this project's coding standards and conventions

Explain your implementation approach:

Why This Implementation:

  • Uses .env files (industry standard for configuration)
  • Allows each developer to choose their backend (production/local/staging)
  • Self-documenting through .env.example
  • Non-breaking change (just documentation)
  • Follows existing vite.config.ts structure (proxy already existed!)

Alternative Approaches Considered:

  • Hardcode proxy URL - ❌ Not flexible, every developer would use same backend
  • No documentation - ❌ Keeps confusion for new contributors
  • Environment variable approach - ✅ CHOSEN - Flexible, professional, standard practice

How It Works:

  • Developer copies .env.example to .env
  • Chooses backend URL (production/local/staging)
  • Vite loads VITE_API_URL from .env
  • Proxy forwards /api/* requests to configured backend
  • All backend features work seamlessly

Testing:

  • Verified with production API (Verilog compilation works)
  • Tested proxy logging (request/response logs appear)
  • Confirmed .env is gitignored
  • Checked documentation clarity

Checklist before requesting a review

  • I have added proper PR title and linked to the issue
  • I have performed a self-review of my code
  • I can explain the purpose of every function, class, and logic block I added
  • I understand why my changes work and have tested them thoroughly
  • I have considered potential edge cases and how my code handles them
  • If it is a core feature, I have added thorough tests
  • My code follows the project's style guidelines and conventions

Note: Please check Allow edits from maintainers if you would like us to assist in the PR.

Summary by CodeRabbit

  • Documentation

    • Added Backend API Setup instructions with production, staging, and local backend guidance and a local development workflow.
  • New Features

    • Enabled environment-aware API proxying for selectable backend targets.
  • Chores

    • Added an example environment file and updated ignore rules to exclude local environment files from version control.

✏️ Tip: You can customize this high-level summary in your review settings.

@netlify
Copy link

netlify bot commented Jan 19, 2026

Deploy Preview for circuitverse ready!

Name Link
🔨 Latest commit cb21bcb
🔍 Latest deploy log https://app.netlify.com/projects/circuitverse/deploys/697e2fb438b41f000810f75b
😎 Deploy Preview https://deploy-preview-827--circuitverse.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 47 (🟢 up 1 from production)
Accessibility: 73 (no change from production)
Best Practices: 92 (no change from production)
SEO: 82 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Warning

Rate limit exceeded

@Me-Priyank has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 9 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

Adds a new .env.example exposing VITE_API_URL options (production active, local and staging commented), adds .env to .gitignore, updates vite.config.ts to use loadEnv(mode, ...) and make the config mode-aware, adds a '/api' dev-server proxy using env.VITE_API_URL with a http://localhost:3000 fallback, and adds a "Backend API Setup" section to README.md documenting required endpoints and local/production setup steps.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding backend API setup documentation and configuration to guide contributors.
Linked Issues check ✅ Passed The PR successfully addresses all requirements from #826: provides .env.example template, documents backend API setup in README, configures vite.config.ts proxy with VITE_API_URL support, updates .gitignore, and documents required API endpoints.
Out of Scope Changes check ✅ Passed All changes are directly related to the backend API setup objective: .env.example configuration, README documentation, vite.config.ts proxy setup, and .gitignore updates are all within scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.env.example:
- Line 9: The .env.example file is missing a trailing newline which fails
dotenv-linter; open the .env.example and add a single newline character at the
end of the file (i.e., ensure the last line "#
VITE_API_URL=https://staging.circuitverse.org" is followed by a newline) so the
file ends with a newline.
🧹 Nitpick comments (3)
README.md (1)

45-115: Consider adding a concise backend endpoint list.
This section explains how to configure the backend, but not which endpoints are required. A short list/table would make the setup self‑contained and reduce guesswork.

📝 Suggested addition
+### Required Backend Endpoints
+| Feature | Endpoint |
+| --- | --- |
+| Verilog compilation | /api/v1/simulator/verilogcv |
+| Project save/load | /api/v1/projects/* |
+| Authentication & user info | /api/v1/auth/*, /api/v1/me |
+| Project permissions | /api/v1/projects/:id/check_edit_access |
+| Issue reporting | /api/v1/simulator/post_issue |
.env.example (1)

4-7: Safer default: avoid auto-targeting production.
Copying .env.example currently points to production by default. Consider leaving production commented to prevent accidental writes.

🛡️ Proposed tweak
- VITE_API_URL=https://circuitverse.org
+ # VITE_API_URL=https://circuitverse.org
vite.config.ts (1)

2-16: Scope loadEnv to VITE_ (and optionally reuse for other VITE vars).
loadEnv(..., '') pulls in all env keys. Scoping to VITE_ reduces accidental loading and lets .env drive VITE_* values consistently.

♻️ Suggested refactor
-export default defineConfig(({ mode }) => {
-    const env = loadEnv(mode, process.cwd(), '')
-    const version = process.env.VITE_SIM_VERSION || 'v0'
+export default defineConfig(({ mode }) => {
+    const env = loadEnv(mode, process.cwd(), 'VITE_')
+    const version = env.VITE_SIM_VERSION || process.env.VITE_SIM_VERSION || 'v0'
 ...
-    base: process.env.VITE_BASE || (isDesktop ? '/' : `/simulatorvue/${version}/`),
+    base: env.VITE_BASE || process.env.VITE_BASE || (isDesktop ? '/' : `/simulatorvue/${version}/`),

@Me-Priyank Me-Priyank force-pushed the docs/backend-api-setup branch from 23a5e68 to 8222545 Compare January 19, 2026 17:50
@Me-Priyank
Copy link
Contributor Author

Me-Priyank commented Jan 19, 2026

@Nihal4777 @tachyons kindly review. Happy to make any changes (if needed) or adjust the approach based on your suggestions

@Me-Priyank
Copy link
Contributor Author

@Nihal4777

@Me-Priyank Me-Priyank force-pushed the docs/backend-api-setup branch from 10aeaa7 to 46f20b4 Compare January 31, 2026 15:12
@Me-Priyank
Copy link
Contributor Author

Updated the PR @Nihal4777 , thanks for the suggestion :)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@README.md`:
- Around line 49-55: Update the "Backend-Dependent Features" section in
README.md to include an explicit list of the ~12 required backend API endpoints
(as requested by issue `#826`) instead of only feature areas; locate the
"Backend-Dependent Features" heading and add a clear, enumerated endpoints list
(e.g., auth/login, auth/register, projects/create, projects/get,
projects/update, projects/delete, projects/permissions, files/upload,
files/download, compile/verilog, issues/report, health/status) and mirror the
same detailed endpoint list in the other instance of that documentation block
(lines referenced in the comment) so both sections contain the identical
required endpoint names and brief purpose descriptions.
🧹 Nitpick comments (1)
README.md (1)

63-74: Clarify that VITE_API_URL must be the backend origin (no /api).

Given the Vite proxy prepends /api, users might set VITE_API_URL=https://circuitverse.org/api and end up with /api/api. Add a one-line clarification to prevent misconfiguration.

✏️ Suggested doc tweak
-2. **Choose your backend option** (edit `.env`):
+2. **Choose your backend option** (edit `.env`, set the backend **origin only**, no `/api`):

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@README.md`:
- Around line 56-71: The README's endpoint tables (headers like "| Endpoint |
Purpose |" and rows such as "`POST /auth/login`", "`GET /projects/:id`", etc.)
violate markdownlint rules MD058/MD060; add a blank line before and after each
table and ensure each table cell has single-space padding around pipes (e.g., "|
POST /auth/login | User authentication |") for both the table at the shown block
and the second table around the 129-144 region so markdownlint no longer flags
missing blank lines or compact pipe spacing.
- Around line 56-70: The README's endpoint table lists routes without the API
prefix (e.g., `POST /auth/login`, `GET /projects/:id`) while the codebase uses
`/api/v1/...`; update every route in the table to include the `/api/v1/` prefix
(e.g., `/api/v1/auth/login`, `/api/v1/projects/:id`) and ensure verbs and path
parameters remain unchanged, and remove the duplicated endpoint table (the
second instance of the same list) so only a single consolidated table remains to
avoid maintenance drift.
🧹 Nitpick comments (1)
README.md (1)

99-143: Avoid duplicating the endpoint table to prevent drift.

The same “Required API Endpoints (~12)” table appears twice. Consider keeping a single table and referencing it from the second section (e.g., “See endpoint list above”) to reduce maintenance risk.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@README.md`:
- Around line 56-71: Update the API endpoints table in README.md so it matches
the real backend routes and HTTP verbs used in the codebase: replace listed
entries that differ (e.g., change POST /api/v1/compile/verilog to POST
/api/v1/simulator/verilogcv, POST /api/v1/issues/report to POST
/api/v1/simulator/post_issue, and POST /api/v1/auth/register to POST
/api/v1/auth/signup), change the project update verb from PUT to PATCH for the
projects update endpoint, add missing routes used in code such as GET
/api/v1/me, POST /api/v1/projects/update_circuit, GET
/api/v1/projects/:id/circuit_data, GET /api/v1/projects/:id/check_edit_access,
and remove or mark as undocumented any endpoints that are not actually
implemented (or verify existence of /api/v1/files/upload,
/api/v1/files/download/:id, /api/v1/health/status,
/api/v1/projects/:id/permissions, DELETE /api/v1/projects/:id) so the table
exactly reflects the backend contract.

@Me-Priyank Me-Priyank force-pushed the docs/backend-api-setup branch from 3851f8d to cb21bcb Compare January 31, 2026 16:37
@Me-Priyank
Copy link
Contributor Author

done @Nihal4777

@Me-Priyank Me-Priyank requested a review from Nihal4777 January 31, 2026 16:48
@Me-Priyank
Copy link
Contributor Author

Me-Priyank commented Feb 2, 2026

@Nihal4777 can you please review

@Me-Priyank
Copy link
Contributor Author

@Nihal4777

Copy link
Member

@Nihal4777 Nihal4777 left a comment

Choose a reason for hiding this comment

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

LGTM!

@Nihal4777 Nihal4777 requested a review from tachyons February 8, 2026 14:34
@Me-Priyank
Copy link
Contributor Author

@tachyons PTAL

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.

docs: Missing backend API setup guide for Verilog and backend features

2 participants