RealtimeKeep your app up to date
AuthenticationOver 80+ OAuth integrations
Convex Components
ComponentsIndependent, modular, TypeScript building blocks for your backend.
Open sourceSelf host and develop locally
AI CodingGenerate high quality Convex code with AI
Compare
Convex vs. Firebase
Convex vs. Supabase
Convex vs. SQL
DocumentationGet started with your favorite frameworks
SearchSearch across Docs, Stack, and Discord
TemplatesUse a recipe to get started quickly
Convex for StartupsStart and scale your company with Convex
Convex ChampionsAmbassadors that support our thriving community
Convex CommunityShare ideas and ask for help in our community Discord
Stack
Stack

Stack is the Convex developer portal and blog, sharing bright ideas and techniques for building with Convex.

Explore Stack
BlogDocsPricing
GitHub
Log inStart building
Back to Templates

Astro Starter

GitHub logoView Repo

Built with

Astro iconAstro

Tags

Starter
npm create convex@latest -- -t astro

An Astro starter project using Convex with React and Tailwind CSS v4

To enable Convex in your Astro project:

  1. Install convex and run npx convex dev to start syncing changes to your Convex backend. This will create a convex folder in your project if you don't have one already.
  2. Wrap components that access Convex in a ConvexProvider component. In this template, this is done with withConvexProvider in src/lib/convex.tsx.
  3. Add these components to your .astro pages as usual.
  4. Use useQuery and other Convex hooks in the components as usual.

The withConvexProvider function is a convenience wrapper that wraps a React component in a ConvexProvider component. This is necessary because Astro context providers don't work when used in .astro files.

Usage:

// CommentForm.tsx
export default withConvexProvider(function CommentForm() {
    ... normal component code ...
});

Implementation:

// Initialized once so all components share the same client.
const client = new ConvexReactClient(CONVEX_URL);

export function withConvexProvider<Props extends JSX.IntrinsicAttributes>(
  Component: FunctionComponent<Props>,
) {
  return function WithConvexProvider(props: Props) {
    return (
      <ConvexProvider client={client}>
        <Component {...props} />
      </ConvexProvider>
    );
  };
}
Astro Starter hero image
Get your app up and running in minutes
Start building
Convex logo
ProductSyncRealtimeAuthOpen sourceAI codingChefFAQPricing
DevelopersDocsBlogComponentsTemplatesStartupsChampionsChangelogPodcastLLMs.txt
CompanyAbout usBrandInvestorsBecome a partnerJobsNewsEventsTerms of servicePrivacy policySecurity
SocialTwitterDiscordYouTubeLumaBlueskyGitHub
A Trusted Solution
  • SOC 2 Type II Compliant
  • HIPAA Compliant
  • GDPR Verified
©2025 Convex, Inc.