| [ Web Proxy ] |
| Viewing: https://marrowstack.dev/docs/getting-started | [Back] [Original] |
Getting Started
A MarrowStack block is a TypeScript file. There is no CLI, no code generation, and no dependency on the MarrowStack package. Copy the file, run the migration, set env vars.
strict: trueAll blocks are free. Sign in at marrowstack.dev, open any block, and click Copy all files. The file contents are copied to your clipboard. Paste them into your project no cloning required.
Each block ships with a SQL migration. Run it in your Supabase project once, before starting the app. The migration creates the required tables, indexes, and RLS policies.
MIGRATION constant at the top of the block file.Required vars are documented at the top of each block file and in the block's docs page. The core vars shared by all blocks:
# .env.local
NEXT_PUBLIC_SUPABASE_URL=https://xxxx.supabase.co
SUPABASE_SERVICE_ROLE_KEY=eyJhbGc... # never expose client-side
# For Solana blocks only
NEXT_PUBLIC_SOLANA_CLUSTER=devnet # or mainnet-beta
SOLANA_AUTH_DOMAIN=yourdomain.com
SOLANA_TREASURY_ADDRESS=YourBase58PublicKeyEach block exports named handler functions. Mount them as Next.js App Router route handlers.
// app/api/auth/[...nextauth]/route.ts
import { authOptions } from '@/lib/auth'
import NextAuth from 'next-auth'
const handler = NextAuth(authOptions)
export { handler as GET, handler as POST }All business logic is exported as async functions. Call them directly from server components, server actions, or route handlers.
import { getDashboardStats, requireAdmin } from '@/lib/admin'
import { getServerSession } from 'next-auth'
import { authOptions } from '@/lib/auth'
export default async function AdminPage() {
const session = await getServerSession(authOptions)
requireAdmin(session) // throws 401/403 if insufficient role
const stats = await getDashboardStats()
// ...
}| Web Proxy Viewer | New URL | Original Page |