nNexGateHub
Browse NexGateHub
NEXGATEHUB / PROMPTS

Workflows — page 3

Discover, adapt and reuse 23,385 prompts. Copy, adapt, and create.

929 English prompts · Page 3 of 10

Workflows · EN

Configuration

import { initializeApp } from 'firebase/app'; import { getAuth } from 'firebase/auth'; import { getFirestore } from 'firebase/firestore'; import { getStorage } from 'firebase/storage'; const firebaseConfig = { apiKey:

Workflows · EN

Configuration

import { defineConfig } from 'astro/config'; import node from '@astrojs/node'; export default defineConfig({ output: 'server', adapter: node({ mode: 'middleware' }), vite: { ssr: { noExternal: ['firebase', 'fireb

Workflows · EN

Configuration

import { initializeApp } from 'firebase/app'; import { getFirestore } from 'firebase/firestore'; import { getAuth } from 'firebase/auth'; import { getStorage } from 'firebase/storage'; const firebaseConfig = { apiKey:

Workflows · EN

Configuration

import { initializeApp } from 'firebase/app'; import { getAuth } from 'firebase/auth'; import { getFirestore } from 'firebase/firestore/lite'; import { getStorage } from 'firebase/storage'; const firebaseConfig = { api

Workflows · EN

Configuration

import { initializeApp } from 'firebase/app'; import { getFirestore } from 'firebase/firestore'; import { getAuth } from 'firebase/auth'; import { getStorage } from 'firebase/storage'; const firebaseConfig = { apiKey:

Workflows · EN

Configuration

import { createApp } from 'vue'; import { VueFire, VueFireAuth } from 'vuefire'; import App from './App.vue'; import { app as firebaseApp } from './firebase'; const app = createApp(App); app.use(VueFire, { firebaseApp

Workflows · EN

Consult Steve Jobs and Elon Musk

Consult Steve Jobs and Elon Musk Prompt: I will provide you with an argument or opinion of mine. I want you to criticize it as if you were Person: [person name] Argument: [your statement].

Workflows · EN

Content Collections

const posts = defineCollection({ type: 'content', schema: z.object({ title: z.string(), pubDate: z.date(), featured: z.boolean().default(false) }) })

Workflows · EN

Content Collections

// Hydrates immediately const criticalFeature = document.querySelector('.critical') criticalFeature.initialize() // Hydrates after page load import { initializeFeature } from './feature'

Workflows · EN

Content Collections

export async function GET({ params, request }) { const products = await db.products.findMany({ where: { category: params.category } }) return new Response(JSON.stringify(products), { status: 200, headers: { 'Con

Workflows · EN

Content Collections

export function onRequest({ request, locals }, next) { locals.user = await auth.getUser(request) const response = await next() response.headers.set('X-Custom-Header', 'value') return response }

Workflows · EN

Content Collections

export const cartStore = atom({ items: [], total: 0 }) export function addToCart(product) { cartStore.set({ items: [...cartStore.get().items, product], total: cartStore.get().total + product.price }) }

Workflows · EN

Contentview

// Before TextField("Username", text: Binding( get: { model.username }, set: { model.username = $0; model.save() } )) // After TextField("Username", text: $model.username) .onChange(of: model.username) { model.save(

Workflows · EN

Context-Aware Email Assistant

Act as a Context-Aware Email Assistant. You are capable of reading browser pages and integrating context from multiple tabs. Your task is to: - Establish a clear goal at the start of each session with the user. - Dynami

Workflows · EN

Continuous Execution Mode AI

You are running in “continuous execution mode.” Keep working continuously and indefinitely: always choose the next highest-value action and do it, then immediately choose the next action and continue. Do not stop to summ

Workflows · EN

Controller Features

class ProductRepository { public function findByCategory(string $category): Collection { return Product::query() -whereBelongsTo(Category::findBySlug($category)) -with(['variants', 'media']) -cached() -get(); } }

Workflows · EN

Controller Features

class ProductEventSubscriber { public function handleProductCreated(ProductCreated $event): void { Cache::tags(['products'])-flush(); Notification::send($admins, new ProductCreatedNotification($event-product)); }

Workflows · EN

Controller Features

class ProductResource extends JsonResource { public function toArray(Request $request): array { return [ 'id' = $this-id, 'name' = $this-name, $this-mergeWhen($request-user()?-isAdmin(), [ 'cost' = $this-cost, 'm

Workflows · EN

Controller Features

test('it calculates product margins') -with([ [100, 150, 50], [200, 300, 100] ]) -expect(fn (int $cost, int $price, int $margin) = Product::calculateMargin($cost, $price) )-toBe(fn (int $margin) = $margin);

Workflows · EN

Core Formula

Context Window = RAM (volatile, attention-limited, "lost in the middle") Filesystem = Disk (persistent, append-only, unlimited) → Anything important is written to disk. → Anything stale is dropped from context but kept r

Workflows · EN

Core Principles

Core Principles Deploy Safely, Not Just Fast: Every release must be reversible, observable, and incremental. Big-bang deploys are unacceptable. Feature Flags Are Mandatory: Every change ships behind a flag. Decouple depl

Workflows · EN

Correct API Route Setup

// src/pages/api/auth/[...all].ts import { betterAuth } from '../../../lib/auth' import type { APIRoute } from 'astro' export const all: APIRoute = async ({ request }) = { try { return await betterAuth.handleRequest(r

Workflows · EN

Correct API Route Setup

// app/routes/api.auth.$.tsx import { auth } from '~/lib/auth.server' import type { LoaderFunctionArgs, ActionFunctionArgs } from '@remix-run/node' export async function loader({ request, params }: LoaderFunctionArgs) {

Workflows · EN

CORRECT AUTH GUARD IMPLEMENTATION

// src/lib/guards/auth.ts import { browser } from '$app/environment'; import { goto } from '$app/navigation'; import { auth, isAuthenticated } from '$lib/stores/auth'; import type { Load } from '@sveltejs/kit'; export c

Workflows · EN

CORRECT AUTH GUARD IMPLEMENTATION

// src/lib/guards/auth.ts import { browser } from '$app/environment' import { goto } from '$app/navigation' import { user } from '$lib/stores/supabase' import type { Load } from '@sveltejs/kit' export const authGuard: L

Workflows · EN

CORRECT AUTH STATE HANDLING

import { useAuth0 } from '@auth0/auth0-react'; export function AuthenticatedComponent() { const { isAuthenticated, user, isLoading } = useAuth0(); if (isLoading) { return Loading... ; } if (!isAuthenticated) { r

Workflows · EN

CORRECT AUTH STATE HANDLING

import { useAuth, useUser } from '@clerk/clerk-react'; export function AuthenticatedComponent() { const { isLoaded, userId } = useAuth(); const { user } = useUser(); if (!isLoaded) { return Loading... ; } if (!u

Workflows · EN

CORRECT AUTH0 PROVIDER IMPLEMENTATION

import { Auth0Provider } from '@auth0/auth0-react'; import { env } from './env.ts'; export function Providers({ children }: { children: React.ReactNode }) { return ( <Auth0Provider domain={env.AUTH0DOMAIN} clientId=

Workflows · EN

Correct Authentication Components

// auth.component.ts import { Component } from '@angular/core'; import { ClerkService } from 'ngx-clerk'; @Component({ selector: 'app-auth', template: Welcome, {{ user.firstName }} Sign Out }) export

Workflows · EN

Correct Authentication Components

// src/pages/auth.astro import { SignIn, SignUp, UserButton } from '@clerk/astro' import { getAuth } from '@clerk/astro/server' const { userId } = await getAuth(Astro) {userId ? ( Welcome back! ) : ( )}

Workflows · EN

Correct Authentication Components

// src/components/auth.js export async function mountAuthComponents(clerk) { try { const signInElement = document.getElementById('sign-in'); const userButtonElement = document.getElementById('user-button'); if (sign

Workflows · EN

Correct Authentication Components

// routes/auth.tsx import { SignIn, SignUp, UserButton } from '@clerk/remix' import { useUser } from '@clerk/remix' export default function Auth() { const { isSignedIn, user } = useUser() return ( {isSignedIn ? (

Workflows · EN

CORRECT AUTHENTICATION HOOKS

// src/hooks/useAuthQuery.js import { useAuth0 } from '@auth0/auth0-react'; import { useQuery } from '@tanstack/react-query'; export function useAuthQuery(queryKey, queryFn, options = {}) { const { getAccessTokenSilent

Workflows · EN

CORRECT AUTHENTICATION HOOKS

// src/hooks/useAuthQuery.js import { useAuth } from 'better-auth'; import { useQuery } from '@tanstack/react-query'; export function useAuthQuery(queryKey, queryFn, options = {}) { const { getToken, isAuthenticated }

Workflows · EN

CORRECT AUTHENTICATION HOOKS

// src/hooks/useAuthQuery.js import { useAuth } from '@clerk/clerk-react'; import { useQuery } from '@tanstack/react-query'; export function useAuthQuery(queryKey, queryFn, options = {}) { const { getToken, isSignedIn

Workflows · EN

CORRECT CLIENT IMPLEMENTATION

import { createClient } from '@supabase/supabase-js' const supabaseUrl = import.meta.env.VITESUPABASEURL const supabaseAnonKey = import.meta.env.VITESUPABASEANONKEY export const supabase = createClient(supabaseUrl, sup

Workflows · EN

CORRECT CLIENT INITIALIZATION

import { initializeClerkClient } from 'clerk-sveltekit/client'; import { PUBLICCLERKPUBLISHABLEKEY } from '$env/static/public'; initializeClerkClient(PUBLICCLERKPUBLISHABLEKEY, { afterSignInUrl: '/dashboard', afterSig

Workflows · EN

Correct Client Integration

// app/lib/auth.client.ts import { createClient } from 'better-auth/client' import type { User } from '~/types' export const authClient = createClient ({ apiUrl: '/api/auth', onSessionChange: session = { console.log(

Workflows · EN

CORRECT COMPONENT USAGE

import SignIn from 'clerk-sveltekit/client/SignIn.svelte'; import SignUp from 'clerk-sveltekit/client/SignUp.svelte'; import UserButton from 'clerk-sveltekit/client/UserButton.svelte';

Workflows · EN

CORRECT COMPONENT USAGE

// src/routes/dashboard/+page.server.ts import { redirect } from '@sveltejs/kit'; import type { PageServerLoad } from './$types'; export const load: PageServerLoad = async ({ locals }) = { const { userId } = locals.cle

Workflows · EN

Correct Configuration Setup

// astro.config.mjs import { defineConfig } from 'astro/config' import clerk from '@clerk/astro' export default defineConfig({ integrations: [clerk()], output: 'server' }) // src/middleware.ts import { clerkMiddlewar

Workflows · EN

Correct Initialization

// app.config.ts import { ApplicationConfig } from '@angular/core'; import { provideClerk } from 'ngx-clerk'; export const appConfig: ApplicationConfig = { providers: [ provideClerk({ publishableKey: environment.cler

Workflows · EN

Correct Initialization Setup

// src/auth.js import Clerk from '@clerk/clerk-js'; export async function initClerk() { try { const clerk = new Clerk(import.meta.env.VITECLERKPUBLISHABLEKEY); await clerk.load(); return clerk; } catch (error) { c

Workflows · EN

CORRECT JAVASCRIPT IMPLEMENTATION

// auth.js class BetterAuthHandler { constructor(config) { this.config = config; this.auth = null; } async initialize() { try { const { createAuthClient } = await import('better-auth'); this.auth = createAuthCl

Workflows · EN

Correct Module Configuration

// app.config.ts import { ApplicationConfig } from '@angular/core'; import { provideAuth0 } from '@auth0/auth0-angular'; import { environment } from './environments/environment'; export const appConfig: ApplicationConfi

Workflows · EN

Correct Module Setup

// app.module.ts import { NgModule } from '@angular/core'; import { BetterAuthModule } from 'better-auth-angular'; import { auth } from './auth.config'; @NgModule({ imports: [ BetterAuthModule.forRoot(auth, { persist

Workflows · EN

CORRECT PACKAGE SETUP

{ "dependencies": { "@auth0/auth0-react": "^2.0.0", "@tanstack/react-query": "^5.0.0", "@tanstack/react-query-devtools": "^5.0.0", "@tanstack/react-router": "^1.0.0", "react": "^18.0.0", "react-dom": "^18.0.0" }

Workflows · EN

CORRECT PACKAGE SETUP

{ "dependencies": { "better-auth": "^2.0.0", "@tanstack/react-query": "^5.0.0", "@tanstack/react-query-devtools": "^5.0.0", "@tanstack/react-router": "^1.0.0", "react": "^18.0.0", "react-dom": "^18.0.0" } }

Workflows · EN

CORRECT PACKAGE SETUP

{ "dependencies": { "@clerk/clerk-react": "^4.0.0", "@tanstack/react-query": "^5.0.0", "@tanstack/react-query-devtools": "^5.0.0", "react": "^18.0.0", "react-dom": "^18.0.0" } }

Workflows · EN

CORRECT PACKAGE SETUP

{ "dependencies": { "@supabase/supabase-js": "^2.0.0", "@supabase/ssr": "^2.0.0", "@supabase-cache-helpers/postgrest-react-query": "^1.0.0", "@tanstack/react-query": "^5.0.0", "@tanstack/react-query-devtools": "^5.

Workflows · EN

Correct Plugin Implementation

import { createApp } from 'vue' import { createAuth0 } from '@auth0/auth0-vue' import App from './App.vue' const app = createApp(App) app.use( createAuth0({ domain: import.meta.env.VITEAUTH0DOMAIN, clientId: import.

Workflows · EN

Correct Plugin Implementation

import { createApp } from 'vue' import App from './App.vue' import { clerkPlugin } from 'vue-clerk' const PUBLISHABLEKEY = import.meta.env.VITECLERKPUBLISHABLEKEY if (!PUBLISHABLEKEY) { throw new Error('Missing Publish

Workflows · EN

CORRECT PROTECTED ROUTE IMPLEMENTATION

import { useAuth0 } from '@auth0/auth0-react'; import { Navigate } from 'react-router-dom'; export function ProtectedRoute({ children }: { children: React.ReactNode }) { const { isAuthenticated, isLoading } = useAuth0(

Workflows · EN

CORRECT PROTECTED ROUTE IMPLEMENTATION

import { Navigate } from 'react-router-dom' import { useAuth } from './AuthProvider' export function ProtectedRoute({ children }: { children: React.ReactNode }) { const { user, loading } = useAuth() if (loading) { r

Workflows · EN

CORRECT PROTECTED ROUTES

// src/routes/protected.jsx import { createFileRoute, redirect } from '@tanstack/react-router'; export const Route = createFileRoute('/protected')({ beforeLoad: ({ context }) = { if (!context.auth.isAuthenticated) {

Workflows · EN

CORRECT PROTECTED ROUTES

// src/routes/protected.jsx import { createFileRoute, redirect } from '@tanstack/react-router'; export const Route = createFileRoute('/protected')({ beforeLoad: ({ context }) = { if (!context.auth.isAuthenticated) {

Workflows · EN

CORRECT PROVIDER SETUP

// src/App.jsx import { Auth0Provider } from '@auth0/auth0-react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { R

Workflows · EN

CORRECT PROVIDER SETUP

// src/App.jsx import { createAuthClient, AuthProvider } from 'better-auth'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools';

Workflows · EN

CORRECT PROVIDER SETUP

// src/App.jsx import { ClerkProvider } from '@clerk/clerk-react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; const que

Workflows · EN

CORRECT PROVIDER SETUP

// src/App.jsx import { createBrowserClient } from '@supabase/ssr'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import {

Workflows · EN

Correct Root Component Setup

// app.component.ts import { Component } from '@angular/core'; import { ClerkService } from 'ngx-clerk'; @Component({ selector: 'app-root', standalone: true, template: ' ' }) export class AppComponent { constructor(

Workflows · EN

Correct Root Configuration

// root.tsx import { rootAuthLoader } from '@clerk/remix/ssr.server' import { ClerkApp } from '@clerk/remix' import type { LoaderFunction } from '@remix-run/node' export const loader: LoaderFunction = args = rootAuthLoa

Workflows · EN

CORRECT USAGE WITH TANSTACK ROUTER

// src/routes/root.jsx import { createRootRouteWithContext } from '@tanstack/react-router'; import { AuthContextInterface } from 'better-auth'; interface RouterContext { auth: AuthContextInterface; } export const Rout

Workflows · EN

Create a Browser Client

// lib/supabase-browser.ts import { createBrowserClient } from "@supabase/ssr"; export function createClient() { return createBrowserClient( process.env.NEXTPUBLICSUPABASEURL!, process.env.NEXTPUBLICSUPABASEANONKEY!