Skip to content

Conversation

@vfshera
Copy link

@vfshera vfshera commented Nov 16, 2025

What does this PR do?

Adds Astro quickstart guide

Have you read the Contributing Guidelines on issues?

Yes

Summary by CodeRabbit

  • Documentation
    • Expanded Astro quick-start into a full multi-step guide covering project creation, platform setup, Appwrite configuration, environment variables, and SDK usage.
    • Added runnable end-to-end login/register example with client-side authentication, session handling, and basic UI messaging.
    • Included code samples, deployment steps, CORS note, and light/dark theme imagery.
    • Updated estimated reading time (3 → 4 minutes).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 16, 2025

Walkthrough

This pull request replaces the placeholder Astro quick-start with a full Astro + Appwrite guide, increases readtime from 3 to 4, and adds step-by-step instructions: create an Appwrite project, initialize an Astro project, configure environment variables (astro.config.mjs and .env), install the Appwrite SDK, add a new src/lib/appwrite.ts wrapper, implement a client-side login page at src/pages/index.astro with session handling, include dark/light UI images and a CORS note partial, and provide deployment instructions and extensive code samples.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify correctness of SDK imports, exported wrapper (src/lib/appwrite.ts), and API usage in code samples
  • Review src/pages/index.astro client-side session/auth flows and error handling
  • Check environment variable names/usage in astro.config.mjs and .env examples
  • Validate markdoc/Markdown formatting, code block syntax, and image paths (dark/light variants)

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the PR, which is to add a comprehensive Astro quickstart guide documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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: 2

🧹 Nitpick comments (1)
src/routes/docs/quick-starts/astro/+page.markdoc (1)

248-267: Add null check for form submitter.

The non-null assertion on line 251 could cause runtime errors if e.submitter is undefined in certain browsers or submission scenarios.

