create-fluxstack 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +63 -0
- package/.dockerignore +50 -0
- package/.env.example +53 -0
- package/.gitattributes +2 -0
- package/.github/workflows/ci-build-tests.yml +480 -0
- package/.github/workflows/dependency-management.yml +324 -0
- package/.github/workflows/release-validation.yml +355 -0
- package/.kiro/specs/fluxstack-architecture-optimization/design.md +700 -0
- package/.kiro/specs/fluxstack-architecture-optimization/requirements.md +127 -0
- package/.kiro/specs/fluxstack-architecture-optimization/tasks.md +330 -0
- package/CLAUDE.md +200 -0
- package/Dockerfile +58 -0
- package/Dockerfile.backend +52 -0
- package/Dockerfile.frontend +54 -0
- package/ENV_TESTING_REPORT.md +292 -0
- package/FRAMEWORK_ROADMAP.md +183 -0
- package/FRONTEND_TESTS_README.md +287 -0
- package/README-Docker.md +85 -0
- package/TEST_RESULTS.md +130 -0
- package/ai-context/00-QUICK-START.md +86 -0
- package/ai-context/README.md +88 -0
- package/ai-context/development/eden-treaty-guide.md +362 -0
- package/ai-context/development/patterns.md +382 -0
- package/ai-context/examples/crud-complete.md +626 -0
- package/ai-context/project/architecture.md +399 -0
- package/ai-context/project/overview.md +213 -0
- package/ai-context/recent-changes/eden-treaty-refactor.md +281 -0
- package/ai-context/recent-changes/type-inference-fix.md +223 -0
- package/ai-context/reference/environment-vars.md +384 -0
- package/ai-context/reference/troubleshooting.md +407 -0
- package/bun.lock +21 -11
- package/bunfig.toml +16 -0
- package/config/fluxstack.config.ts +48 -0
- package/create-fluxstack.ts +2 -3
- package/create-test-app.ts +156 -0
- package/docker-compose.microservices.yml +75 -0
- package/docker-compose.simple.yml +57 -0
- package/docker-compose.yml +71 -0
- package/docs/dynamic-environment-variables.md +380 -0
- package/eslint.config.js +23 -0
- package/examples/dynamic-env-usage.ts +283 -0
- package/examples/hybrid-env-strategy.ts +212 -0
- package/examples/simplified-env-usage.ts +251 -0
- package/flux-cli.ts +214 -0
- package/fluxstack.config.ts +318 -0
- package/meu-app-teste/README.md +44 -0
- package/meu-app-teste/app/client/README.md +69 -0
- package/meu-app-teste/app/client/frontend-only.ts +12 -0
- package/meu-app-teste/app/client/index.html +13 -0
- package/meu-app-teste/app/client/public/vite.svg +1 -0
- package/meu-app-teste/app/client/src/App.css +883 -0
- package/meu-app-teste/app/client/src/App.tsx +669 -0
- package/meu-app-teste/app/client/src/assets/react.svg +1 -0
- package/meu-app-teste/app/client/src/components/TestPage.tsx +453 -0
- package/meu-app-teste/app/client/src/index.css +51 -0
- package/meu-app-teste/app/client/src/lib/eden-api.ts +110 -0
- package/meu-app-teste/app/client/src/main.tsx +10 -0
- package/meu-app-teste/app/client/src/vite-env.d.ts +1 -0
- package/meu-app-teste/app/client/tsconfig.app.json +43 -0
- package/meu-app-teste/app/client/tsconfig.json +7 -0
- package/meu-app-teste/app/client/tsconfig.node.json +25 -0
- package/meu-app-teste/app/server/app.ts +10 -0
- package/meu-app-teste/app/server/backend-only.ts +15 -0
- package/meu-app-teste/app/server/controllers/users.controller.ts +69 -0
- package/meu-app-teste/app/server/index.ts +104 -0
- package/meu-app-teste/app/server/routes/index.ts +25 -0
- package/meu-app-teste/app/server/routes/users.routes.ts +121 -0
- package/meu-app-teste/app/server/types/index.ts +1 -0
- package/meu-app-teste/app/shared/types/index.ts +18 -0
- package/meu-app-teste/bun.lock +1053 -0
- package/meu-app-teste/core/__tests__/integration.test.ts +227 -0
- package/meu-app-teste/core/build/index.ts +186 -0
- package/meu-app-teste/core/cli/command-registry.ts +334 -0
- package/meu-app-teste/core/cli/index.ts +394 -0
- package/meu-app-teste/core/cli/plugin-discovery.ts +200 -0
- package/meu-app-teste/core/client/standalone.ts +57 -0
- package/meu-app-teste/core/config/__tests__/config-loader.test.ts +591 -0
- package/meu-app-teste/core/config/__tests__/config-merger.test.ts +657 -0
- package/meu-app-teste/core/config/__tests__/env-converter.test.ts +372 -0
- package/meu-app-teste/core/config/__tests__/env-processor.test.ts +431 -0
- package/meu-app-teste/core/config/__tests__/env.test.ts +452 -0
- package/meu-app-teste/core/config/__tests__/integration.test.ts +418 -0
- package/meu-app-teste/core/config/__tests__/loader.test.ts +331 -0
- package/meu-app-teste/core/config/__tests__/schema.test.ts +129 -0
- package/meu-app-teste/core/config/__tests__/validator.test.ts +318 -0
- package/meu-app-teste/core/config/env-dynamic.ts +326 -0
- package/meu-app-teste/core/config/env.ts +597 -0
- package/meu-app-teste/core/config/index.ts +317 -0
- package/meu-app-teste/core/config/loader.ts +546 -0
- package/meu-app-teste/core/config/runtime-config.ts +322 -0
- package/meu-app-teste/core/config/schema.ts +694 -0
- package/meu-app-teste/core/config/validator.ts +540 -0
- package/meu-app-teste/core/framework/__tests__/server.test.ts +233 -0
- package/meu-app-teste/core/framework/client.ts +132 -0
- package/meu-app-teste/core/framework/index.ts +8 -0
- package/meu-app-teste/core/framework/server.ts +501 -0
- package/meu-app-teste/core/framework/types.ts +63 -0
- package/meu-app-teste/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
- package/meu-app-teste/core/plugins/__tests__/manager.test.ts +398 -0
- package/meu-app-teste/core/plugins/__tests__/monitoring.test.ts +401 -0
- package/meu-app-teste/core/plugins/__tests__/registry.test.ts +335 -0
- package/meu-app-teste/core/plugins/built-in/index.ts +142 -0
- package/meu-app-teste/core/plugins/built-in/logger/index.ts +180 -0
- package/meu-app-teste/core/plugins/built-in/monitoring/README.md +193 -0
- package/meu-app-teste/core/plugins/built-in/monitoring/index.ts +912 -0
- package/meu-app-teste/core/plugins/built-in/static/index.ts +289 -0
- package/meu-app-teste/core/plugins/built-in/swagger/index.ts +229 -0
- package/meu-app-teste/core/plugins/built-in/vite/index.ts +316 -0
- package/meu-app-teste/core/plugins/config.ts +348 -0
- package/meu-app-teste/core/plugins/discovery.ts +350 -0
- package/meu-app-teste/core/plugins/executor.ts +351 -0
- package/meu-app-teste/core/plugins/index.ts +195 -0
- package/meu-app-teste/core/plugins/manager.ts +583 -0
- package/meu-app-teste/core/plugins/registry.ts +424 -0
- package/meu-app-teste/core/plugins/types.ts +254 -0
- package/meu-app-teste/core/server/framework.ts +123 -0
- package/meu-app-teste/core/server/index.ts +8 -0
- package/meu-app-teste/core/server/plugins/database.ts +182 -0
- package/meu-app-teste/core/server/plugins/logger.ts +47 -0
- package/meu-app-teste/core/server/plugins/swagger.ts +34 -0
- package/meu-app-teste/core/server/standalone.ts +91 -0
- package/meu-app-teste/core/templates/create-project.ts +455 -0
- package/meu-app-teste/core/types/api.ts +169 -0
- package/meu-app-teste/core/types/build.ts +174 -0
- package/meu-app-teste/core/types/config.ts +68 -0
- package/meu-app-teste/core/types/index.ts +127 -0
- package/meu-app-teste/core/types/plugin.ts +94 -0
- package/meu-app-teste/core/utils/__tests__/errors.test.ts +139 -0
- package/meu-app-teste/core/utils/__tests__/helpers.test.ts +297 -0
- package/meu-app-teste/core/utils/__tests__/logger.test.ts +141 -0
- package/meu-app-teste/core/utils/env-runtime-v2.ts +232 -0
- package/meu-app-teste/core/utils/env-runtime.ts +252 -0
- package/meu-app-teste/core/utils/errors/codes.ts +115 -0
- package/meu-app-teste/core/utils/errors/handlers.ts +63 -0
- package/meu-app-teste/core/utils/errors/index.ts +81 -0
- package/meu-app-teste/core/utils/helpers.ts +180 -0
- package/meu-app-teste/core/utils/index.ts +18 -0
- package/meu-app-teste/core/utils/logger/index.ts +161 -0
- package/meu-app-teste/core/utils/logger.ts +106 -0
- package/meu-app-teste/core/utils/monitoring/index.ts +212 -0
- package/meu-app-teste/package.json +92 -0
- package/meu-app-teste/tsconfig.json +51 -0
- package/meu-app-teste/vite.config.ts +42 -0
- package/my-final-test/README.md +44 -0
- package/my-final-test/app/client/README.md +69 -0
- package/my-final-test/app/client/frontend-only.ts +12 -0
- package/my-final-test/app/client/index.html +13 -0
- package/my-final-test/app/client/public/vite.svg +1 -0
- package/my-final-test/app/client/src/App.css +883 -0
- package/my-final-test/app/client/src/App.tsx +669 -0
- package/my-final-test/app/client/src/assets/react.svg +1 -0
- package/my-final-test/app/client/src/components/TestPage.tsx +453 -0
- package/my-final-test/app/client/src/index.css +51 -0
- package/my-final-test/app/client/src/lib/eden-api.ts +110 -0
- package/my-final-test/app/client/src/main.tsx +10 -0
- package/my-final-test/app/client/src/vite-env.d.ts +1 -0
- package/my-final-test/app/client/tsconfig.app.json +43 -0
- package/my-final-test/app/client/tsconfig.json +7 -0
- package/my-final-test/app/client/tsconfig.node.json +25 -0
- package/my-final-test/app/server/app.ts +10 -0
- package/my-final-test/app/server/backend-only.ts +15 -0
- package/my-final-test/app/server/controllers/users.controller.ts +69 -0
- package/my-final-test/app/server/index.ts +104 -0
- package/my-final-test/app/server/routes/index.ts +25 -0
- package/my-final-test/app/server/routes/users.routes.ts +121 -0
- package/my-final-test/app/server/types/index.ts +1 -0
- package/my-final-test/app/shared/types/index.ts +18 -0
- package/my-final-test/bun.lock +993 -0
- package/my-final-test/core/__tests__/integration.test.ts +227 -0
- package/my-final-test/core/build/index.ts +186 -0
- package/my-final-test/core/cli/command-registry.ts +334 -0
- package/my-final-test/core/cli/index.ts +394 -0
- package/my-final-test/core/cli/plugin-discovery.ts +200 -0
- package/my-final-test/core/client/standalone.ts +57 -0
- package/my-final-test/core/config/__tests__/config-loader.test.ts +591 -0
- package/my-final-test/core/config/__tests__/config-merger.test.ts +657 -0
- package/my-final-test/core/config/__tests__/env-converter.test.ts +372 -0
- package/my-final-test/core/config/__tests__/env-processor.test.ts +431 -0
- package/my-final-test/core/config/__tests__/env.test.ts +452 -0
- package/my-final-test/core/config/__tests__/integration.test.ts +418 -0
- package/my-final-test/core/config/__tests__/loader.test.ts +331 -0
- package/my-final-test/core/config/__tests__/schema.test.ts +129 -0
- package/my-final-test/core/config/__tests__/validator.test.ts +318 -0
- package/my-final-test/core/config/env-dynamic.ts +326 -0
- package/my-final-test/core/config/env.ts +597 -0
- package/my-final-test/core/config/index.ts +317 -0
- package/my-final-test/core/config/loader.ts +546 -0
- package/my-final-test/core/config/runtime-config.ts +322 -0
- package/my-final-test/core/config/schema.ts +694 -0
- package/my-final-test/core/config/validator.ts +540 -0
- package/my-final-test/core/framework/__tests__/server.test.ts +233 -0
- package/my-final-test/core/framework/client.ts +132 -0
- package/my-final-test/core/framework/index.ts +8 -0
- package/my-final-test/core/framework/server.ts +501 -0
- package/my-final-test/core/framework/types.ts +63 -0
- package/my-final-test/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
- package/my-final-test/core/plugins/__tests__/manager.test.ts +398 -0
- package/my-final-test/core/plugins/__tests__/monitoring.test.ts +401 -0
- package/my-final-test/core/plugins/__tests__/registry.test.ts +335 -0
- package/my-final-test/core/plugins/built-in/index.ts +142 -0
- package/my-final-test/core/plugins/built-in/logger/index.ts +180 -0
- package/my-final-test/core/plugins/built-in/monitoring/README.md +193 -0
- package/my-final-test/core/plugins/built-in/monitoring/index.ts +912 -0
- package/my-final-test/core/plugins/built-in/static/index.ts +289 -0
- package/my-final-test/core/plugins/built-in/swagger/index.ts +229 -0
- package/my-final-test/core/plugins/built-in/vite/index.ts +316 -0
- package/my-final-test/core/plugins/config.ts +348 -0
- package/my-final-test/core/plugins/discovery.ts +350 -0
- package/my-final-test/core/plugins/executor.ts +351 -0
- package/my-final-test/core/plugins/index.ts +195 -0
- package/my-final-test/core/plugins/manager.ts +583 -0
- package/my-final-test/core/plugins/registry.ts +424 -0
- package/my-final-test/core/plugins/types.ts +254 -0
- package/my-final-test/core/server/framework.ts +123 -0
- package/my-final-test/core/server/index.ts +8 -0
- package/my-final-test/core/server/plugins/database.ts +182 -0
- package/my-final-test/core/server/plugins/logger.ts +47 -0
- package/my-final-test/core/server/plugins/swagger.ts +34 -0
- package/my-final-test/core/server/standalone.ts +91 -0
- package/my-final-test/core/templates/create-project.ts +455 -0
- package/my-final-test/core/types/api.ts +169 -0
- package/my-final-test/core/types/build.ts +174 -0
- package/my-final-test/core/types/config.ts +68 -0
- package/my-final-test/core/types/index.ts +127 -0
- package/my-final-test/core/types/plugin.ts +94 -0
- package/my-final-test/core/utils/__tests__/errors.test.ts +139 -0
- package/my-final-test/core/utils/__tests__/helpers.test.ts +297 -0
- package/my-final-test/core/utils/__tests__/logger.test.ts +141 -0
- package/my-final-test/core/utils/env-runtime-v2.ts +232 -0
- package/my-final-test/core/utils/env-runtime.ts +252 -0
- package/my-final-test/core/utils/errors/codes.ts +115 -0
- package/my-final-test/core/utils/errors/handlers.ts +63 -0
- package/my-final-test/core/utils/errors/index.ts +81 -0
- package/my-final-test/core/utils/helpers.ts +180 -0
- package/my-final-test/core/utils/index.ts +18 -0
- package/my-final-test/core/utils/logger/index.ts +161 -0
- package/my-final-test/core/utils/logger.ts +106 -0
- package/my-final-test/core/utils/monitoring/index.ts +212 -0
- package/my-final-test/package.json +68 -0
- package/my-final-test/tsconfig.json +51 -0
- package/my-final-test/vite.config.ts +42 -0
- package/nginx-lb.conf +37 -0
- package/package-template.json +32 -15
- package/package.json +71 -30
- package/publish-setup.md +111 -0
- package/publish.sh +63 -0
- package/run-clean.ts +26 -0
- package/run-env-tests.ts +313 -0
- package/tailwind.config.js +34 -0
- package/teste-corrigido/README.md +44 -0
- package/teste-corrigido/app/client/README.md +69 -0
- package/teste-corrigido/app/client/frontend-only.ts +12 -0
- package/teste-corrigido/app/client/index.html +13 -0
- package/teste-corrigido/app/client/public/vite.svg +1 -0
- package/teste-corrigido/app/client/src/App.css +883 -0
- package/teste-corrigido/app/client/src/App.tsx +669 -0
- package/teste-corrigido/app/client/src/assets/react.svg +1 -0
- package/teste-corrigido/app/client/src/components/TestPage.tsx +453 -0
- package/teste-corrigido/app/client/src/index.css +51 -0
- package/teste-corrigido/app/client/src/lib/eden-api.ts +110 -0
- package/teste-corrigido/app/client/src/main.tsx +10 -0
- package/teste-corrigido/app/client/src/vite-env.d.ts +1 -0
- package/teste-corrigido/app/client/tsconfig.app.json +43 -0
- package/teste-corrigido/app/client/tsconfig.json +7 -0
- package/teste-corrigido/app/client/tsconfig.node.json +25 -0
- package/teste-corrigido/app/server/app.ts +10 -0
- package/teste-corrigido/app/server/backend-only.ts +15 -0
- package/teste-corrigido/app/server/controllers/users.controller.ts +69 -0
- package/teste-corrigido/app/server/index.ts +104 -0
- package/teste-corrigido/app/server/routes/index.ts +25 -0
- package/teste-corrigido/app/server/routes/users.routes.ts +121 -0
- package/teste-corrigido/app/server/types/index.ts +1 -0
- package/teste-corrigido/app/shared/types/index.ts +18 -0
- package/teste-corrigido/bun.lock +1053 -0
- package/teste-corrigido/core/__tests__/integration.test.ts +227 -0
- package/teste-corrigido/core/build/index.ts +186 -0
- package/teste-corrigido/core/cli/command-registry.ts +334 -0
- package/teste-corrigido/core/cli/index.ts +394 -0
- package/teste-corrigido/core/cli/plugin-discovery.ts +200 -0
- package/teste-corrigido/core/client/standalone.ts +57 -0
- package/teste-corrigido/core/config/__tests__/config-loader.test.ts +591 -0
- package/teste-corrigido/core/config/__tests__/config-merger.test.ts +657 -0
- package/teste-corrigido/core/config/__tests__/env-converter.test.ts +372 -0
- package/teste-corrigido/core/config/__tests__/env-processor.test.ts +431 -0
- package/teste-corrigido/core/config/__tests__/env.test.ts +452 -0
- package/teste-corrigido/core/config/__tests__/integration.test.ts +418 -0
- package/teste-corrigido/core/config/__tests__/loader.test.ts +331 -0
- package/teste-corrigido/core/config/__tests__/schema.test.ts +129 -0
- package/teste-corrigido/core/config/__tests__/validator.test.ts +318 -0
- package/teste-corrigido/core/config/env-dynamic.ts +326 -0
- package/teste-corrigido/core/config/env.ts +597 -0
- package/teste-corrigido/core/config/index.ts +317 -0
- package/teste-corrigido/core/config/loader.ts +546 -0
- package/teste-corrigido/core/config/runtime-config.ts +322 -0
- package/teste-corrigido/core/config/schema.ts +694 -0
- package/teste-corrigido/core/config/validator.ts +540 -0
- package/teste-corrigido/core/framework/__tests__/server.test.ts +233 -0
- package/teste-corrigido/core/framework/client.ts +132 -0
- package/teste-corrigido/core/framework/index.ts +8 -0
- package/teste-corrigido/core/framework/server.ts +501 -0
- package/teste-corrigido/core/framework/types.ts +63 -0
- package/teste-corrigido/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
- package/teste-corrigido/core/plugins/__tests__/manager.test.ts +398 -0
- package/teste-corrigido/core/plugins/__tests__/monitoring.test.ts +401 -0
- package/teste-corrigido/core/plugins/__tests__/registry.test.ts +335 -0
- package/teste-corrigido/core/plugins/built-in/index.ts +142 -0
- package/teste-corrigido/core/plugins/built-in/logger/index.ts +180 -0
- package/teste-corrigido/core/plugins/built-in/monitoring/README.md +193 -0
- package/teste-corrigido/core/plugins/built-in/monitoring/index.ts +912 -0
- package/teste-corrigido/core/plugins/built-in/static/index.ts +289 -0
- package/teste-corrigido/core/plugins/built-in/swagger/index.ts +229 -0
- package/teste-corrigido/core/plugins/built-in/vite/index.ts +316 -0
- package/teste-corrigido/core/plugins/config.ts +348 -0
- package/teste-corrigido/core/plugins/discovery.ts +350 -0
- package/teste-corrigido/core/plugins/executor.ts +351 -0
- package/teste-corrigido/core/plugins/index.ts +195 -0
- package/teste-corrigido/core/plugins/manager.ts +583 -0
- package/teste-corrigido/core/plugins/registry.ts +424 -0
- package/teste-corrigido/core/plugins/types.ts +254 -0
- package/teste-corrigido/core/server/framework.ts +123 -0
- package/teste-corrigido/core/server/index.ts +8 -0
- package/teste-corrigido/core/server/plugins/database.ts +182 -0
- package/teste-corrigido/core/server/plugins/logger.ts +47 -0
- package/teste-corrigido/core/server/plugins/swagger.ts +34 -0
- package/teste-corrigido/core/server/standalone.ts +91 -0
- package/teste-corrigido/core/templates/create-project.ts +455 -0
- package/teste-corrigido/core/types/api.ts +169 -0
- package/teste-corrigido/core/types/build.ts +174 -0
- package/teste-corrigido/core/types/config.ts +68 -0
- package/teste-corrigido/core/types/index.ts +127 -0
- package/teste-corrigido/core/types/plugin.ts +94 -0
- package/teste-corrigido/core/utils/__tests__/errors.test.ts +139 -0
- package/teste-corrigido/core/utils/__tests__/helpers.test.ts +297 -0
- package/teste-corrigido/core/utils/__tests__/logger.test.ts +141 -0
- package/teste-corrigido/core/utils/env-runtime-v2.ts +232 -0
- package/teste-corrigido/core/utils/env-runtime.ts +252 -0
- package/teste-corrigido/core/utils/errors/codes.ts +115 -0
- package/teste-corrigido/core/utils/errors/handlers.ts +63 -0
- package/teste-corrigido/core/utils/errors/index.ts +81 -0
- package/teste-corrigido/core/utils/helpers.ts +180 -0
- package/teste-corrigido/core/utils/index.ts +18 -0
- package/teste-corrigido/core/utils/logger/index.ts +161 -0
- package/teste-corrigido/core/utils/logger.ts +106 -0
- package/teste-corrigido/core/utils/monitoring/index.ts +212 -0
- package/teste-corrigido/package-template.json +51 -0
- package/teste-corrigido/package.json +51 -0
- package/teste-corrigido/tsconfig.json +51 -0
- package/teste-corrigido/vite.config.ts +42 -0
- package/teste-final-npm/README.md +44 -0
- package/teste-final-npm/app/client/README.md +69 -0
- package/teste-final-npm/app/client/frontend-only.ts +12 -0
- package/teste-final-npm/app/client/index.html +13 -0
- package/teste-final-npm/app/client/public/vite.svg +1 -0
- package/teste-final-npm/app/client/src/App.css +883 -0
- package/teste-final-npm/app/client/src/App.tsx +669 -0
- package/teste-final-npm/app/client/src/assets/react.svg +1 -0
- package/teste-final-npm/app/client/src/components/TestPage.tsx +453 -0
- package/teste-final-npm/app/client/src/index.css +51 -0
- package/teste-final-npm/app/client/src/lib/eden-api.ts +110 -0
- package/teste-final-npm/app/client/src/main.tsx +10 -0
- package/teste-final-npm/app/client/src/vite-env.d.ts +1 -0
- package/teste-final-npm/app/client/tsconfig.app.json +43 -0
- package/teste-final-npm/app/client/tsconfig.json +7 -0
- package/teste-final-npm/app/client/tsconfig.node.json +25 -0
- package/teste-final-npm/app/server/app.ts +10 -0
- package/teste-final-npm/app/server/backend-only.ts +15 -0
- package/teste-final-npm/app/server/controllers/users.controller.ts +69 -0
- package/teste-final-npm/app/server/index.ts +104 -0
- package/teste-final-npm/app/server/routes/index.ts +25 -0
- package/teste-final-npm/app/server/routes/users.routes.ts +121 -0
- package/teste-final-npm/app/server/types/index.ts +1 -0
- package/teste-final-npm/app/shared/types/index.ts +18 -0
- package/teste-final-npm/bun.lock +1053 -0
- package/teste-final-npm/core/__tests__/integration.test.ts +227 -0
- package/teste-final-npm/core/build/index.ts +186 -0
- package/teste-final-npm/core/cli/command-registry.ts +334 -0
- package/teste-final-npm/core/cli/index.ts +394 -0
- package/teste-final-npm/core/cli/plugin-discovery.ts +200 -0
- package/teste-final-npm/core/client/standalone.ts +57 -0
- package/teste-final-npm/core/config/__tests__/config-loader.test.ts +591 -0
- package/teste-final-npm/core/config/__tests__/config-merger.test.ts +657 -0
- package/teste-final-npm/core/config/__tests__/env-converter.test.ts +372 -0
- package/teste-final-npm/core/config/__tests__/env-processor.test.ts +431 -0
- package/teste-final-npm/core/config/__tests__/env.test.ts +452 -0
- package/teste-final-npm/core/config/__tests__/integration.test.ts +418 -0
- package/teste-final-npm/core/config/__tests__/loader.test.ts +331 -0
- package/teste-final-npm/core/config/__tests__/schema.test.ts +129 -0
- package/teste-final-npm/core/config/__tests__/validator.test.ts +318 -0
- package/teste-final-npm/core/config/env-dynamic.ts +326 -0
- package/teste-final-npm/core/config/env.ts +597 -0
- package/teste-final-npm/core/config/index.ts +317 -0
- package/teste-final-npm/core/config/loader.ts +546 -0
- package/teste-final-npm/core/config/runtime-config.ts +322 -0
- package/teste-final-npm/core/config/schema.ts +694 -0
- package/teste-final-npm/core/config/validator.ts +540 -0
- package/teste-final-npm/core/framework/__tests__/server.test.ts +233 -0
- package/teste-final-npm/core/framework/client.ts +132 -0
- package/teste-final-npm/core/framework/index.ts +8 -0
- package/teste-final-npm/core/framework/server.ts +501 -0
- package/teste-final-npm/core/framework/types.ts +63 -0
- package/teste-final-npm/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
- package/teste-final-npm/core/plugins/__tests__/manager.test.ts +398 -0
- package/teste-final-npm/core/plugins/__tests__/monitoring.test.ts +401 -0
- package/teste-final-npm/core/plugins/__tests__/registry.test.ts +335 -0
- package/teste-final-npm/core/plugins/built-in/index.ts +142 -0
- package/teste-final-npm/core/plugins/built-in/logger/index.ts +180 -0
- package/teste-final-npm/core/plugins/built-in/monitoring/README.md +193 -0
- package/teste-final-npm/core/plugins/built-in/monitoring/index.ts +912 -0
- package/teste-final-npm/core/plugins/built-in/static/index.ts +289 -0
- package/teste-final-npm/core/plugins/built-in/swagger/index.ts +229 -0
- package/teste-final-npm/core/plugins/built-in/vite/index.ts +316 -0
- package/teste-final-npm/core/plugins/config.ts +348 -0
- package/teste-final-npm/core/plugins/discovery.ts +350 -0
- package/teste-final-npm/core/plugins/executor.ts +351 -0
- package/teste-final-npm/core/plugins/index.ts +195 -0
- package/teste-final-npm/core/plugins/manager.ts +583 -0
- package/teste-final-npm/core/plugins/registry.ts +424 -0
- package/teste-final-npm/core/plugins/types.ts +254 -0
- package/teste-final-npm/core/server/framework.ts +123 -0
- package/teste-final-npm/core/server/index.ts +8 -0
- package/teste-final-npm/core/server/plugins/database.ts +182 -0
- package/teste-final-npm/core/server/plugins/logger.ts +47 -0
- package/teste-final-npm/core/server/plugins/swagger.ts +34 -0
- package/teste-final-npm/core/server/standalone.ts +91 -0
- package/teste-final-npm/core/templates/create-project.ts +455 -0
- package/teste-final-npm/core/types/api.ts +169 -0
- package/teste-final-npm/core/types/build.ts +174 -0
- package/teste-final-npm/core/types/config.ts +68 -0
- package/teste-final-npm/core/types/index.ts +127 -0
- package/teste-final-npm/core/types/plugin.ts +94 -0
- package/teste-final-npm/core/utils/__tests__/errors.test.ts +139 -0
- package/teste-final-npm/core/utils/__tests__/helpers.test.ts +297 -0
- package/teste-final-npm/core/utils/__tests__/logger.test.ts +141 -0
- package/teste-final-npm/core/utils/env-runtime-v2.ts +232 -0
- package/teste-final-npm/core/utils/env-runtime.ts +252 -0
- package/teste-final-npm/core/utils/errors/codes.ts +115 -0
- package/teste-final-npm/core/utils/errors/handlers.ts +63 -0
- package/teste-final-npm/core/utils/errors/index.ts +81 -0
- package/teste-final-npm/core/utils/helpers.ts +180 -0
- package/teste-final-npm/core/utils/index.ts +18 -0
- package/teste-final-npm/core/utils/logger/index.ts +161 -0
- package/teste-final-npm/core/utils/logger.ts +106 -0
- package/teste-final-npm/core/utils/monitoring/index.ts +212 -0
- package/teste-final-npm/package-template.json +51 -0
- package/teste-final-npm/package.json +51 -0
- package/teste-final-npm/tsconfig.json +51 -0
- package/teste-final-npm/vite.config.ts +42 -0
- package/tests/__mocks__/api.ts +56 -0
- package/tests/fixtures/users.ts +69 -0
- package/tests/integration/api/users.routes.test.ts +221 -0
- package/tests/setup.ts +29 -0
- package/tests/unit/app/client/App-simple.test.tsx +56 -0
- package/tests/unit/app/client/App.test.tsx.skip +237 -0
- package/tests/unit/app/client/eden-api.test.ts +186 -0
- package/tests/unit/app/client/simple.test.tsx +23 -0
- package/tests/unit/app/controllers/users.controller.test.ts +150 -0
- package/tests/unit/core/create-project.test.ts.skip +95 -0
- package/tests/unit/core/framework.test.ts +144 -0
- package/tests/unit/core/plugins/logger.test.ts.skip +268 -0
- package/tests/unit/core/plugins/vite.test.ts.disabled +188 -0
- package/tests/utils/test-helpers.ts +61 -0
- package/types/global.d.ts +30 -0
- package/types/vitest.d.ts +9 -0
- package/vitest.config.ts +50 -0
- package/workspace.json +6 -0
- package/.env +0 -30
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { spawn } from "bun"
|
|
2
|
+
import { join, resolve } from "path"
|
|
3
|
+
import { mkdir } from "fs/promises"
|
|
4
|
+
|
|
5
|
+
export interface CreateProjectOptions {
|
|
6
|
+
name: string
|
|
7
|
+
targetDir?: string
|
|
8
|
+
template?: 'basic' | 'full'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class ProjectCreator {
|
|
12
|
+
private projectName: string
|
|
13
|
+
private targetDir: string
|
|
14
|
+
|
|
15
|
+
constructor(options: CreateProjectOptions) {
|
|
16
|
+
this.projectName = options.name
|
|
17
|
+
this.targetDir = options.targetDir || resolve(process.cwd(), options.name)
|
|
18
|
+
// Template option available but basic template is used for now
|
|
19
|
+
// const template = options.template || 'basic'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async create() {
|
|
23
|
+
console.log(`🎉 Creating FluxStack project: ${this.projectName}`)
|
|
24
|
+
console.log(`📁 Target directory: ${this.targetDir}`)
|
|
25
|
+
console.log()
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
// 1. Create project directory
|
|
29
|
+
await this.createDirectory()
|
|
30
|
+
|
|
31
|
+
// 2. Copy template files
|
|
32
|
+
await this.copyTemplate()
|
|
33
|
+
|
|
34
|
+
// 3. Generate package.json
|
|
35
|
+
await this.generatePackageJson()
|
|
36
|
+
|
|
37
|
+
// 4. Generate config files
|
|
38
|
+
await this.generateConfigFiles()
|
|
39
|
+
|
|
40
|
+
// 5. Install dependencies
|
|
41
|
+
await this.installDependencies()
|
|
42
|
+
|
|
43
|
+
// 6. Initialize git
|
|
44
|
+
await this.initGit()
|
|
45
|
+
|
|
46
|
+
console.log()
|
|
47
|
+
console.log("🎉 Project created successfully!")
|
|
48
|
+
console.log()
|
|
49
|
+
console.log("Next steps:")
|
|
50
|
+
console.log(` cd ${this.projectName}`)
|
|
51
|
+
console.log(` bun run dev`)
|
|
52
|
+
console.log()
|
|
53
|
+
console.log("Happy coding! 🚀")
|
|
54
|
+
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error("❌ Error creating project:", error instanceof Error ? error.message : String(error))
|
|
57
|
+
process.exit(1)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private async createDirectory() {
|
|
62
|
+
console.log("📁 Creating project directory...")
|
|
63
|
+
await mkdir(this.targetDir, { recursive: true })
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private async copyTemplate() {
|
|
67
|
+
console.log("📋 Copying template files...")
|
|
68
|
+
|
|
69
|
+
// Copy files using Bun's built-in functions for better performance
|
|
70
|
+
const rootDir = join(__dirname, '..', '..')
|
|
71
|
+
|
|
72
|
+
// Copy app structure (exclude node_modules and dist)
|
|
73
|
+
await this.copyDirectory(
|
|
74
|
+
join(rootDir, 'app'),
|
|
75
|
+
join(this.targetDir, 'app'),
|
|
76
|
+
['node_modules', 'dist', '.vite']
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
// Copy core framework (exclude node_modules)
|
|
80
|
+
await this.copyDirectory(
|
|
81
|
+
join(rootDir, 'core'),
|
|
82
|
+
join(this.targetDir, 'core'),
|
|
83
|
+
['node_modules']
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
// Copy config
|
|
87
|
+
await this.copyDirectory(
|
|
88
|
+
join(rootDir, 'config'),
|
|
89
|
+
join(this.targetDir, 'config')
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private async copyDirectory(src: string, dest: string, exclude: string[] = []) {
|
|
94
|
+
await mkdir(dest, { recursive: true })
|
|
95
|
+
|
|
96
|
+
const entries = await Bun.file(src).exists() ?
|
|
97
|
+
await (await import("fs/promises")).readdir(src, { withFileTypes: true }) : []
|
|
98
|
+
|
|
99
|
+
for (const entry of entries) {
|
|
100
|
+
if (exclude.includes(entry.name)) continue
|
|
101
|
+
|
|
102
|
+
const srcPath = join(src, entry.name)
|
|
103
|
+
const destPath = join(dest, entry.name)
|
|
104
|
+
|
|
105
|
+
if (entry.isDirectory()) {
|
|
106
|
+
await this.copyDirectory(srcPath, destPath, exclude)
|
|
107
|
+
} else {
|
|
108
|
+
const content = await Bun.file(srcPath).text()
|
|
109
|
+
await Bun.write(destPath, content)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private async generatePackageJson() {
|
|
115
|
+
console.log("📦 Generating package.json...")
|
|
116
|
+
|
|
117
|
+
const packageJson = {
|
|
118
|
+
name: this.projectName,
|
|
119
|
+
version: "1.0.0",
|
|
120
|
+
description: `FluxStack project: ${this.projectName}`,
|
|
121
|
+
keywords: ["fluxstack", "full-stack", "typescript", "elysia", "react", "bun"],
|
|
122
|
+
author: "FluxStack Developer",
|
|
123
|
+
license: "MIT",
|
|
124
|
+
module: "app/server/index.ts",
|
|
125
|
+
type: "module",
|
|
126
|
+
bin: {
|
|
127
|
+
flux: "./core/cli/index.ts"
|
|
128
|
+
},
|
|
129
|
+
scripts: {
|
|
130
|
+
dev: "bun run core/cli/index.ts dev",
|
|
131
|
+
"dev:frontend": "bun run core/cli/index.ts frontend",
|
|
132
|
+
"dev:backend": "bun run core/cli/index.ts backend",
|
|
133
|
+
build: "bun run core/cli/index.ts build",
|
|
134
|
+
"build:frontend": "bun run core/cli/index.ts build:frontend",
|
|
135
|
+
"build:backend": "bun run core/cli/index.ts build:backend",
|
|
136
|
+
start: "bun run core/cli/index.ts start",
|
|
137
|
+
test: "vitest",
|
|
138
|
+
"test:ui": "vitest --ui",
|
|
139
|
+
"test:run": "vitest run",
|
|
140
|
+
"test:coverage": "vitest run --coverage",
|
|
141
|
+
"test:watch": "vitest --watch"
|
|
142
|
+
},
|
|
143
|
+
devDependencies: {
|
|
144
|
+
"@types/bun": "latest",
|
|
145
|
+
"@types/react": "^18.2.0",
|
|
146
|
+
"@types/react-dom": "^18.2.0",
|
|
147
|
+
"@testing-library/react": "^14.0.0",
|
|
148
|
+
"@testing-library/jest-dom": "^6.1.0",
|
|
149
|
+
"@testing-library/user-event": "^14.5.0",
|
|
150
|
+
"@vitest/ui": "^1.0.0",
|
|
151
|
+
"@vitest/coverage-v8": "^1.0.0",
|
|
152
|
+
"jsdom": "^23.0.0",
|
|
153
|
+
typescript: "^5.0.0",
|
|
154
|
+
vitest: "^1.0.0"
|
|
155
|
+
},
|
|
156
|
+
dependencies: {
|
|
157
|
+
"@elysiajs/eden": "^1.3.2",
|
|
158
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
159
|
+
elysia: "latest",
|
|
160
|
+
react: "^18.2.0",
|
|
161
|
+
"react-dom": "^18.2.0",
|
|
162
|
+
vite: "^5.0.0"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
await Bun.write(
|
|
167
|
+
join(this.targetDir, "package.json"),
|
|
168
|
+
JSON.stringify(packageJson, null, 2)
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private async generateConfigFiles() {
|
|
173
|
+
console.log("⚙️ Generating config files...")
|
|
174
|
+
|
|
175
|
+
// TypeScript config
|
|
176
|
+
const tsConfig = {
|
|
177
|
+
compilerOptions: {
|
|
178
|
+
lib: ["ESNext", "DOM"],
|
|
179
|
+
target: "ESNext",
|
|
180
|
+
module: "ESNext",
|
|
181
|
+
moduleDetection: "force",
|
|
182
|
+
jsx: "react-jsx",
|
|
183
|
+
allowJs: true,
|
|
184
|
+
moduleResolution: "bundler",
|
|
185
|
+
allowImportingTsExtensions: true,
|
|
186
|
+
verbatimModuleSyntax: true,
|
|
187
|
+
noEmit: true,
|
|
188
|
+
baseUrl: ".",
|
|
189
|
+
paths: {
|
|
190
|
+
"@/*": ["./*"],
|
|
191
|
+
"@/core/*": ["./core/*"],
|
|
192
|
+
"@/app/*": ["./app/*"],
|
|
193
|
+
"@/config/*": ["./config/*"],
|
|
194
|
+
"@/shared/*": ["./app/shared/*"]
|
|
195
|
+
},
|
|
196
|
+
strict: true,
|
|
197
|
+
skipLibCheck: true,
|
|
198
|
+
noFallthroughCasesInSwitch: true,
|
|
199
|
+
noUnusedLocals: false,
|
|
200
|
+
noUnusedParameters: false,
|
|
201
|
+
noPropertyAccessFromIndexSignature: false
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
await Bun.write(
|
|
206
|
+
join(this.targetDir, "tsconfig.json"),
|
|
207
|
+
JSON.stringify(tsConfig, null, 2)
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
// Bun config
|
|
211
|
+
const bunConfig = `# FluxStack Bun Configuration
|
|
212
|
+
[build]
|
|
213
|
+
target = "bun"
|
|
214
|
+
|
|
215
|
+
[install]
|
|
216
|
+
cache = true
|
|
217
|
+
lockfile = true
|
|
218
|
+
|
|
219
|
+
# Path mapping (alias support)
|
|
220
|
+
[build.alias]
|
|
221
|
+
"@" = "."
|
|
222
|
+
"@/core" = "./core"
|
|
223
|
+
"@/app" = "./app"
|
|
224
|
+
"@/config" = "./config"
|
|
225
|
+
"@/shared" = "./app/shared"
|
|
226
|
+
`
|
|
227
|
+
|
|
228
|
+
await Bun.write(join(this.targetDir, "bunfig.toml"), bunConfig)
|
|
229
|
+
|
|
230
|
+
// Environment file
|
|
231
|
+
const envContent = `# FluxStack Environment Variables
|
|
232
|
+
|
|
233
|
+
# Development Mode
|
|
234
|
+
NODE_ENV=development
|
|
235
|
+
|
|
236
|
+
# Server Configuration
|
|
237
|
+
PORT=3000
|
|
238
|
+
HOST=localhost
|
|
239
|
+
|
|
240
|
+
# Frontend Configuration
|
|
241
|
+
FRONTEND_PORT=5173
|
|
242
|
+
VITE_API_URL=http://localhost:3000
|
|
243
|
+
|
|
244
|
+
# Backend Configuration
|
|
245
|
+
BACKEND_PORT=3001
|
|
246
|
+
API_URL=http://localhost:3001
|
|
247
|
+
|
|
248
|
+
# CORS Configuration
|
|
249
|
+
CORS_ORIGINS=http://localhost:3000,http://localhost:5173
|
|
250
|
+
CORS_METHODS=GET,POST,PUT,DELETE,OPTIONS
|
|
251
|
+
CORS_HEADERS=Content-Type,Authorization
|
|
252
|
+
|
|
253
|
+
# Logging
|
|
254
|
+
LOG_LEVEL=info
|
|
255
|
+
|
|
256
|
+
# Build Configuration
|
|
257
|
+
BUILD_TARGET=bun
|
|
258
|
+
BUILD_OUTDIR=dist
|
|
259
|
+
|
|
260
|
+
# Database (optional - uncomment to use)
|
|
261
|
+
# DATABASE_URL=postgresql://user:password@localhost:5432/${this.projectName}
|
|
262
|
+
# DATABASE_HOST=localhost
|
|
263
|
+
# DATABASE_PORT=5432
|
|
264
|
+
# DATABASE_NAME=${this.projectName}
|
|
265
|
+
# DATABASE_USER=user
|
|
266
|
+
# DATABASE_PASSWORD=password
|
|
267
|
+
|
|
268
|
+
# Authentication (optional - uncomment to use)
|
|
269
|
+
# JWT_SECRET=your-super-secret-jwt-key-here
|
|
270
|
+
# JWT_EXPIRES_IN=24h
|
|
271
|
+
|
|
272
|
+
# External APIs (optional - uncomment to use)
|
|
273
|
+
# STRIPE_SECRET_KEY=sk_test_...
|
|
274
|
+
# STRIPE_PUBLISHABLE_KEY=pk_test_...
|
|
275
|
+
|
|
276
|
+
# Email Service (optional - uncomment to use)
|
|
277
|
+
# SMTP_HOST=smtp.gmail.com
|
|
278
|
+
# SMTP_PORT=587
|
|
279
|
+
# SMTP_USER=your-email@gmail.com
|
|
280
|
+
# SMTP_PASS=your-app-password
|
|
281
|
+
|
|
282
|
+
# File Upload (optional - uncomment to use)
|
|
283
|
+
# UPLOAD_PATH=uploads
|
|
284
|
+
# MAX_FILE_SIZE=10485760
|
|
285
|
+
`
|
|
286
|
+
|
|
287
|
+
await Bun.write(join(this.targetDir, ".env"), envContent)
|
|
288
|
+
|
|
289
|
+
// README
|
|
290
|
+
const readme = `# ${this.projectName}
|
|
291
|
+
|
|
292
|
+
Modern full-stack TypeScript application built with FluxStack framework.
|
|
293
|
+
|
|
294
|
+
## Tech Stack
|
|
295
|
+
|
|
296
|
+
- **Backend**: Elysia.js (high-performance web framework)
|
|
297
|
+
- **Frontend**: React + Vite (modern development experience)
|
|
298
|
+
- **Runtime**: Bun (ultra-fast JavaScript runtime)
|
|
299
|
+
- **Type Safety**: Eden Treaty (end-to-end type safety)
|
|
300
|
+
|
|
301
|
+
## Getting Started
|
|
302
|
+
|
|
303
|
+
### Install Dependencies
|
|
304
|
+
\`\`\`bash
|
|
305
|
+
bun install
|
|
306
|
+
\`\`\`
|
|
307
|
+
|
|
308
|
+
### Development
|
|
309
|
+
|
|
310
|
+
#### Full-Stack (Recommended)
|
|
311
|
+
\`\`\`bash
|
|
312
|
+
bun run dev
|
|
313
|
+
# Frontend + Backend integrated at http://localhost:3000
|
|
314
|
+
\`\`\`
|
|
315
|
+
|
|
316
|
+
#### Separate Development
|
|
317
|
+
\`\`\`bash
|
|
318
|
+
# Terminal 1: Backend API
|
|
319
|
+
bun run dev:backend
|
|
320
|
+
# API at http://localhost:3001
|
|
321
|
+
|
|
322
|
+
# Terminal 2: Frontend
|
|
323
|
+
bun run dev:frontend
|
|
324
|
+
# Frontend at http://localhost:5173
|
|
325
|
+
\`\`\`
|
|
326
|
+
|
|
327
|
+
### Production
|
|
328
|
+
|
|
329
|
+
\`\`\`bash
|
|
330
|
+
# Build everything
|
|
331
|
+
bun run build
|
|
332
|
+
|
|
333
|
+
# Start production server
|
|
334
|
+
bun run start
|
|
335
|
+
\`\`\`
|
|
336
|
+
|
|
337
|
+
## Project Structure
|
|
338
|
+
|
|
339
|
+
\`\`\`
|
|
340
|
+
${this.projectName}/
|
|
341
|
+
├── app/ # Your application code
|
|
342
|
+
│ ├── server/ # Backend (controllers, routes)
|
|
343
|
+
│ ├── client/ # Frontend (React components)
|
|
344
|
+
│ └── shared/ # Shared types
|
|
345
|
+
├── core/ # FluxStack framework (don't edit)
|
|
346
|
+
├── config/ # Configuration files
|
|
347
|
+
└── dist/ # Production build
|
|
348
|
+
\`\`\`
|
|
349
|
+
|
|
350
|
+
## Available Commands
|
|
351
|
+
|
|
352
|
+
- \`bun run dev\` - Full-stack development
|
|
353
|
+
- \`bun run dev:frontend\` - Frontend only
|
|
354
|
+
- \`bun run dev:backend\` - Backend only
|
|
355
|
+
- \`bun run build\` - Build for production
|
|
356
|
+
- \`bun run start\` - Start production server
|
|
357
|
+
|
|
358
|
+
## Health Check
|
|
359
|
+
|
|
360
|
+
\`\`\`bash
|
|
361
|
+
curl http://localhost:3000/api/health
|
|
362
|
+
\`\`\`
|
|
363
|
+
|
|
364
|
+
Built with ❤️ using FluxStack framework.
|
|
365
|
+
`
|
|
366
|
+
|
|
367
|
+
await Bun.write(join(this.targetDir, "README.md"), readme)
|
|
368
|
+
|
|
369
|
+
// .gitignore
|
|
370
|
+
const gitignore = `# Dependencies
|
|
371
|
+
node_modules/
|
|
372
|
+
*.lockb
|
|
373
|
+
|
|
374
|
+
# Build outputs
|
|
375
|
+
dist/
|
|
376
|
+
build/
|
|
377
|
+
.next/
|
|
378
|
+
|
|
379
|
+
# Environment variables
|
|
380
|
+
.env.local
|
|
381
|
+
.env.production
|
|
382
|
+
|
|
383
|
+
# IDE
|
|
384
|
+
.vscode/
|
|
385
|
+
.idea/
|
|
386
|
+
*.swp
|
|
387
|
+
*.swo
|
|
388
|
+
|
|
389
|
+
# OS
|
|
390
|
+
.DS_Store
|
|
391
|
+
Thumbs.db
|
|
392
|
+
|
|
393
|
+
# Logs
|
|
394
|
+
*.log
|
|
395
|
+
logs/
|
|
396
|
+
|
|
397
|
+
# Runtime
|
|
398
|
+
.tmp/
|
|
399
|
+
.cache/
|
|
400
|
+
|
|
401
|
+
# Bun
|
|
402
|
+
bun.lockb
|
|
403
|
+
`
|
|
404
|
+
|
|
405
|
+
await Bun.write(join(this.targetDir, ".gitignore"), gitignore)
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
private async installDependencies() {
|
|
409
|
+
console.log("📦 Installing dependencies...")
|
|
410
|
+
|
|
411
|
+
const installProcess = spawn({
|
|
412
|
+
cmd: ["bun", "install"],
|
|
413
|
+
cwd: this.targetDir,
|
|
414
|
+
stdout: "pipe",
|
|
415
|
+
stderr: "pipe"
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
const exitCode = await installProcess.exited
|
|
419
|
+
|
|
420
|
+
if (exitCode !== 0) {
|
|
421
|
+
throw new Error("Failed to install dependencies")
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
private async initGit() {
|
|
426
|
+
console.log("🔧 Initializing git repository...")
|
|
427
|
+
|
|
428
|
+
const gitInitProcess = spawn({
|
|
429
|
+
cmd: ["git", "init"],
|
|
430
|
+
cwd: this.targetDir,
|
|
431
|
+
stdout: "pipe",
|
|
432
|
+
stderr: "pipe"
|
|
433
|
+
})
|
|
434
|
+
|
|
435
|
+
await gitInitProcess.exited
|
|
436
|
+
|
|
437
|
+
const gitAddProcess = spawn({
|
|
438
|
+
cmd: ["git", "add", "."],
|
|
439
|
+
cwd: this.targetDir,
|
|
440
|
+
stdout: "pipe",
|
|
441
|
+
stderr: "pipe"
|
|
442
|
+
})
|
|
443
|
+
|
|
444
|
+
await gitAddProcess.exited
|
|
445
|
+
|
|
446
|
+
const gitCommitProcess = spawn({
|
|
447
|
+
cmd: ["git", "commit", "-m", "Initial commit - FluxStack project created"],
|
|
448
|
+
cwd: this.targetDir,
|
|
449
|
+
stdout: "pipe",
|
|
450
|
+
stderr: "pipe"
|
|
451
|
+
})
|
|
452
|
+
|
|
453
|
+
await gitCommitProcess.exited
|
|
454
|
+
}
|
|
455
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API and HTTP-related types
|
|
3
|
+
* Type definitions for API endpoints, requests, responses, and HTTP utilities
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD'
|
|
7
|
+
|
|
8
|
+
export interface ApiEndpoint {
|
|
9
|
+
method: HttpMethod
|
|
10
|
+
path: string
|
|
11
|
+
handler: Function
|
|
12
|
+
schema?: ApiSchema
|
|
13
|
+
middleware?: Function[]
|
|
14
|
+
description?: string
|
|
15
|
+
tags?: string[]
|
|
16
|
+
deprecated?: boolean
|
|
17
|
+
version?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ApiSchema {
|
|
21
|
+
params?: any
|
|
22
|
+
query?: any
|
|
23
|
+
body?: any
|
|
24
|
+
response?: any
|
|
25
|
+
headers?: any
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ApiResponse<T = any> {
|
|
29
|
+
data?: T
|
|
30
|
+
error?: ApiError
|
|
31
|
+
meta?: ApiMeta
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ApiError {
|
|
35
|
+
code: string
|
|
36
|
+
message: string
|
|
37
|
+
details?: any
|
|
38
|
+
statusCode: number
|
|
39
|
+
timestamp: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ApiMeta {
|
|
43
|
+
pagination?: PaginationMeta
|
|
44
|
+
timing?: TimingMeta
|
|
45
|
+
version?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface PaginationMeta {
|
|
49
|
+
page: number
|
|
50
|
+
limit: number
|
|
51
|
+
total: number
|
|
52
|
+
totalPages: number
|
|
53
|
+
hasNext: boolean
|
|
54
|
+
hasPrev: boolean
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface TimingMeta {
|
|
58
|
+
requestId: string
|
|
59
|
+
duration: number
|
|
60
|
+
timestamp: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface RequestContext {
|
|
64
|
+
id: string
|
|
65
|
+
method: HttpMethod
|
|
66
|
+
path: string
|
|
67
|
+
url: string
|
|
68
|
+
headers: Record<string, string>
|
|
69
|
+
query: Record<string, any>
|
|
70
|
+
params: Record<string, any>
|
|
71
|
+
body?: any
|
|
72
|
+
user?: any
|
|
73
|
+
startTime: number
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ResponseContext extends RequestContext {
|
|
77
|
+
statusCode: number
|
|
78
|
+
headers: Record<string, string>
|
|
79
|
+
body?: any
|
|
80
|
+
duration: number
|
|
81
|
+
size: number
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface MiddlewareContext {
|
|
85
|
+
request: RequestContext
|
|
86
|
+
response?: ResponseContext
|
|
87
|
+
next: () => Promise<void>
|
|
88
|
+
state: Record<string, any>
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface RouteHandler {
|
|
92
|
+
(context: RequestContext): Promise<any> | any
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface MiddlewareHandler {
|
|
96
|
+
(context: MiddlewareContext): Promise<void> | void
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ApiDocumentation {
|
|
100
|
+
title: string
|
|
101
|
+
version: string
|
|
102
|
+
description?: string
|
|
103
|
+
servers: ApiServer[]
|
|
104
|
+
paths: Record<string, ApiPath>
|
|
105
|
+
components?: ApiComponents
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface ApiServer {
|
|
109
|
+
url: string
|
|
110
|
+
description?: string
|
|
111
|
+
variables?: Record<string, ApiServerVariable>
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface ApiServerVariable {
|
|
115
|
+
default: string
|
|
116
|
+
description?: string
|
|
117
|
+
enum?: string[]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface ApiPath {
|
|
121
|
+
[method: string]: ApiOperation
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ApiOperation {
|
|
125
|
+
summary?: string
|
|
126
|
+
description?: string
|
|
127
|
+
operationId?: string
|
|
128
|
+
tags?: string[]
|
|
129
|
+
parameters?: ApiParameter[]
|
|
130
|
+
requestBody?: ApiRequestBody
|
|
131
|
+
responses: Record<string, ApiResponse>
|
|
132
|
+
deprecated?: boolean
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ApiParameter {
|
|
136
|
+
name: string
|
|
137
|
+
in: 'query' | 'header' | 'path' | 'cookie'
|
|
138
|
+
description?: string
|
|
139
|
+
required?: boolean
|
|
140
|
+
schema: any
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface ApiRequestBody {
|
|
144
|
+
description?: string
|
|
145
|
+
content: Record<string, ApiMediaType>
|
|
146
|
+
required?: boolean
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ApiMediaType {
|
|
150
|
+
schema: any
|
|
151
|
+
example?: any
|
|
152
|
+
examples?: Record<string, ApiExample>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ApiExample {
|
|
156
|
+
summary?: string
|
|
157
|
+
description?: string
|
|
158
|
+
value: any
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface ApiComponents {
|
|
162
|
+
schemas?: Record<string, any>
|
|
163
|
+
responses?: Record<string, ApiResponse>
|
|
164
|
+
parameters?: Record<string, ApiParameter>
|
|
165
|
+
examples?: Record<string, ApiExample>
|
|
166
|
+
requestBodies?: Record<string, ApiRequestBody>
|
|
167
|
+
headers?: Record<string, any>
|
|
168
|
+
securitySchemes?: Record<string, any>
|
|
169
|
+
}
|