Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
ci:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 8

- name: Install global packages
run: pnpm install -g tsup

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Lint
run: pnpm nx:lint

- name: Build
run: pnpm nx:build
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ node_modules
.env
.dev.vars

.vscode
.nx/installation
.nx/cache
.nx/workspace-data
Expand All @@ -11,6 +10,4 @@ node_modules
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md

wrangler.jsonc

!.env.example
23 changes: 0 additions & 23 deletions .prettierrc

This file was deleted.

25 changes: 25 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": false,
"files.readonlyInclude": {
"**/routeTree.gen.ts": true
},
"files.watcherExclude": {
"**/routeTree.gen.ts": true
},
"search.exclude": {
"**/routeTree.gen.ts": true
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"source.fixAll.biome": "explicit"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
3 changes: 1 addition & 2 deletions apps/api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,4 @@ dist
# wrangler project

.dev.vars
.wrangler/
worker-configuration.d.ts
.wrangler/
113 changes: 58 additions & 55 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,60 @@
{
"name": "@coderscreen/api",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "tsc",
"dev": "wrangler dev",
"start": "wrangler dev",
"test": "vitest",
"cf-deploy": "wrangler deploy",
"cf-types": "wrangler types",
"auth:generate": "pnpm dlx @better-auth/cli@latest generate --config ./better-auth.config.ts --output ../../packages/db/src/user.db.ts",
"sandbox:build": "cd ../.. && pnpm sandbox:build",
"sandbox:push": "wrangler containers push sandbox-image:production",
"stripe:listen": "stripe listen --forward-to localhost:8000/webhook/stripe"
},
"devDependencies": {
"@cloudflare/vitest-pool-workers": "^0.8.36",
"@types/lodash.throttle": "^4.1.9",
"@types/node": "^24.0.3",
"partykit": "0.0.115",
"typescript": "^5.8.3",
"vitest": "~3.0.9",
"wrangler": "^4.22.0"
},
"dependencies": {
"@cloudflare/containers": "^0.0.13",
"@cloudflare/sandbox": "workspace:^",
"@coderscreen/common": "workspace:^",
"@coderscreen/db": "workspace:^",
"@daytonaio/sdk": "0.21.1",
"@hono/zod-validator": "^0.7.0",
"@tldraw/sync-core": "^3.14.0",
"@tldraw/tlschema": "^3.14.0",
"better-auth": "^1.2.10",
"drizzle-orm": "^0.44.2",
"hono": "^4.7.11",
"hono-openapi": "^0.4.8",
"hono-party": "^0.0.13",
"lodash.throttle": "^4.1.1",
"loops": "^5.0.1",
"openai": "^5.9.0",
"partyserver": "^0.0.72",
"partysocket": "1.1.4",
"postgres": "^3.4.7",
"stripe": "^18.3.0",
"y-partykit": "^0.0.33",
"y-partyserver": "^0.0.45",
"y-protocols": "^1.0.6",
"yjs": "^13.6.27",
"zod": "^3.25.67",
"zod-openapi": "^4.2.4"
},
"exports": {
".": "./dist/src/index.d.ts"
}
"name": "@coderscreen/api",
"version": "0.0.0",
"private": true,
"scripts": {
"lint": "biome check src",
"lint:fix": "biome check src --write",
"format": "biome format src --write",
"build": "tsc",
"dev": "wrangler dev",
"start": "wrangler dev",
"test": "vitest",
"cf-deploy": "wrangler deploy",
"cf-types": "wrangler types",
"auth:generate": "pnpm dlx @better-auth/cli@latest generate --config ./better-auth.config.ts --output ../../packages/db/src/user.db.ts",
"sandbox:build": "cd ../.. && pnpm sandbox:build",
"sandbox:push": "wrangler containers push sandbox-image:production",
"stripe:listen": "stripe listen --forward-to localhost:8000/webhook/stripe"
},
"devDependencies": {
"@cloudflare/vitest-pool-workers": "^0.8.36",
"@types/lodash.throttle": "^4.1.9",
"@types/node": "^24.0.3",
"partykit": "0.0.115",
"typescript": "^5.8.3",
"vitest": "~3.0.9",
"wrangler": "^4.22.0"
},
"dependencies": {
"@cloudflare/containers": "^0.0.13",
"@cloudflare/sandbox": "workspace:^",
"@coderscreen/common": "workspace:^",
"@coderscreen/db": "workspace:^",
"@daytonaio/sdk": "0.21.1",
"@hono/zod-validator": "^0.7.0",
"@tldraw/sync-core": "^3.14.0",
"@tldraw/tlschema": "^3.14.0",
"better-auth": "^1.2.10",
"drizzle-orm": "^0.44.2",
"hono": "^4.7.11",
"hono-openapi": "^0.4.8",
"hono-party": "^0.0.13",
"lodash.throttle": "^4.1.1",
"loops": "^5.0.1",
"openai": "^5.9.0",
"partyserver": "^0.0.72",
"partysocket": "1.1.4",
"postgres": "^3.4.7",
"stripe": "^18.3.0",
"y-partykit": "^0.0.33",
"y-partyserver": "^0.0.45",
"y-protocols": "^1.0.6",
"yjs": "^13.6.27",
"zod": "^3.25.67",
"zod-openapi": "^4.2.4"
},
"exports": {
".": "./dist/src/index.d.ts"
}
}
17 changes: 17 additions & 0 deletions apps/api/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"targets": {
"build": {
"dependsOn": [
{
"projects": ["sandbox"],
"target": "build",
"params": "ignore"
},
"^build"
]
},
"test": {
"dependsOn": ["build"]
}
}
}
18 changes: 9 additions & 9 deletions apps/api/src/containers/CustomSandbox.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { SpawnOptions } from 'node:child_process';
import { Sandbox } from '@cloudflare/sandbox';
import { AppContext } from '@/index';
import { RoomEntity } from '@coderscreen/db/room.db';
import { TypescriptRunner } from '@/containers/runners/ts.runner';
import { CodeRunner } from '@/containers/runners/base';
import { JavaScriptRunner } from '@/containers/runners/js.runner';
import { PythonRunner } from '@/containers/runners/python.runner';
import { BashRunner } from '@/containers/runners/bash.runner';
import { CRunner } from '@/containers/runners/c.runner';
import { CppRunner } from '@/containers/runners/cpp.runner';
import { GoRunner } from '@/containers/runners/go.runner';
import { RustRunner } from '@/containers/runners/rust.runner';
import { JavaRunner } from '@/containers/runners/java.runner';
import { JavaScriptRunner } from '@/containers/runners/js.runner';
import { PhpRunner } from '@/containers/runners/php.runner';
import { PythonRunner } from '@/containers/runners/python.runner';
import { RubyRunner } from '@/containers/runners/ruby.runner';
import { JavaRunner } from '@/containers/runners/java.runner';
import { SpawnOptions } from 'child_process';
import { RustRunner } from '@/containers/runners/rust.runner';
import { TypescriptRunner } from '@/containers/runners/ts.runner';
import { AppContext } from '@/index';
import { ExecuteResponse } from '@/lib/sandbox';

export class CustomSandbox extends Sandbox<AppContext['Bindings']> {
Expand All @@ -26,15 +26,15 @@ export class CustomSandbox extends Sandbox<AppContext['Bindings']> {
args: string[],
options?: { stream?: boolean; childOptions?: SpawnOptions }
): Promise<ExecuteResponse> {
let start = Date.now();
const start = Date.now();
const result = await super.exec(command, args, {
...options,
childOptions: {
...options?.childOptions,
timeout: options?.childOptions?.timeout || this.FALLBACK_TIMEOUT_MS,
},
});
let end = Date.now();
const end = Date.now();
const elapsedTime = end - start;

if (!result) {
Expand Down
24 changes: 12 additions & 12 deletions apps/api/src/containers/config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"compilerOptions": {
"target": "es2021",
"module": "commonjs",
"lib": ["es2021", "dom"],
"types": ["node"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true
},
"include": ["**/*.ts"]
"compilerOptions": {
"target": "es2021",
"module": "commonjs",
"lib": ["es2021", "dom"],
"types": ["node"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true
},
"include": ["**/*.ts"]
}
Loading