Spaces:
Running
Running
feat(agent): add Claude Code-style agent, skills, slash-commands, hooks, todos, sandboxed workspace, and full-stack scaffolding
81aa0b5 verified | name: fullstack-scaffold | |
| description: Scaffold complete fullstack projects with proper structure. Generates package.json, requirements.txt, Dockerfiles, and config files for any framework. | |
| language: any | |
| tags: scaffold, fullstack, project, structure, framework | |
| # Fullstack Project Scaffolding | |
| When generating a fullstack application, always produce a complete, runnable project β not just snippets. | |
| ## Project structure rules | |
| ### Python (Flask/FastAPI/Django/Streamlit/Gradio) | |
| ``` | |
| project-name/ | |
| βββ app.py # Entry point (HF Spaces expects app.py) | |
| βββ requirements.txt # Pinned dependencies | |
| βββ README.md # With HF Space frontmatter if deploying | |
| βββ .env.example # Document required env vars | |
| βββ src/ | |
| β βββ __init__.py | |
| β βββ routes/ # API routes | |
| β βββ models/ # Data models | |
| β βββ services/ # Business logic | |
| β βββ utils/ # Helpers | |
| βββ tests/ | |
| β βββ test_app.py | |
| βββ static/ # Static assets (if web framework) | |
| ``` | |
| ### Next.js / React (Vite) | |
| ``` | |
| project-name/ | |
| βββ package.json # name, version, scripts, deps | |
| βββ next.config.js # (Next.js only) output: 'standalone' | |
| βββ vite.config.js # (Vite only) | |
| βββ tsconfig.json # (TypeScript) | |
| βββ Dockerfile # Multi-stage build for HF Spaces | |
| βββ .dockerignore | |
| βββ README.md | |
| βββ public/ | |
| β βββ (static assets) | |
| βββ src/ | |
| βββ app/ # Next.js App Router | |
| βββ pages/ # Next.js Pages Router (legacy) | |
| βββ components/ # Reusable components | |
| βββ lib/ # Utilities, helpers | |
| βββ hooks/ # Custom hooks | |
| βββ styles/ # Global CSS | |
| βββ types/ # TypeScript types | |
| ``` | |
| ### Express / NestJS | |
| ``` | |
| project-name/ | |
| βββ package.json | |
| βββ Dockerfile | |
| βββ .dockerignore | |
| βββ README.md | |
| βββ src/ | |
| β βββ index.js # Entry β app.listen(7860, '0.0.0.0') | |
| β βββ routes/ | |
| β βββ middleware/ | |
| β βββ controllers/ # NestJS only | |
| β βββ services/ | |
| β βββ models/ | |
| βββ tests/ | |
| ``` | |
| ## Port and host rules (critical for HF Spaces) | |
| - All servers MUST listen on `0.0.0.0` (not `localhost` or `127.0.0.1`) | |
| - All servers MUST use port `7860` (HF Spaces default) | |
| - For sub-servers (Gradio subprocess), use 7861, 7862, etc. | |
| ## Dockerfile rules | |
| For JS/TS projects, generate a Dockerfile: | |
| - Use `node:20-slim` as base | |
| - Multi-stage build: deps β builder β runner | |
| - For SPAs (React/Vue), serve with nginx on port 7860 | |
| - For Next.js, use `output: 'standalone'` and copy `.next/standalone` | |
| - Run as non-root user | |
| For Python projects, the HF Space SDK auto-generates the runtime β no Dockerfile needed unless using Docker SDK. | |
| ## package.json rules | |
| - Always include `name`, `version`, `private: true` | |
| - Scripts: `dev`, `build`, `start` (start must bind 0.0.0.0:7860) | |
| - Pin major versions: `"react": "^18.3.0"` not `"react": "latest"` | |
| - Dev dependencies: TypeScript, types, build tools, linters | |
| - Production dependencies: runtime libraries only | |
| ## requirements.txt rules | |
| - Pin with `>=` to allow patch updates: `flask>=3.0.0` | |
| - Group by category (web, db, ml, dev) with comments | |
| - Always include the framework (flask, fastapi, gradio, etc.) | |
| - Never include stdlib modules | |
| ## README.md rules | |
| For HF Spaces, include frontmatter: | |
| ```yaml | |
| --- | |
| title: App Name | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: gradio # or docker, static, streamlit | |
| app_file: app.py # or index.html, Dockerfile | |
| pinned: false | |
| --- | |
| ``` | |
| ## Don't include | |
| - `node_modules/` | |
| - `.next/` (build output) | |
| - `__pycache__/` | |
| - `.venv/`, `venv/` | |
| - Lock files (let HF install fresh) | |
| - `.env` (only `.env.example`) | |