SDK Reference

Retrieve information about your Simplist project, including metadata and statistics.

MethodDescriptionReturns
Get complete project info and statisticsProjectInfo
Get project metadata onlyProject
Get project statistics onlyProjectStats

Get complete project information including both metadata and statistics.

Method Signature
async client.project.get(): Promise<ApiResponse<ProjectInfo>>

PropertyTypeDescriptionDefault
project*ProjectProject metadata-
stats*ProjectStatsProject statistics-
PropertyTypeDescriptionDefault
id*stringUnique project identifier-
name*stringProject name-
slug*stringURL-friendly project identifier-
createdAt*stringISO 8601 creation timestamp-
updatedAt*stringISO 8601 last update timestamp-
PropertyTypeDescriptionDefault
totalArticles*numberTotal number of articles-
publishedArticles*numberNumber of published articles-
totalViews*numberTotal page views across all articles-
storageUsed*stringStorage used (e.g., '1.2 MB')-
storageLimit*stringStorage limit (e.g., '100 MB')-

const response = await client.project.get()

console.log(response.data.project.name)             // "My Blog"
console.log(response.data.stats.totalArticles)      // 42
console.log(response.data.stats.publishedArticles)  // 35
console.log(response.data.stats.totalViews)         // 15473

Get only project metadata without statistics. Useful when you don't need stats and want a faster response.

Method Signature
async client.project.getInfo(): Promise<Project>

const project = await client.project.getInfo()

console.log(project.name)        // "My Blog"
console.log(project.slug)        // "my-blog"
console.log(project.createdAt)   // "2024-01-15T10:30:00Z"

Get only project statistics without metadata. Useful for dashboards and monitoring.

Method Signature
async client.project.getStats(): Promise<ProjectStats>

const stats = await client.project.getStats()

console.log(`Total articles: ${stats.totalArticles}`)
console.log(`Published: ${stats.publishedArticles}`)
console.log(`Total views: ${stats.totalViews.toLocaleString()}`)
console.log(`Storage: ${stats.storageUsed} / ${stats.storageLimit}`)

import { SimplistClient } from "@simplist.blog/sdk"

export async function Dashboard() {
  // Uses SIMPLIST_API_KEY from environment variables
  const client = new SimplistClient()

  // Get all project info at once
  const { data } = await client.project.get()

  return (
    <div className="dashboard">
      <h1>{data.project.name}</h1>

      <div className="stats-grid">
        <StatCard
          title="Total Articles"
          value={data.stats.totalArticles}
          subtitle={`${data.stats.publishedArticles} published`}
        />

        <StatCard
          title="Total Views"
          value={data.stats.totalViews.toLocaleString()}
        />

        <StatCard
          title="Storage"
          value={data.stats.storageUsed}
          subtitle={`of ${data.stats.storageLimit}`}
        />
      </div>

      <p className="text-muted">
        Project created on {new Date(data.project.createdAt).toLocaleDateString()}
      </p>
    </div>
  )
}

import { SimplistClient } from "@simplist.blog/sdk"

async function checkProjectHealth() {
  const client = new SimplistClient()

  try {
    const stats = await client.project.getStats()

    // Check storage usage
    const used = parseFloat(stats.storageUsed)
    const limit = parseFloat(stats.storageLimit)
    const usagePercent = (used / limit) * 100

    if (usagePercent > 80) {
      console.warn(`⚠️  Storage usage at ${usagePercent.toFixed(1)}%`)
    }

    // Check publication rate
    const publicationRate = (stats.publishedArticles / stats.totalArticles) * 100
    console.log(`✓ Publication rate: ${publicationRate.toFixed(1)}%`)

    // Log metrics
    console.log(`✓ Total views: ${stats.totalViews}`)
    console.log(`✓ Published articles: ${stats.publishedArticles}`)

  } catch (error) {
    console.error(`✗ Health check failed: ${error}`)
  }
}

// Run every hour
setInterval(checkProjectHealth, 60 * 60 * 1000)

This SDK method uses the following API endpoint: GET/v1/project

GET{{baseUrl}}/v1/project
Auth required

Quick Help

Project info changes rarely. Cache it on the server side or fetch it once per deployment. Only call it when you need updated stats or project metadata.
No, the get() method returns both project info and stats together. This is by design to minimize API calls. If you only need stats, cache the project data.
Storage metrics include total bytes used by article content, images, and metadata. The limit depends on your plan. Use this to show storage usage in dashboards.

Command Palette

Search for a command to run...