Google Antigravity Directory

The #1 directory for Google Antigravity prompts, rules, workflows & MCP servers. Optimized for Gemini 3 agentic development.

Resources

PromptsMCP ServersAntigravity RulesGEMINI.md GuideBest Practices

Company

Submit PromptAntigravityAI.directory

Popular Prompts

Next.js 14 App RouterReact TypeScriptTypeScript AdvancedFastAPI GuideDocker Best Practices

Legal

Privacy PolicyTerms of ServiceContact Us
Featured on FazierVerified on Verified ToolsFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowFeatured on FazierVerified on Verified ToolsFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App Show

© 2026 Antigravity AI Directory. All rights reserved.

The #1 directory for Google Antigravity IDE

This website is not affiliated with, endorsed by, or associated with Google LLC. "Google" and "Gemini" are trademarks of Google LLC.

Antigravity AI Directory
PromptsMCPBest PracticesUse CasesLearn
Home
Prompts
Remix Framework Patterns

Remix Framework Patterns

Modern Remix patterns for building fast, resilient web applications with nested routing and progressive enhancement

RemixReactFull-StackSSR
by Antigravity Team
⭐0Stars
.antigravity
# Remix Framework Patterns for Google Antigravity

Build resilient web applications with Remix and Google Antigravity's Gemini 3 engine. This guide covers nested routing, data loading, mutations, and progressive enhancement patterns for production applications.

## Route Module Structure

```typescript
// app/routes/dashboard.products.$productId.tsx
import type {
  LoaderFunctionArgs,
  ActionFunctionArgs,
  MetaFunction
} from '@remix-run/node';
import { json, redirect } from '@remix-run/node';
import {
  useLoaderData,
  useActionData,
  Form,
  useNavigation
} from '@remix-run/react';
import { requireUser } from '~/services/auth.server';
import { getProduct, updateProduct, deleteProduct } from '~/models/product.server';
import { ProductForm } from '~/components/ProductForm';

export const meta: MetaFunction<typeof loader> = ({ data }) => {
  return [
    { title: data?.product.name ?? 'Product' },
    { description: data?.product.description }
  ];
};

export async function loader({ request, params }: LoaderFunctionArgs) {
  const user = await requireUser(request);
  const product = await getProduct(params.productId!);

  if (!product) {
    throw new Response('Product not found', { status: 404 });
  }

  if (product.userId !== user.id) {
    throw new Response('Not authorized', { status: 403 });
  }

  return json({ product, user });
}

export async function action({ request, params }: ActionFunctionArgs) {
  const user = await requireUser(request);
  const formData = await request.formData();
  const intent = formData.get('intent');

  if (intent === 'delete') {
    await deleteProduct(params.productId!, user.id);
    return redirect('/dashboard/products');
  }

  const name = formData.get('name') as string;
  const price = parseFloat(formData.get('price') as string);
  const description = formData.get('description') as string;

  const errors: Record<string, string> = {};

  if (!name || name.length < 1) {
    errors.name = 'Name is required';
  }
  if (isNaN(price) || price <= 0) {
    errors.price = 'Valid price is required';
  }

  if (Object.keys(errors).length > 0) {
    return json({ errors }, { status: 400 });
  }

  await updateProduct(params.productId!, {
    name,
    price,
    description,
    userId: user.id
  });

  return json({ success: true });
}

export default function ProductDetailRoute() {
  const { product } = useLoaderData<typeof loader>();
  const actionData = useActionData<typeof action>();
  const navigation = useNavigation();
  const isSubmitting = navigation.state === 'submitting';

  return (
    <div className="product-detail">
      <ProductForm
        product={product}
        errors={actionData?.errors}
        isSubmitting={isSubmitting}
      />
    </div>
  );
}
```

## Resource Routes for APIs

```typescript
// app/routes/api.products.ts
import type { LoaderFunctionArgs, ActionFunctionArgs } from '@remix-run/node';
import { json } from '@remix-run/node';
import { getProducts, createProduct } from '~/models/product.server';
import { requireApiKey } from '~/services/api-auth.server';

export async function loader({ request }: LoaderFunctionArgs) {
  const url = new URL(request.url);
  const page = parseInt(url.searchParams.get('page') ?? '1');
  const limit = parseInt(url.searchParams.get('limit') ?? '20');

  const { products, total } = await getProducts({ page, limit });

  return json({
    data: products,
    meta: { page, limit, total, pages: Math.ceil(total / limit) }
  });
}

export async function action({ request }: ActionFunctionArgs) {
  await requireApiKey(request);

  if (request.method !== 'POST') {
    return json({ error: 'Method not allowed' }, { status: 405 });
  }

  const body = await request.json();
  const product = await createProduct(body);

  return json({ data: product }, { status: 201 });
}
```

## Session and Authentication

```typescript
// app/services/session.server.ts
import { createCookieSessionStorage, redirect } from '@remix-run/node';
import { getUserById } from '~/models/user.server';

const sessionStorage = createCookieSessionStorage({
  cookie: {
    name: '__session',
    httpOnly: true,
    path: '/',
    sameSite: 'lax',
    secrets: [process.env.SESSION_SECRET!],
    secure: process.env.NODE_ENV === 'production'
  }
});

export async function getSession(request: Request) {
  const cookie = request.headers.get('Cookie');
  return sessionStorage.getSession(cookie);
}

export async function requireUser(request: Request) {
  const session = await getSession(request);
  const userId = session.get('userId');

  if (!userId) {
    throw redirect('/login');
  }

  const user = await getUserById(userId);
  if (!user) {
    throw redirect('/login');
  }

  return user;
}

export async function createUserSession(userId: string, redirectTo: string) {
  const session = await sessionStorage.getSession();
  session.set('userId', userId);

  return redirect(redirectTo, {
    headers: {
      'Set-Cookie': await sessionStorage.commitSession(session)
    }
  });
}
```

## Best Practices

Google Antigravity's Gemini 3 engine recommends these Remix patterns: Embrace progressive enhancement by building forms that work without JavaScript. Use nested routes to colocate data requirements with UI components. Leverage optimistic UI for better perceived performance. Implement proper error boundaries at route levels for graceful error handling. Use resource routes for API endpoints that serve external clients.

When to Use This Prompt

This Remix prompt is ideal for developers working on:

  • Remix applications requiring modern best practices and optimal performance
  • Projects that need production-ready Remix code with proper error handling
  • Teams looking to standardize their remix development workflow
  • Developers wanting to learn industry-standard Remix patterns and techniques

By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their remix implementations.

How to Use

  1. Copy the prompt - Click the copy button above to copy the entire prompt to your clipboard
  2. Paste into your AI assistant - Use with Claude, ChatGPT, Cursor, or any AI coding tool
  3. Customize as needed - Adjust the prompt based on your specific requirements
  4. Review the output - Always review generated code for security and correctness
💡 Pro Tip: For best results, provide context about your project structure and any specific constraints or preferences you have.

Best Practices

  • ✓ Always review generated code for security vulnerabilities before deploying
  • ✓ Test the Remix code in a development environment first
  • ✓ Customize the prompt output to match your project's coding standards
  • ✓ Keep your AI assistant's context window in mind for complex requirements
  • ✓ Version control your prompts alongside your code for reproducibility

Frequently Asked Questions

Can I use this Remix prompt commercially?

Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.

Which AI assistants work best with this prompt?

This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.

How do I customize this prompt for my specific needs?

You can modify the prompt by adding specific requirements, constraints, or preferences. For Remix projects, consider mentioning your framework version, coding style, and any specific libraries you're using.

Related Prompts

💬 Comments

Loading comments...