iamrknain/flarestack

GitHub: iamrknain/flarestack

Stars: 0 | Forks: 0

# FlareStack FlareStack is a SaaS-ready, edge-native IP reputation and automated blocking system built for Cloudflare. It analyzes traffic telemetry at the edge and automatically updates WAF blocklists to mitigate volumetric DDoS, scrapers, and abusive bots in real-time with zero origin latency. ## Monorepo Architecture FlareStack is structured as a pnpm monorepo: * **`apps/dashboard`**: A Next.js administration portal styled with vanilla CSS. Integrates [Better Auth](https://www.better-auth.com/) and Cloudflare D1/SQLite for user accounts, configuration management, and real-time security analytics. * **`apps/worker`**: A lightweight [Hono](https://hono.dev/) worker deployed to Cloudflare Workers. It handles cron triggers, schedules telemetry syncs, and evaluates threat metrics at the edge. * **`packages/db`**: Core Drizzle schemas, configurations, and migration files. * **`packages/types`**: Shared TypeScript definitions and data interfaces. * **`packages/rules`**: Core scoring engines and threat classification rules. ## ⚙️ Local Development Setup ### 1. Install Dependencies Run from the root of the workspace: pnpm install ### 2. Configure Environment Variables Copy the env template inside `apps/dashboard` and fill in the required variables (your Better Auth secret will be auto-generated by the setup script): cp apps/dashboard/.env.example apps/dashboard/.env ### 3. Run the Auto-Setup Script This installs dependencies, generates the Drizzle schema, and configures the local SQLite database state: pnpm run setup ### 4. Start the Dev Servers Start the dashboard (Next.js) and worker (Wrangler dev) concurrently: pnpm run dev * **Dashboard Portal**: [http://localhost:3000](http://localhost:3000) * **Worker Server**: [http://localhost:8787](http://localhost:8787) * *Note: To trigger schedulers locally, press `t` in the worker CLI terminal or visit `http://localhost:8787/__scheduled`.* ## 🛠 Available CLI Commands Manage the workspace with these root commands: | Command | Action | | :--- | :--- | | `pnpm run setup` | Copies templates, runs migrations, and prepares the local D1 SQLite state. | | `pnpm run dev` | Runs both Next.js and Wrangler worker servers concurrently. | | `pnpm run clean` | Performs a full reset. Deletes `node_modules`, build artifacts, and database state. | | `pnpm run nuke:db` | Wipes only the local SQLite databases and generated migrations (leaves `node_modules` intact). | | `pnpm run stop` | Kills orphan processes holding ports `3000`, `5173`, `8787`, or `9229`. | | `pnpm run build` | Builds all packages and apps in the monorepo for production. | | `pnpm run deploy` | Deploys the worker and dashboard to production. |
标签:自动化攻击