Astro
Junior Questions
Asset Handling (Public vs Src)?
Files in `public/` are served as-is, while files in `src/` are processed by Vite. Generally, you should keep images in `src/` to benefit from Astro's automatic optimization.
What problems does this solve?
- Basic architectural knowledge for managing static assets correctly.
Astro CLI & astro check?
The Astro CLI powers your development workflow. `astro check` is particularly useful as it validates your TypeScript types AND Astro-specific component syntax across your entire project.
What problems does this solve?
- Evaluates familiarity with the developer tooling and project health commands.
Astro Components (.astro)?
Astro components are HTML-only components with no client-side runtime. They allow for component-based development and templating logic that runs entirely at build or request time on the server.
What problems does this solve?
- Understanding the basic building block of an Astro application.
Astro Integrations (@astrojs/*)?
Integrations are Astro's plugin system. They allow you to add new features (like Tailwind, Sitemap, or React) with a single command: `npx astro add
What problems does this solve?
- Essential for understanding how to extend Astro's core functionality.
Deployment Adapters?
To use SSR features, you must install an adapter (e.g., for Vercel, Netlify, or Node.js). Adapters tell Astro how to package your application for the target environment's runtime.
What problems does this solve?
- Basic configuration knowledge required for moving beyond simple static builds.
Image Optimization (Astro Assets)?
Astro's built-in Image component automatically optimizes images by resizing them and converting them to modern formats like WebP, while also preventing layout shifts via intrinsic sizing.
What problems does this solve?
- Basic performance optimization tool that every Astro developer should use.
Props in Astro Components?
Props are accessed via `Astro.props` in the component script. You can use TypeScript's `Props` interface to provide type safety and editor autocomplete for your component's API.
What problems does this solve?
- Basic requirement for creating dynamic and configurable components.
Scoped CSS in Astro?
Inside a `<style>` tag in an Astro component, CSS is scoped to that component by default. Astro adds a unique hash to the class names at build time, preventing style leaks across the application.
What problems does this solve?
- Evaluates knowledge of Astro's built-in CSS management features.
Slots & Named Slots?
Astro uses ` ` as a placeholder for external content. It also supports named slots for multi-point content injection and fallback content if no content is provided.
What problems does this solve?
- Fundamental pattern for creating flexible and reusable layout components.
What is Astro?
Astro is a modern web framework designed for content-focused websites. It prioritizes performance by using an "islands architecture" and shipping zero JavaScript to the client by default.
What problems does this solve?
- Foundational understanding of what makes Astro different from other frameworks.
What is Frontmatter in Astro?
Astro uses a "code fence" (---) to define a component's frontmatter. This is where you write TypeScript or JavaScript that runs only on the server to fetch data, define props, and import other components.
What problems does this solve?
- Crucial for understanding how logic is separated from markup in Astro.
Zero JS by Default?
Astro renders components to static HTML on the server during build time. Unless you explicitly add a client directive, no JavaScript is sent to the browser, leading to extremely fast page loads.
What problems does this solve?
- Highlights the performance-first mindset of the framework.
Mid-Level Questions
API Endpoints (Static & Dynamic)?
Astro allows you to create API endpoints by adding `.js` or `.ts` files to the `src/pages` directory. These can serve JSON, images, or any other data type and work in both SSG and SSR modes.
What problems does this solve?
- Evaluates ability to build full-stack logic inside an Astro project.
Client Directives (client:load, etc.)?
Client directives control how and when a UI framework component is hydrated on the client. Common values include `client:load`, `client:idle`, `client:visible`, and `client:only`.
What problems does this solve?
- Vital for optimizing the performance of interactive island components.
Content Collections?
Content Collections are Astro's best-in-class tool for managing markdown and data files. They provide automatic TypeScript type safety for your frontmatter and help organize your content into logical groups.
What problems does this solve?
- Key feature for building robust, content-heavy sites with structured data.
Dynamic Routing & getStaticPaths?
In static mode, dynamic routes require a `getStaticPaths()` function to specify which paths should be generated at build time. This allows you to create hundreds of pages from a single template.
What problems does this solve?
- Core concept for building enterprise-grade content sites with dynamic data.
Hybrid Rendering Mode?
Hybrid rendering allows you to mix static and on-demand rendering on a per-page basis. You can set the entire site to static and opt-in to SSR for specific pages using `export const prerender = false`.
What problems does this solve?
- Vital for understanding how to optimize large sites with both static and dynamic content.
MDX Support?
Astro has first-class support for MDX, allowing you to use JSX components (React, Vue, etc.) directly inside your Markdown files. This is perfect for interactive documentation or tutorials.
What problems does this solve?
- Evaluates familiarity with combining content and interactive components.
Prefetching Strategies?
Astro allows you to prefetch pages when a user hovers over a link or when a link enters the viewport. This makes the next navigation feel instantaneous by loading the data in advance.
What problems does this solve?
- Advanced performance optimization technique for better user experience.
SSG vs SSR vs ISR in Astro?
Astro supports Static Site Generation (SSG), Server Side Rendering (SSR), and Hybrid rendering. It recently introduced Server Islands which function similarly to ISR by deferring component rendering.
What problems does this solve?
- Tests knowledge of different rendering strategies and how Astro implements them.
Understanding Hydration?
Hydration is the process where a client-side library (like React) attaches to server-rendered HTML. Astro allows for partial hydration, where only selected components are hydrated, reducing JS execution time.
What problems does this solve?
- Deeper understanding of the mechanics behind Astro's islands architecture.
View Transitions API?
Astro includes a built-in router that uses the browser's View Transitions API to provide seamless, app-like navigation between pages without a full page refresh.
What problems does this solve?
- Highlights Astro's path towards SPX (Single Page Experience) in a multi-page framework.
What is Islands Architecture?
Islands architecture (pioneered by Astro) identifies small, interactive UI components on a page as "islands" that are hydrated independently. The rest of the page remains static HTML.
What problems does this solve?
- Evaluates comprehension of Astro's core architectural unique selling point.
What is the Astro Global?
The `Astro` global object is available in all components. It provides access to request info, cookies, redirects, and specialized helper properties like `Astro.props` and `Astro.slots`.
What problems does this solve?
- Central to interacting with the server context and component lifecycle.
Senior Questions
Astro Actions?
Astro Actions provide a type-safe way to handle form submissions and server-side logic from the client, acting as a replacement for traditional API endpoints with better DX and type safety.
What problems does this solve?
- Senior-level question on modern data-fetching and mutation patterns in Astro.
Astro DB?
Astro DB is a fully managed SQL database designed specifically for Astro. It provides a type-safe ORM and integrates seamlessly with content collections and the rest of the Astro ecosystem.
What problems does this solve?
- Assesses knowledge of Astro's official data persistence layer.
Middleware in Astro?
Middleware allows you to intercept requests and responses, enabling features like authentication, logging, session management, and dynamic header modification before a page is rendered.
What problems does this solve?
- Senior-level knowledge of request processing and architectural hooks.
Rest parameters in Routes?
Rest parameters (e.g., `[...slug].astro`) allow for catch-all routing. They are particularly useful for deeply nested documentation or content structures where the number of segments is unknown.
What problems does this solve?
- Senior-level routing knowledge for handling complex URL patterns.
Server Islands?
Server Islands allow you to defer the rendering of dynamic parts of a page, keeping the rest of the page static. This combines the benefits of SSG caching with the flexibility of SSR personalization.
What problems does this solve?
- Advanced architectural pattern for balancing speed and personalization.
The Content Layer?
The Content Layer (introduced in Astro 5.0) allows you to fetch content from any source (CMS, JSON, APIs) and treat it exactly like local Markdown files, with full type safety via Zod schemas.
What problems does this solve?
- Senior-level question on how Astro handles external data at scale.