feat: enhance project structure with server and workflow management

- Introduced a new server package with Fastify for handling API requests and workflows.
- Implemented user authentication and authorization with JWT and cookie management.
- Added endpoints for managing workflows, runs, and user accounts.
- Established a dashboard for monitoring workflow status and statistics.
- Included a script sandbox for executing user-defined scripts securely.
- Updated README with setup instructions and API documentation.
- Configured database migrations for user management.
- Enhanced logging capabilities for better traceability.
This commit is contained in:
2026-08-14 14:25:37 +07:00
parent 5574d6f723
commit 023cf83cfa
48 changed files with 6127 additions and 359 deletions
+53
View File
@@ -0,0 +1,53 @@
# scrunner
Workflow runner with a sandboxed script engine, SQLite run history, and an admin UI.
## Packages
- `packages/server` — Fastify runner, HTTP/cron triggers, admin REST API
- `packages/web` — React admin UI (Vite, DaisyUI, React Query)
## Setup
```bash
pnpm install
pnpm dev
```
- API: http://localhost:9000
- UI (dev): http://localhost:5173
The first account created becomes **admin**. Later accounts are created from Users.
## Scripts
| Command | Description |
|---|---|
| `pnpm dev` | Server + Vite together |
| `pnpm dev:server` | API/runner only |
| `pnpm dev:web` | UI only (proxies `/api` to :9000) |
| `pnpm build` | Production UI build |
| `pnpm start` | Serve API and built UI from :9000 |
| `pnpm migrate` | Apply SQLite migrations |
## Environment
| Variable | Default | Notes |
|---|---|---|
| `SCRUNNER_JWT_SECRET` | `scrunner-dev-secret` (dev only) | **Required in production** |
| `SCRUNNER_DB_PATH` | `packages/server/data/scrunner.db` | SQLite file |
| `SCRUNNER_LOG_LEVEL` | `debug` | Pino level |
| `SCRUNNER_RETENTION_DAYS` | `30` | Run history prune |
| `SCRUNNER_CORS_ORIGIN` | `http://localhost:5173` | Vite origin in dev |
| `PORT` | `9000` | HTTP port |
| `NODE_ENV` | — | Set `production` for secure cookies |
## Production
```bash
pnpm install
pnpm build
SCRUNNER_JWT_SECRET=... NODE_ENV=production pnpm start
```
The server serves `packages/web/dist` when that folder exists.