Skip to content

feat: initialize Nexu monorepo with API, web dashboard, and Slack integration#2

Merged
lefarcen merged 14 commits intomainfrom
feat/nexu
Feb 26, 2026
Merged

feat: initialize Nexu monorepo with API, web dashboard, and Slack integration#2
lefarcen merged 14 commits intomainfrom
feat/nexu

Conversation

@lefarcen
Copy link
Copy Markdown
Collaborator

@lefarcen lefarcen commented Feb 26, 2026

Summary

  • Scaffold pnpm monorepo with apps/api, apps/web, and packages/shared
  • Implement Hono-based API server with Drizzle ORM, Better Auth, and OpenAPI spec generation
  • Build React (Vite) web dashboard with auth, bot config, channel management, and Slack OAuth flow
  • Add Slack events endpoint with signature verification and gateway forwarding
  • Introduce shared Zod schemas for bots, channels, gateways, invites, and models
  • Generate typed frontend SDK from OpenAPI spec via openapi-ts
  • Add Docker Compose setup, Biome config, and local Slack testing guide

Key Components

  • API (apps/api): Auth, bot/channel/invite/model/pool routes, Slack events, OpenClaw config generator
  • Web (apps/web): Auth pages, workspace layout, bot config, channel management, invite flow
  • Shared (packages/shared): Zod schemas and TypeScript types
  • Docs: OpenClaw architecture internals, local Slack testing guide

Summary by CodeRabbit

  • New Features

    • Bot management: create, update, pause/resume, delete, and multi-bot support
    • Slack integration: OAuth connect, event webhooks, connect/disconnect flows
    • Web dashboard: workspace, bot config, channels, Slack OAuth callback, invite flow
    • Authentication: email/password and GitHub/Google sign-in
    • Model selection and system prompt configuration
  • Infrastructure

    • PostgreSQL-backed API with OpenAPI docs and local Docker Compose dev setup
    • Generated web API client and monorepo packaging
  • Documentation

    • Architecture and local Slack testing guides

cursoragent and others added 13 commits February 25, 2026 08:04
- Part 1: pnpm workspace, tsconfig, biome, .env.example
- Part 2: API with Hono + Drizzle (SQLite) + better-auth
  - DB schema (bots, channels, credentials, pools)
  - AES-256-GCM crypto module
  - Config Generator (core module)
  - Bot CRUD, Channel, Pool routes
  - Config Generator unit tests
- Part 3: Web with React + Ant Design + Vite
  - Login/Register pages
  - Bot list + create
  - Bot detail with channels and config preview
- packages/shared: Zod schemas for bots, channels, config

Co-authored-by: lefarcen <lefarcen@users.noreply.github.com>
- Fix AppBindings type consistency across all routes
- Fix Database type redeclaration in db/index.ts
- Replace non-null assertions with optional chains and type guards
- Fix import sorting and formatting issues
- All typecheck, lint, and tests pass

Co-authored-by: lefarcen <lefarcen@users.noreply.github.com>
- Generate openapi.json from API routes
- Configure @hey-api/openapi-ts with plugins
- Generate SDK (types.gen.ts, sdk.gen.ts, client.gen.ts)
- Fix better-auth baseURL config
- Add SQLite db files to .gitignore
- Add openapi.json to biome ignore list

Co-authored-by: lefarcen <lefarcen@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… refactor web app structure for improved authentication and bot management
… gateway forwarding, and update Slack webhook route creation to always include a route.
…age to ensure accurate signature verification and handle retries.
…responses, enhancing the local Slack testing documentation.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 26, 2026

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 6970dbf and 40d2e0c.

📒 Files selected for processing (4)
  • apps/api/src/lib/config-generator.ts
  • docs/cowork
  • docs/guides/local-slack-testing.md
  • packages/shared/src/schemas/openclaw-config.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/guides/local-slack-testing.md
  • docs/cowork

📝 Walkthrough

Walkthrough

Adds a full-stack monorepo: a Hono-based API with DB schema, migrations, auth, Slack integration and OpenClaw pool config generation; a React + Vite frontend with generated API client and UI primitives; shared Zod schemas, CI/ tooling configs, docs, and Docker/Postgres compose.

