SesameSesame

Development Guide

Contributing to Sesame

This guide covers how to set up a development environment and contribute to Sesame.

Prerequisites

  • Bun v1.0 or later

Getting Started

1. Clone the Repository

git clone https://github.com/jakejarvis/sesame.git
cd sesame

2. Install Dependencies

bun install

3. Set Up Environment

cp .env.example .env

# Generate secrets
echo "BETTER_AUTH_SECRET=$(openssl rand -base64 32)" >> .env
echo "ENCRYPTION_KEY=$(openssl rand -hex 32)" >> .env

4. Start Development Server

bun run dev

This starts:

Project Structure

Key Directories

DirectoryPurpose
apps/server/Hono backend API
apps/web/TanStack Router frontend
packages/shared/Shared types, Zod schemas
packages/db/Database schema and migrations
packages/sandbox/Sandbox provider implementations
packages/agents/Agent executor implementations

Common Tasks

Running Tests

# Run all tests
bun run test

# Run tests for specific package
bun run test --filter=@sesame/shared

Type Checking

# Check all packages
bun run check-types

Linting

# Lint all code
bun run lint

# Fix auto-fixable issues
bun run lint --fix

Formatting

bun run format

Database Operations

# Generate migration from schema changes
bun run db:generate

# Run pending migrations
bun run db:migrate

# Push schema directly (dev only)
bun run db:push

# Open Drizzle Studio
bun run db:studio

Adding Features

Adding a New API Route

  1. Create route file in apps/server/src/routes/:
apps/server/src/routes/my-feature.ts
import { Hono } from "hono";
import { authMiddleware } from "../middleware/auth";

const app = new Hono()
  .use(authMiddleware)
  .get("/", async (c) => {
    return c.json({ message: "Hello!" });
  })
  .post("/", async (c) => {
    const body = await c.req.json();
    // Handle request
    return c.json({ success: true });
  });

export default app;
  1. Register in apps/server/src/routes/index.ts:
import myFeatureRoutes from "./my-feature";

const api = new Hono()
  // ... existing routes
  .route("/my-feature", myFeatureRoutes);

Adding a New Page

  1. Create route file in apps/web/src/routes/:
apps/web/src/routes/my-page.tsx
import { createFileRoute } from "@tanstack/react-router";

export const Route = createFileRoute("/my-page")({
  component: MyPage,
});

function MyPage() {
  return (
    <div>
      <h1>My Page</h1>
    </div>
  );
}

TanStack Router automatically picks up new files in routes/.

Adding a New Agent

See Adding Agents for detailed instructions.

Adding a New Sandbox Provider

See Adding Sandboxes for detailed instructions.

Code Style

TypeScript

  • Use strict TypeScript (strict: true)
  • Prefer type over interface for object types
  • Use Zod for runtime validation

React

  • Use functional components with hooks
  • Prefer composition over prop drilling
  • Use TanStack Query for server state

Naming Conventions

TypeConventionExample
Fileskebab-casemy-component.tsx
ComponentsPascalCaseMyComponent
FunctionscamelCasemyFunction
ConstantsSCREAMING_SNAKEMAX_RETRIES
TypesPascalCaseUserSettings

Pull Request Guidelines

  1. Create a branch from main:

    git checkout -b feat/my-feature
  2. Make changes following the code style

  3. Test your changes:

    bun run check-types
    bun run lint
    bun run test
  4. Commit with conventional commits:

    git commit -m "feat: add new feature"
    git commit -m "fix: resolve issue with auth"
    git commit -m "docs: update API documentation"
  5. Push and create PR:

    git push -u origin feat/my-feature

Debugging

Backend Logs

# View server logs
bun run dev --filter=@sesame/server

# Enable debug logging
DEBUG=* bun run dev --filter=@sesame/server

Frontend DevTools

  • React DevTools for component inspection
  • TanStack Query DevTools (enabled in dev mode)
  • Network tab for API requests

Database Inspection

# Open Drizzle Studio
bun run db:studio

Getting Help

On this page