Skip to content

Documentation

Welcome to Onscript documentation. This guide covers the architecture, design, and implementation of the Onscript platform.

Architecture

API Reference

Visit our API Reference for interactive OpenAPI documentation powered by Scalar.

Getting Started

Development Setup

  1. Clone the repository

  2. Install dependencies:

    bash
    pnpm install
  3. Start development:

    bash
    pnpm dev

Running Commands

bash
# Type check all projects
pnpm typecheck

# Build all projects
pnpm build

# Lint all code
pnpm lint

# Run tests
pnpm test

Core Concepts

Effect-based Architecture

Onscript uses the Effect library throughout the codebase for:

  • Type-safe error handling
  • Composable effects and side effects
  • Dependency injection via Context.Tag
  • Testable, predictable code

Monorepo Structure

The project is organized as an Nx monorepo with pnpm workspaces:

  • packages/ - Shared libraries (domain, api, api-client)
  • apps/ - Applications (backend, docs, frontend, webapp)

Layered Architecture

Each backend feature follows a three-layer pattern:

  1. Route - HTTP endpoint handlers
  2. Service - Business logic orchestration
  3. Repository - Data access with Kysely

See Architecture Overview for details.

Key Technologies

  • TypeScript - Type-safe development
  • Effect - Functional programming framework
  • Nx - Monorepo management
  • pnpm - Package manager
  • Kysely - Type-safe SQL queries
  • SQLite - Database (configurable)
  • VitePress - Documentation framework
  • Scalar - API documentation generator

Contributing

When adding features:

  1. Start with domain models in packages/domain/
  2. Define API endpoints in packages/api/
  3. Implement backend route, service, and repository layers
  4. Create database migrations
  5. Update this documentation

See Architecture Overview for the complete development workflow.

Support

For questions or issues, reach out on Farcaster.