Quick Start
Build a basic storefront in under 5 minutes.
Updated
On this page
Overview
This guide walks you through building your first page with the DashForDevs SDK. We'll fetch data and render it in a Next.js server component.
Prerequisite: Make sure you've completed Installation and have the SDK configured with your API key.
1. Fetch and Display Data
The example below works for any organization type. Choose the pattern that matches your setup:
E-commerce: Product Listing
// app/products/page.tsx
import dash from "@/lib/dash"
export default async function ProductsPage() {
const { products } = await dash.products.list({ limit: 12 })
return (
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 p-8">
{products.map(product => (
<a key={product.id} href={`/products/${product.slug}`}
className="border rounded-lg p-4 hover:shadow-lg transition-shadow">
<img src={product.main_image} alt={product.name} className="w-full rounded" />
<h2 className="font-semibold mt-2">{product.name}</h2>
<p className="text-green-600">${product.discounted_price || product.price}</p>
</a>
))}
</div>
)
}
Service Business: Blog + Contact
// app/page.tsx
import dash from "@/lib/dash"
export default async function HomePage() {
const [globalData, { posts }] = await Promise.all([
dash.getGlobalData(),
dash.blog.list({ limit: 3, featured: true }),
])
return (
<div className="p-8">
<h1 className="text-4xl font-bold">{globalData.global.store_name}</h1>
<p className="mt-2 text-gray-600">{globalData.global.store_description}</p>
<h2 className="text-2xl font-bold mt-12">Latest Posts</h2>
{posts.map(post => (
<a key={post.id} href={`/blog/${post.slug}`} className="block mt-4">
<h3 className="font-semibold">{post.title}</h3>
<p className="text-gray-500">{post.excerpt}</p>
</a>
))}
<a href="/contact" className="mt-8 inline-block bg-blue-600 text-white px-6 py-3 rounded">
Get in Touch
</a>
</div>
)
}
Any Type: Global Data + Layout
// app/layout.tsx
import dash from "@/lib/dash"
export default async function RootLayout({ children }) {
const { global } = await dash.getGlobalData()
return (
<html>
<head>
<title>{global.store_name}</title>
<link rel="icon" href={global.favicon} />
</head>
<body>
<header>
<img src={global.logo} alt={global.store_name} />
<nav>{/* your navigation */}</nav>
</header>
{children}
<footer>
<p>{global.store_name} · {global.contact_email}</p>
</footer>
</body>
</html>
)
}
2. What's Available
Depending on your organization type, you have access to different SDK modules:
| Module | E-commerce | Service | Wholesale |
|---|---|---|---|
dash.products | Yes | — | Yes |
dash.cart / dash.checkout | Yes | — | Yes |
dash.blog | Yes | Yes | Yes |
dash.contact | Yes | Yes | Yes |
dash.auth | Yes | Yes | Yes |
dash.shipping | Yes | — | Yes |
dash.pages / dash.contentTypes | Yes | Yes | Yes |
dash.tracking / dash.seo | Yes | Yes | Yes |
dash.media / dash.upload | Yes | Yes | Yes |
3. Verify with Ping
const info = await dash.ping()
console.log(info) // { status: "ok", organization: { name: "...", ... } }
If you see your organization info, everything is working.
Next Steps
- API Keys & Authentication — Public vs secret keys
- Environment Setup — Full project setup
- Common Patterns — Best practices
- SDK Reference — All available modules