Changes

Cohort / File(s) Summary
Project tooling & workspace
. .env.example, .gitignore, .gitmodules, biome.json, pnpm-workspace.yaml, tsconfig.base.json, package.json, docker-compose.yml
Monorepo and toolchain config, env example, git submodule, Docker Postgres service, and base TypeScript rules.
Shared package
packages/shared/package.json, packages/shared/tsconfig.json, packages/shared/src/index.ts, packages/shared/src/schemas/*
New @nexu/shared package exporting Zod schemas for bots, channels, pools, invites, models, and OpenClaw config.
API project config & generation
apps/api/package.json, apps/api/tsconfig.json, apps/api/drizzle.config.ts, apps/api/openapi.json, apps/api/scripts/generate-openapi.ts
API package manifest, TypeScript config, DrizzleKit config, full OpenAPI spec, and OpenAPI generation script.
API bootstrap & auth
apps/api/src/index.ts, apps/api/src/app.ts, apps/api/src/auth.ts, apps/api/src/types.ts, apps/api/src/middleware/auth.ts, apps/api/src/routes/auth-routes.ts
Server entry, Hono app with OpenAPI, better-auth initialization, request auth middleware, and auth route wiring.
Database layer & migrations
apps/api/src/db/index.ts, apps/api/src/db/migrate.ts, apps/api/src/db/schema/index.ts, apps/api/drizzle.config.ts
Postgres pool, Drizzle ORM binding, comprehensive SQL migration script, and schema table definitions for bots, channels, credentials, pools, assignments, users, metrics, webhooks, oauth states, invite codes.
API libs: crypto, models, config-gen & tests
apps/api/src/lib/crypto.ts, apps/api/src/lib/models.ts, apps/api/src/lib/config-generator.ts, apps/api/src/lib/__tests__/config-generator.test.ts
AES-256-GCM encrypt/decrypt, platform model catalog, generatePoolConfig (builds and validates OpenClaw config, decrypts creds, increments configVersion), and comprehensive tests.
API routes: bots, channels, invites, models, pools, Slack events
apps/api/src/routes/bot-routes.ts, apps/api/src/routes/channel-routes.ts, apps/api/src/routes/invite-routes.ts, apps/api/src/routes/model-routes.ts, apps/api/src/routes/pool-routes.ts, apps/api/src/routes/slack-events.ts
Full REST endpoints for bot lifecycle, Slack connect/OAuth callback, invite validation, model listing, internal pool config endpoint, and Slack event webhook handling with signature verification and gateway forwarding.
Web project config & generation
apps/web/package.json, apps/web/tsconfig.json, apps/web/vite.config.ts, apps/web/openapi-ts.config.ts, apps/web/index.html
Frontend package manifest, TS and Vite configs, OpenAPI-TS generator config, and HTML entry.
Generated web API client
apps/web/lib/api/client.gen.ts, apps/web/lib/api/index.ts, apps/web/lib/api/sdk.gen.ts, apps/web/lib/api/types.gen.ts
Auto-generated typed client, SDK helpers, and operation types derived from apps/api/openapi.json.
Web app core & utils
apps/web/src/main.tsx, apps/web/src/app.tsx, apps/web/src/lib/api.ts, apps/web/src/lib/auth-client.ts, apps/web/src/lib/utils.ts, apps/web/src/index.css
React entry, routing and Query client, configured API client and auth client, cn util, and Tailwind-based global styles.
UI primitives & components
apps/web/src/components/ui/*
New reusable UI primitives (Button, Badge, Card, Input, Label, Select, Separator, Tabs, Textarea) with CVA and Radix wrappers.
Layouts & pages
apps/web/src/layouts/*, apps/web/src/pages/*
Auth and workspace layouts; pages: Landing, Auth, Invite, Bot Config, Channels (Slack/Discord flows), Slack OAuth callback.
Documentation & guides
docs/designs/openclaw-architecture-internals.md, docs/guides/local-slack-testing.md, docs/cowork (submodule)
Design doc for OpenClaw architecture and a local Slack testing guide; adds docs submodule pointer.

Sequence Diagram(s)

sequenceDiagram
  participant Slack as Slack
  participant API as API (/api/slack/events)
  participant DB as Database
  participant Gateway as Gateway Pod

  Slack->>API: POST event (raw body + headers)
  API->>DB: lookup webhook_route by team_id -> get botChannel & signing secret
  API->>API: verify Slack signature (timestamp + signature)
  API->>DB: resolve pool and gateway assignment for botChannel
  API->>Gateway: forward event (preserve headers + body)
  Gateway-->>API: 200/ok
  API-->>Slack: 200/ok
Loading
sequenceDiagram
  participant Internal as Internal API (/api/internal/pools/{id}/config)
  participant DB as Database
  participant Crypto as Crypto (encrypt/decrypt)
  participant Validator as OpenClaw Validator

  Internal->>DB: fetch pool, bots, channels, credentials
  Internal->>Crypto: decrypt channel credentials
  Internal->>Internal: build OpenClaw config (agents, channels, bindings, gateway)
  Internal->>Validator: validate config against schema
  Internal->>DB: increment pool.configVersion
  Internal-->>Caller: return validated OpenClawConfig
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Poem

🐰 Hop, I stitched a stack from code and cheer,

Bots, channels, keys — all tucked in here,
Routes that whisper, configs that hum,
Slack events forwarded, gateways drum,
A little rabbit claps — the monorepo's near!


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@lefarcen lefarcen changed the title Feat/nexu feat: scaffold Nexu monorepo with API, web app, and Slack integration Feb 26, 2026
@lefarcen lefarcen changed the title feat: scaffold Nexu monorepo with API, web app, and Slack integration feat: initialize Nexu monorepo with API, web dashboard, and Slack integration Feb 26, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6970dbfe7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +37 to +41
app.openapi(getPoolConfigRoute, async (c) => {
const { poolId } = c.req.valid("param");
try {
const config = await generatePoolConfig(db, poolId);
return c.json(config, 200);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require auth before returning generated pool config

This handler returns generatePoolConfig(...) directly without validating any token/session, and that generated payload includes decrypted Slack credentials (botToken and signingSecret) from apps/api/src/lib/config-generator.ts; because this endpoint sits outside the /v1/* auth middleware, any client that can reach the API can pull live channel secrets for a known/guessable pool ID (for example, default).

Useful? React with 👍 / 👎.

Comment on lines +61 to +65
// Increment used count
await db
.update(inviteCodes)
.set({ usedCount: sql`${inviteCodes.usedCount} + 1` })
.where(eq(inviteCodes.id, invite.id));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop consuming invite quota during validation

The invite check endpoint is used by the UI to validate a code before proceeding (apps/web/src/pages/invite.tsx), but this code increments usedCount on every successful validation; users can exhaust maxUses just by retrying/refreshing validation without completing onboarding, which prematurely invalidates otherwise usable invite codes.

Useful? React with 👍 / 👎.

Comment on lines +313 to +317
await db
.delete(gatewayAssignments)
.where(eq(gatewayAssignments.botId, botId));

await db
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove webhook routes when deleting a bot

Bot deletion only drops the gateway assignment and soft-deletes the bot record, but it does not clean up related bot_channels/webhook_routes; since Slack connect enforces global uniqueness via webhook_routes (apps/api/src/routes/channel-routes.ts), a workspace tied to a deleted bot remains blocked as “already connected,” so users cannot reconnect that workspace to a replacement bot.

Useful? React with 👍 / 👎.

.min(1)
.max(100),
systemPrompt: z.string().optional(),
modelId: z.string().default("gpt-4o"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align default modelId with model catalog IDs

The default modelId here is gpt-4o, but the platform model list uses provider-qualified IDs such as openai/gpt-4o (apps/api/src/lib/models.ts); creating bots without an explicit model stores an ID that doesn't match available models, which can surface as an unknown selection in the dashboard and propagate an invalid model identifier into generated config.

Useful? React with 👍 / 👎.

…uired fields, add default agent model, set gateway bind to loopback, and update schema and docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants