Skip to main content
Getting your content to your TanStack Start site is as simple as using the Marble SDK. This guide will walk you through setting up a blog with Marble and TanStack Start. If you want to get started quickly, you can clone our TanStack Start blog template. To create a new TanStack Start project, run:
1

Install the SDK

Install the Marble SDK in your TanStack Start project:
2

Set up environment variables

Add your Marble API key to your environment variables. Create a .env file in the root of your TanStack Start project:
.env
While public API keys are currently read-only, they should be used on the server-side whenever possible to prevent your rate limits from being exhausted by others.
You can find your API Key in your Marble dashboard under Settings > API Keys.
3

Create a Marble client

Create a shared Marble client instance. Create a file at lib/marble.ts:
lib/marble.ts
4

Display a list of posts

Use the Marble client in a TanStack Start route to fetch and display your posts. Create a file at src/routes/posts/index.tsx:
src/routes/posts/index.tsx
5

Display a single post

Create a dynamic route at src/routes/posts/$slug.tsx to display individual posts:
src/routes/posts/$slug.tsx
A note on dangerouslySetInnerHTMLWe use dangerouslySetInnerHTML to render the HTML content of your post. Marble sanitizes all HTML content before it’s sent to you, so you can be confident that it’s safe to render in your application.
6

Example Styling (Optional)

To improve the appearance of your content, you can use Tailwind CSS Typography to add beautiful typographic defaults. We provide a simple Prose component that makes it easy to style your Marble content.First, install the Tailwind CSS Typography plugin:
Add it to your Tailwind CSS configuration. If you’re using Tailwind CSS v4:
src/styles.css
For Tailwind CSS v3, add it to your tailwind.config.js:
tailwind.config.js
Now create a Prose component that you can use to style your content. Create components/Prose.tsx:
components/Prose.tsx
Note: This component assumes you have a cn utility function for combining class names. You can install and set up clsx or use a similar utility, or simply replace cn() with string concatenation.
Now you can update your post page to use the Prose component:
src/routes/posts/$slug.tsx
This will give your content beautiful, readable typography with proper spacing, font sizes, and styling for headings, links, images, and other elements. You can customize the styles by modifying the classes in the Prose component or by extending the typography configuration in your Tailwind config.For more information about customizing the typography styles, check out Tailwind CSS Typography!