PlaycademyPlaycademy

Quick Start

Create, develop, and deploy your first project

Overview

In this quickstart, you'll use the Playcademy CLI along with the Vite Plugin to build a simple web project that:

  1. Connects to Playcademy
  2. Loads player data automatically
  3. Integrates with platform features
  4. Runs locally and deploys to production

Not Using Vite?

This guide uses Vite as the default web development setup.

For engine-specific guides, see:

Prerequisites

Before we begin, ensure you have:

  1. Playcademy CLI installed (see installation)
  2. Node or Bun installed (we recommend Bun for the best experience)
  3. Developer status approved on your account

Don't have developer status yet?

Installation

Authenticate

Start by authenticating with your Playcademy account:

Command
$ playcademy login

Verify you're logged in:

Command
$ playcademy me

Don't have a Playcademy account yet?

Create an account to get started on staging.

Create an account to get started on production.

Create Your Project

Scaffold a new Playcademy project:

bun create playcademy my-app
npm create playcademy my-app
pnpm create playcademy my-app
yarn create playcademy my-app

The CLI will guide you through:

  1. Project type: Select Vite or Godot (for this quickstart, select Vite)
  2. Framework: Choose React, Vue, Svelte, or Vanilla (for this quickstart, select React)
  3. Project info: Name, description, and emoji
  4. Integrations: Timeback, Database, etc.

Create a Provider

Create a context provider to make the Playcademy client available throughout your app:

src/PlaycademyProvider.tsx
import { createContext, useContext, useEffect, useState } from 'react'

import { PlaycademyClient } from '@playcademy/sdk'

const PlaycademyContext = createContext<PlaycademyClient | null>(null)

export function PlaycademyProvider({ children }: { children: React.ReactNode }) {
    const [client, setClient] = useState<PlaycademyClient | null>(null)

    useEffect(() => {
        PlaycademyClient.init().then(setClient)
    }, [])

    if (!client) return <div>Loading...</div>

    return <PlaycademyContext.Provider value={client}>{children}</PlaycademyContext.Provider>
}

export function usePlaycademy() {
    const client = useContext(PlaycademyContext)
    if (!client) throw new Error('usePlaycademy must be used within PlaycademyProvider')
    return client
}

Wrap Your App

Update your app entry point to wrap everything with the provider:

src/main.tsx
import React from 'react'
import ReactDOM from 'react-dom/client'

import App from './App'
import { PlaycademyProvider } from './PlaycademyProvider'

import './index.css'

ReactDOM.createRoot(document.getElementById('root')!).render(
    <React.StrictMode>
        <PlaycademyProvider>
            <App />
        </PlaycademyProvider>
    </React.StrictMode>,
)

Coming Soon

Framework-specific tooling is coming soon.

src/main.ts
import { PlaycademyProvider } from '@playcademy/react'

ReactDOM.createRoot(document.getElementById('root')!).render(
    <React.StrictMode>
        <PlaycademyProvider>
            <App />
        </PlaycademyProvider>
    </React.StrictMode>,
)

Use the Client

Now use the client anywhere in your app:

src/App.tsx
import { useEffect, useState } from 'react'

import { usePlaycademy } from './PlaycademyProvider'

function App() {
    const client = usePlaycademy()
    const [user, setUser] = useState<{ name: string; id: string } | null>(null)

    useEffect(() => {
        client.users.me().then(setUser)
    }, [client])

    if (!user) return <div>Loading user...</div>

    return (
        <div>
            <h1>Welcome, {user.name}!</h1>
            <p>Your project is connected to Playcademy! 🎉</p>
            <p>User ID: {user.id}</p>
        </div>
    )
}

export default App

Using a different framework?

The pattern is the same.

Initialize PlaycademyClient.init() early in your app, then use the client throughout your components.

Develop Locally

Start the Vite development server:

bun dev
npm run dev
pnpm run dev
yarn run dev

The Vite Plugin automatically:

  1. Starts the sandbox server (localhost:4321): simulates the platform API
  2. Starts the backend server (localhost:8788): runs your custom routes and integrations

Not Using Vite?

If you're not using Vite, start the backend server separately:

Command
$ playcademy dev

Then start your own bundler/dev server in another terminal.

Build Your Project

Build your project for deployment:

bun run build
npm run build
pnpm run build
yarn run build

The Vite Plugin automatically creates .playcademy/<app-slug>.zip ready for deployment.

Optional: Add buildPath to Config

You can add the build path to your config to skip the prompt during deployment:

playcademy.config.js
export default {
    name: 'Playcademy App',
    description: 'A fun project',
    emoji: '🚀',
    buildPath: '.playcademy/playcademy-app.zip',
}

If you don't add it, playcademy deploy will prompt you for the path interactively.

Deploy to Playcademy

Deploy your project with a single command:

Command
$ playcademy deploy

Deploy to Production

The CLI deploys to staging by default.

When you're ready to go live:

Command
$ playcademy deploy --env production

Stream Logs

Debug your deployed app by streaming real-time logs:

Command
$ playcademy logs

See playcademy logs for all options.

Next Steps

You've built and deployed your first (very simple) Playcademy app!

Ready to build a production-ready app?

Explore backend integrations that add storage, user accounts, and server-side logic.

IntegrationDescription
DatabaseType-safe SQLite with Drizzle ORM
AuthenticationUser accounts with Better Auth
Custom RoutesServer-side API endpoints
KV StorageFast key-value storage
Bucket StorageFile storage for assets
TimebackEducational progress tracking

On this page