Documentation
Welcome to Onscript documentation. This guide covers the architecture, design, and implementation of the Onscript platform.
Architecture
- Architecture Overview - System architecture, project structure, and design patterns
- Domain Layer - Core business logic and domain models
- OAuth Integration Models - OAuth token and connected account architecture
API Reference
Visit our API Reference for interactive OpenAPI documentation powered by Scalar.
Getting Started
Development Setup
Clone the repository
Install dependencies:
bashpnpm installStart development:
bashpnpm dev
Running Commands
bash
# Type check all projects
pnpm typecheck
# Build all projects
pnpm build
# Lint all code
pnpm lint
# Run tests
pnpm testCore 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:
- Route - HTTP endpoint handlers
- Service - Business logic orchestration
- 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:
- Start with domain models in
packages/domain/ - Define API endpoints in
packages/api/ - Implement backend route, service, and repository layers
- Create database migrations
- Update this documentation
See Architecture Overview for the complete development workflow.
Support
For questions or issues, reach out on Farcaster.