Apply this defensive coding improvement:

  loginForm.addEventListener("submit", async (e) => {
    e.preventDefault();

-   const type = e.submitter!.dataset.type;
+   const type = (e.submitter as HTMLButtonElement)?.dataset.type;
+   if (!type) {
+     console.error("Unable to determine submission type");
+     return;
+   }
+
    const formData = new FormData(loginForm);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e69a2c and fefa46d.

📒 Files selected for processing (1)
  • src/routes/docs/quick-starts/astro/+page.markdoc (1 hunks)
🔇 Additional comments (6)
src/routes/docs/quick-starts/astro/+page.markdoc (6)

1-8: LGTM! Metadata and introduction look good.

The readtime update from 3 to 4 minutes is appropriate for the expanded guide content.


9-49: LGTM! Clear and accurate setup instructions.

Steps 1 and 2 provide clear guidance for creating both the Appwrite project and Astro application. The recommended project settings are appropriate for getting started.


94-108: LGTM! Appwrite client setup is correct.

The client and account initialization follows Appwrite best practices, and the environment variable imports align with the configuration from Step 3.


117-194: LGTM! UI structure and styling are well organized.

The HTML structure clearly separates the authenticated and unauthenticated states, and the CSS provides a clean, functional interface suitable for a quickstart guide.


276-278: LGTM! Clear final instructions.

The closing step provides the correct command and default port for testing the implementation.


217-234: ****

The code is correct. Appwrite JavaScript SDK v17+ uses object-style parameters as the preferred API for Account methods including createEmailPasswordSession({ email, password }), create({ userId, email, password, name }), and deleteSession({ sessionId }). The methods in lines 218, 223-228, and 234 all follow the current standard for Appwrite SDK v17.0.2.

Likely an incorrect or invalid review comment.

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

🧹 Nitpick comments (2)
src/routes/docs/quick-starts/astro/+page.markdoc (2)

248-267: Consider safer handling for submitter and currentUser.

The code uses non-null assertions that could cause runtime errors in edge cases:

  1. Line 251: e.submitter!.dataset.type - if the form is submitted programmatically without a button, submitter will be null
  2. Line 262: currentUser! - assumes login/register succeeded without exception

While these work in the happy path, consider defensive coding:

- const type = e.submitter!.dataset.type;
+ const type = (e.submitter as HTMLButtonElement)?.dataset?.type;
+ if (!type) {
+   alert("Invalid form submission");
+   return;
+ }

  // ... after login/register

- showLoggedIn(currentUser!);
+ if (currentUser) {
+   showLoggedIn(currentUser);
+ } else {
+   alert("Login succeeded but failed to fetch user data");
+ }

113-115: Clarify the info note wording.

The phrasing "Astro is not a frontend framework" might confuse users. Astro is a web framework, but it's primarily server-rendered with opt-in client-side JavaScript.

Consider rephrasing for clarity:

- This is similar to vanilla js considering Astro is not a frontend framework
+ This uses vanilla JavaScript in a client-side script tag, which is the recommended approach for adding interactivity to Astro components
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fefa46d and f41dae2.

📒 Files selected for processing (1)
  • src/routes/docs/quick-starts/astro/+page.markdoc (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-16T17:12:42.549Z
Learnt from: vfshera
Repo: appwrite/website PR: 2606
File: src/routes/docs/quick-starts/astro/+page.markdoc:61-86
Timestamp: 2025-11-16T17:12:42.549Z
Learning: In Astro, envField schema definition is correctly placed in astro.config.mjs by importing envField from "astro/config". The schema defines validation rules and types. The actual environment variables are then accessed in runtime code (routes, components, middleware) by importing from "astro:env/client" or "astro:env/server" virtual modules.

Applied to files:

  • src/routes/docs/quick-starts/astro/+page.markdoc
📚 Learning: 2025-09-05T19:35:53.943Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react/step-6/+page.markdoc:70-75
Timestamp: 2025-09-05T19:35:53.943Z
Learning: In React tutorial files, the correct Appwrite database instance to import is `tablesDB` from "../appwrite", not `databases`. The import statement should be `import { tablesDB } from "../appwrite"` to match the usage throughout the React tutorial code.

Applied to files:

  • src/routes/docs/quick-starts/astro/+page.markdoc
🔇 Additional comments (1)
src/routes/docs/quick-starts/astro/+page.markdoc (1)

217-234: ****

The code uses the correct Appwrite Web SDK v17.0.2 API. As of v17+, all Account methods—including account.create(), account.createEmailPasswordSession(), and account.deleteSession()—use object parameters, exactly as shown in the reviewed code. The original concern about positional parameters applies only to older SDK versions (v13-v15).

Likely an incorrect or invalid review comment.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f41dae2 and 6c3da15.

📒 Files selected for processing (1)
  • src/routes/docs/quick-starts/astro/+page.markdoc (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-16T17:12:42.549Z
Learnt from: vfshera
Repo: appwrite/website PR: 2606
File: src/routes/docs/quick-starts/astro/+page.markdoc:61-86
Timestamp: 2025-11-16T17:12:42.549Z
Learning: In Astro, envField schema definition is correctly placed in astro.config.mjs by importing envField from "astro/config". The schema defines validation rules and types. The actual environment variables are then accessed in runtime code (routes, components, middleware) by importing from "astro:env/client" or "astro:env/server" virtual modules.

Applied to files:

  • src/routes/docs/quick-starts/astro/+page.markdoc
📚 Learning: 2025-09-05T19:35:53.943Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react/step-6/+page.markdoc:70-75
Timestamp: 2025-09-05T19:35:53.943Z
Learning: In React tutorial files, the correct Appwrite database instance to import is `tablesDB` from "../appwrite", not `databases`. The import statement should be `import { tablesDB } from "../appwrite"` to match the usage throughout the React tutorial code.

Applied to files:

  • src/routes/docs/quick-starts/astro/+page.markdoc
🔇 Additional comments (1)
src/routes/docs/quick-starts/astro/+page.markdoc (1)

224-240: No issues found. The modern Appwrite JavaScript/Cloud client SDK uses object-parameter syntax for account.createEmailPasswordSession({ email, password }), and the account.create() method accepts an object with userId, email, password, and name. The newer SDK also uses object-style for account.deleteSession({ sessionId }). All three API calls in the code are correct for the current Appwrite JavaScript Client SDK.

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