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,399 @@
|
|
|
1
|
+
# 🏗️ FluxStack - Arquitetura Detalhada
|
|
2
|
+
|
|
3
|
+
> **Arquitetura completa**: Como o framework funciona internamente
|
|
4
|
+
|
|
5
|
+
## 📊 **Visão Geral da Arquitetura**
|
|
6
|
+
|
|
7
|
+
FluxStack implementa uma arquitetura **monorepo modular** com separação clara entre framework core e código da aplicação, garantindo escalabilidade e manutenibilidade.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
11
|
+
│ FluxStack │
|
|
12
|
+
├─────────────────────────────────────────────────────────────┤
|
|
13
|
+
│ 🎨 Frontend (React + Vite) │
|
|
14
|
+
│ ├─ Components & Pages │
|
|
15
|
+
│ ├─ Eden Treaty Client ←─────────────────────┐ │
|
|
16
|
+
│ └─ Hooks & Utils │ │
|
|
17
|
+
├─────────────────────────────────────────────┼──────────────┤
|
|
18
|
+
│ 🔌 Communication Layer │ │
|
|
19
|
+
│ └─ Eden Treaty (Type-safe HTTP) ────────────┘ │
|
|
20
|
+
├─────────────────────────────────────────────────────────────┤
|
|
21
|
+
│ 🚀 Backend (Elysia + Bun) │
|
|
22
|
+
│ ├─ Controllers (Business Logic) │
|
|
23
|
+
│ ├─ Routes (API Endpoints) │
|
|
24
|
+
│ ├─ Types (Shared with Frontend) │
|
|
25
|
+
│ └─ App Export (for Eden Treaty) │
|
|
26
|
+
├─────────────────────────────────────────────────────────────┤
|
|
27
|
+
│ ⚙️ Framework Core (Read-Only) │
|
|
28
|
+
│ ├─ Server Framework │
|
|
29
|
+
│ ├─ Plugin System │
|
|
30
|
+
│ ├─ Build System │
|
|
31
|
+
│ └─ Configuration Management │
|
|
32
|
+
└─────────────────────────────────────────────────────────────┘
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 🎯 **Core Principles**
|
|
36
|
+
|
|
37
|
+
### **1. 🔒 Separation of Concerns**
|
|
38
|
+
- **`core/`**: Framework code (read-only, versioned)
|
|
39
|
+
- **`app/`**: Application code (user-editable)
|
|
40
|
+
- **Clear boundaries**: Framework vs Application
|
|
41
|
+
|
|
42
|
+
### **2. ⚡ Type Safety First**
|
|
43
|
+
- **End-to-end types**: Client ↔ Server automaticamente sincronizados
|
|
44
|
+
- **Zero duplicação**: Types definidos uma vez, usados em todo lugar
|
|
45
|
+
- **Compile-time validation**: Erros detectados antes do runtime
|
|
46
|
+
|
|
47
|
+
### **3. 🔄 Hot Development**
|
|
48
|
+
- **Independent reloading**: Backend e Frontend recarregam separadamente
|
|
49
|
+
- **Fast iterations**: Mudanças refletem instantaneamente
|
|
50
|
+
- **Zero downtime**: Desenvolvimento sem interrupções
|
|
51
|
+
|
|
52
|
+
## 🏗️ **Arquitetura Detalhada**
|
|
53
|
+
|
|
54
|
+
### **📁 Estrutura de Diretórios**
|
|
55
|
+
```
|
|
56
|
+
FluxStack/
|
|
57
|
+
├── core/ # 🔒 FRAMEWORK CORE
|
|
58
|
+
│ ├── server/
|
|
59
|
+
│ │ ├── framework.ts # Classe principal FluxStackFramework
|
|
60
|
+
│ │ └── plugins/ # Sistema de plugins built-in
|
|
61
|
+
│ │ ├── logger.ts # Logging avançado
|
|
62
|
+
│ │ ├── swagger.ts # Documentação automática
|
|
63
|
+
│ │ ├── vite.ts # Integração Vite
|
|
64
|
+
│ │ └── static.ts # Arquivos estáticos
|
|
65
|
+
│ ├── config/
|
|
66
|
+
│ │ ├── env-dynamic.ts # Environment variables dinâmicas
|
|
67
|
+
│ │ └── runtime-config.ts # Configuração runtime
|
|
68
|
+
│ ├── types/
|
|
69
|
+
│ │ └── index.ts # Types do framework
|
|
70
|
+
│ └── build/
|
|
71
|
+
│ └── index.ts # Sistema de build
|
|
72
|
+
├── app/ # 👨💻 APPLICATION CODE
|
|
73
|
+
│ ├── server/
|
|
74
|
+
│ │ ├── controllers/ # Business logic
|
|
75
|
+
│ │ ├── routes/ # API endpoints
|
|
76
|
+
│ │ └── app.ts # App type export
|
|
77
|
+
│ ├── client/
|
|
78
|
+
│ │ ├── src/
|
|
79
|
+
│ │ │ ├── components/ # React components
|
|
80
|
+
│ │ │ ├── lib/ # Eden Treaty client
|
|
81
|
+
│ │ │ └── App.tsx # Main interface
|
|
82
|
+
│ │ └── public/ # Static assets
|
|
83
|
+
│ └── shared/
|
|
84
|
+
│ └── types/ # Shared types
|
|
85
|
+
└── ai-context/ # 📖 LLM Documentation
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### **⚙️ Framework Core Architecture**
|
|
89
|
+
|
|
90
|
+
#### **🎮 FluxStackFramework Class**
|
|
91
|
+
```typescript
|
|
92
|
+
export class FluxStackFramework {
|
|
93
|
+
private app: Elysia
|
|
94
|
+
private plugins: Plugin[] = []
|
|
95
|
+
|
|
96
|
+
constructor(options: FluxStackOptions) {
|
|
97
|
+
this.app = new Elysia()
|
|
98
|
+
this.loadCorePlugins()
|
|
99
|
+
this.setupRoutes()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Plugin system
|
|
103
|
+
use(plugin: Plugin): this
|
|
104
|
+
|
|
105
|
+
// Development server
|
|
106
|
+
startDev(): Promise<void>
|
|
107
|
+
|
|
108
|
+
// Production server
|
|
109
|
+
start(): Promise<void>
|
|
110
|
+
|
|
111
|
+
// Build system
|
|
112
|
+
build(): Promise<void>
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### **🔌 Plugin System**
|
|
117
|
+
```typescript
|
|
118
|
+
export interface Plugin {
|
|
119
|
+
name: string
|
|
120
|
+
version?: string
|
|
121
|
+
dependencies?: string[]
|
|
122
|
+
setup(context: FluxStackContext, app: Elysia): void
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Built-in plugins
|
|
126
|
+
const corePlugins = [
|
|
127
|
+
loggerPlugin, // Request/response logging
|
|
128
|
+
swaggerPlugin, // API documentation
|
|
129
|
+
vitePlugin, // Frontend integration
|
|
130
|
+
staticPlugin // Static file serving
|
|
131
|
+
]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### **🔄 Communication Architecture**
|
|
135
|
+
|
|
136
|
+
#### **📡 Eden Treaty Integration**
|
|
137
|
+
```typescript
|
|
138
|
+
// Server: Export app type
|
|
139
|
+
export type App = typeof appInstance
|
|
140
|
+
|
|
141
|
+
// Client: Import and use
|
|
142
|
+
import { treaty } from '@elysiajs/eden'
|
|
143
|
+
import type { App } from '../../../server/app'
|
|
144
|
+
|
|
145
|
+
const client = treaty<App>(baseUrl)
|
|
146
|
+
export const api = client.api // ✨ Full type inference
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### **🔒 Type Flow**
|
|
150
|
+
```
|
|
151
|
+
1. Server defines routes with TypeBox schemas
|
|
152
|
+
2. Elysia generates TypeScript types
|
|
153
|
+
3. App.ts exports combined app type
|
|
154
|
+
4. Eden Treaty imports app type
|
|
155
|
+
5. Client gets automatic type inference
|
|
156
|
+
6. Changes server → automatic client updates
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## 🚀 **Runtime Architecture**
|
|
160
|
+
|
|
161
|
+
### **🔄 Development Mode**
|
|
162
|
+
```
|
|
163
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
164
|
+
│ Bun Process │ │ Vite Process │
|
|
165
|
+
│ │ │ │
|
|
166
|
+
│ ┌─────────────┐ │ │ ┌─────────────┐ │
|
|
167
|
+
│ │FluxStack │ │ │ │React HMR │ │
|
|
168
|
+
│ │Framework │ │ │ │Server │ │
|
|
169
|
+
│ │:3000 │ │ │ │:5173 │ │
|
|
170
|
+
│ └─────────────┘ │ │ └─────────────┘ │
|
|
171
|
+
└─────────────────┘ └─────────────────┘
|
|
172
|
+
│ │
|
|
173
|
+
└─────── CORS ──────────┘
|
|
174
|
+
(Different ports)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### **🏭 Production Mode**
|
|
178
|
+
```
|
|
179
|
+
┌─────────────────────────────────┐
|
|
180
|
+
│ Bun Process │
|
|
181
|
+
│ │
|
|
182
|
+
│ ┌─────────────┐ ┌─────────────┐ │
|
|
183
|
+
│ │FluxStack │ │Static Files │ │
|
|
184
|
+
│ │API Server │ │Server │ │
|
|
185
|
+
│ │:3000/api │ │:3000/ │ │
|
|
186
|
+
│ └─────────────┘ └─────────────┘ │
|
|
187
|
+
└─────────────────────────────────┘
|
|
188
|
+
Single process
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 🛠️ **Build Architecture**
|
|
192
|
+
|
|
193
|
+
### **📦 Build Stages**
|
|
194
|
+
```typescript
|
|
195
|
+
// 1. Frontend Build (Vite)
|
|
196
|
+
const frontendBuild = {
|
|
197
|
+
input: 'app/client/src/main.tsx',
|
|
198
|
+
output: 'dist/client/',
|
|
199
|
+
mode: 'production',
|
|
200
|
+
env: process.env
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 2. Backend Build (Bun)
|
|
204
|
+
const backendBuild = {
|
|
205
|
+
input: 'app/server/index.ts',
|
|
206
|
+
output: 'dist/server/',
|
|
207
|
+
target: 'bun',
|
|
208
|
+
minify: true
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// 3. Framework Core (No build - TypeScript)
|
|
212
|
+
// Core remains as TypeScript for performance
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### **🐳 Docker Architecture**
|
|
216
|
+
```dockerfile
|
|
217
|
+
# Multi-stage build
|
|
218
|
+
FROM oven/bun:1 as builder
|
|
219
|
+
WORKDIR /app
|
|
220
|
+
COPY package.json bun.lock ./
|
|
221
|
+
RUN bun install --frozen-lockfile
|
|
222
|
+
|
|
223
|
+
# Build stage
|
|
224
|
+
COPY . .
|
|
225
|
+
RUN bun run build
|
|
226
|
+
|
|
227
|
+
# Runtime stage
|
|
228
|
+
FROM oven/bun:1 as runtime
|
|
229
|
+
WORKDIR /app
|
|
230
|
+
COPY --from=builder /app/dist ./dist
|
|
231
|
+
COPY --from=builder /app/package.json ./
|
|
232
|
+
EXPOSE 3000
|
|
233
|
+
CMD ["bun", "dist/index.js"]
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## ⚡ **Performance Architecture**
|
|
237
|
+
|
|
238
|
+
### **🚀 Bun Runtime Benefits**
|
|
239
|
+
- **3x faster startup** vs Node.js
|
|
240
|
+
- **Built-in bundler** (faster than webpack)
|
|
241
|
+
- **Native fetch** & Web APIs
|
|
242
|
+
- **Low memory footprint**
|
|
243
|
+
|
|
244
|
+
### **📈 Elysia Performance**
|
|
245
|
+
- **Zero-cost abstractions**
|
|
246
|
+
- **Compile-time optimizations**
|
|
247
|
+
- **Minimal runtime overhead**
|
|
248
|
+
- **Built-in validation** with TypeBox
|
|
249
|
+
|
|
250
|
+
### **🔄 Hot Reload Strategy**
|
|
251
|
+
```typescript
|
|
252
|
+
// Backend: File watching with Bun
|
|
253
|
+
Bun.watch("app/server/**/*.ts", {
|
|
254
|
+
onUpdate: () => {
|
|
255
|
+
// Restart server preserving connections
|
|
256
|
+
server.reload()
|
|
257
|
+
}
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
// Frontend: Vite HMR
|
|
261
|
+
// Independent hot module replacement
|
|
262
|
+
// No server restart required
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## 🧪 **Testing Architecture**
|
|
266
|
+
|
|
267
|
+
### **🔬 Test Strategy**
|
|
268
|
+
```
|
|
269
|
+
┌─────────────────────────────────────────┐
|
|
270
|
+
│ Test Pyramid │
|
|
271
|
+
├─────────────────────────────────────────┤
|
|
272
|
+
│ E2E Tests (Playwright) │ ← Full app tests
|
|
273
|
+
├─────────────────────────────────────────┤
|
|
274
|
+
│ Integration Tests (Vitest) │ ← API + UI tests
|
|
275
|
+
├─────────────────────────────────────────┤
|
|
276
|
+
│ Unit Tests (Vitest + React Testing) │ ← Component tests
|
|
277
|
+
└─────────────────────────────────────────┘
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### **🧪 Test Configuration**
|
|
281
|
+
```typescript
|
|
282
|
+
// vitest.config.ts
|
|
283
|
+
export default defineConfig({
|
|
284
|
+
test: {
|
|
285
|
+
environment: 'jsdom', // React testing
|
|
286
|
+
setupFiles: ['./tests/setup.ts'],
|
|
287
|
+
coverage: {
|
|
288
|
+
reporter: ['text', 'html'],
|
|
289
|
+
threshold: {
|
|
290
|
+
global: {
|
|
291
|
+
branches: 80,
|
|
292
|
+
functions: 80,
|
|
293
|
+
lines: 80,
|
|
294
|
+
statements: 80
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
})
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## 🔧 **Configuration Architecture**
|
|
303
|
+
|
|
304
|
+
### **⚙️ Dynamic Environment System**
|
|
305
|
+
```typescript
|
|
306
|
+
// Precedence: Process Env > Runtime > .env > Defaults
|
|
307
|
+
class EnvironmentManager {
|
|
308
|
+
static precedence = [
|
|
309
|
+
'process.env', // Highest priority
|
|
310
|
+
'runtime.env', // Runtime overrides
|
|
311
|
+
'file.env', // .env file
|
|
312
|
+
'defaults' // Framework defaults
|
|
313
|
+
]
|
|
314
|
+
|
|
315
|
+
static get(key: string): string {
|
|
316
|
+
return this.resolveWithPrecedence(key)
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### **🎛️ Plugin Configuration**
|
|
322
|
+
```typescript
|
|
323
|
+
interface PluginConfig {
|
|
324
|
+
logger: {
|
|
325
|
+
level: 'debug' | 'info' | 'warn' | 'error'
|
|
326
|
+
format: 'json' | 'pretty'
|
|
327
|
+
}
|
|
328
|
+
swagger: {
|
|
329
|
+
path: string
|
|
330
|
+
title: string
|
|
331
|
+
version: string
|
|
332
|
+
}
|
|
333
|
+
vite: {
|
|
334
|
+
port: number
|
|
335
|
+
host: string
|
|
336
|
+
open: boolean
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## 🚀 **Deployment Architecture**
|
|
342
|
+
|
|
343
|
+
### **☁️ Production Deployment Options**
|
|
344
|
+
|
|
345
|
+
#### **1. Single Container (Recommended)**
|
|
346
|
+
```yaml
|
|
347
|
+
# docker-compose.yml
|
|
348
|
+
services:
|
|
349
|
+
app:
|
|
350
|
+
build: .
|
|
351
|
+
ports:
|
|
352
|
+
- "3000:3000"
|
|
353
|
+
environment:
|
|
354
|
+
- NODE_ENV=production
|
|
355
|
+
- DATABASE_URL=${DATABASE_URL}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### **2. Microservices (Advanced)**
|
|
359
|
+
```yaml
|
|
360
|
+
services:
|
|
361
|
+
api:
|
|
362
|
+
build:
|
|
363
|
+
target: api-only
|
|
364
|
+
ports:
|
|
365
|
+
- "3000:3000"
|
|
366
|
+
|
|
367
|
+
frontend:
|
|
368
|
+
build:
|
|
369
|
+
target: frontend-only
|
|
370
|
+
ports:
|
|
371
|
+
- "80:80"
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
#### **3. Serverless (Future)**
|
|
375
|
+
```typescript
|
|
376
|
+
// Planned: Vercel/Netlify adapters
|
|
377
|
+
export default FluxStackFramework.createServerlessHandler({
|
|
378
|
+
platform: 'vercel' | 'netlify' | 'aws-lambda'
|
|
379
|
+
})
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## 🔮 **Future Architecture**
|
|
383
|
+
|
|
384
|
+
### **📈 Planned Enhancements**
|
|
385
|
+
- **Database Layer**: Native ORM integration
|
|
386
|
+
- **Authentication**: Built-in auth system
|
|
387
|
+
- **Real-time**: WebSocket support
|
|
388
|
+
- **Microservices**: Service mesh support
|
|
389
|
+
- **Observability**: Metrics & tracing
|
|
390
|
+
|
|
391
|
+
### **🎯 Architecture Goals**
|
|
392
|
+
- **Zero config** for common use cases
|
|
393
|
+
- **Infinite customization** for advanced needs
|
|
394
|
+
- **Production ready** out of the box
|
|
395
|
+
- **Developer happiness** as top priority
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
**🎯 Esta arquitetura garante que FluxStack seja tanto simples para começar quanto poderoso para escalar!**
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# 🚀 FluxStack - Visão Geral do Projeto
|
|
2
|
+
|
|
3
|
+
## 📋 **Resumo Executivo**
|
|
4
|
+
|
|
5
|
+
**FluxStack** é um framework full-stack moderno que combina **Bun**, **Elysia.js**, **React 19** e **TypeScript** numa arquitetura monorepo unificada com **type-safety end-to-end automática** via Eden Treaty.
|
|
6
|
+
|
|
7
|
+
### 🎯 **Diferenciais**
|
|
8
|
+
- **⚡ Performance**: Bun runtime (3x mais rápido que Node.js)
|
|
9
|
+
- **🔒 Type Safety**: Inferência automática client↔server sem declarações manuais
|
|
10
|
+
- **🔥 Hot Reload**: Backend e frontend independentes
|
|
11
|
+
- **📖 Auto-docs**: Swagger UI gerado automaticamente
|
|
12
|
+
- **🧪 Testing**: Suite completa com Vitest
|
|
13
|
+
- **🐳 Deploy**: Docker otimizado incluído
|
|
14
|
+
|
|
15
|
+
## 📊 **Estado Atual (Janeiro 2025)**
|
|
16
|
+
|
|
17
|
+
### ✅ **Sistema Estável**
|
|
18
|
+
- **Zero erros TypeScript** (vs 200+ anteriormente)
|
|
19
|
+
- **100% type inference** Eden Treaty funcionando
|
|
20
|
+
- **Hot reload independente** backend/frontend
|
|
21
|
+
- **Monorepo unificado** com uma instalação
|
|
22
|
+
- **Response schemas** completos para documentação automática
|
|
23
|
+
|
|
24
|
+
### 📈 **Estatísticas**
|
|
25
|
+
- **Runtime**: Bun 1.1.34+
|
|
26
|
+
- **Frontend**: React 19.1.0 + Vite 7.0.4
|
|
27
|
+
- **Backend**: Elysia.js 1.3.7 + TypeScript 5.8.3
|
|
28
|
+
- **Testing**: Vitest 3.2.4 + 100% taxa de sucesso
|
|
29
|
+
- **Build**: Docker multi-stage otimizado
|
|
30
|
+
|
|
31
|
+
## 🏗️ **Arquitetura Tecnológica**
|
|
32
|
+
|
|
33
|
+
### **Backend Stack**
|
|
34
|
+
```typescript
|
|
35
|
+
// Runtime & Framework
|
|
36
|
+
Bun 1.1.34+ // Runtime ultrarrápido
|
|
37
|
+
Elysia.js 1.3.7 // Framework web performático
|
|
38
|
+
TypeScript 5.8.3 // Type safety total
|
|
39
|
+
|
|
40
|
+
// APIs & Documentação
|
|
41
|
+
Eden Treaty // Type-safe client generation
|
|
42
|
+
Swagger UI // Documentação automática
|
|
43
|
+
TypeBox // Validação runtime + compile-time
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### **Frontend Stack**
|
|
47
|
+
```typescript
|
|
48
|
+
// UI & Build
|
|
49
|
+
React 19.1.0 // UI library com Concurrent Features
|
|
50
|
+
Vite 7.0.4 // Build tool + HMR ultrarrápido
|
|
51
|
+
TypeScript 5.8.3 // Type safety client
|
|
52
|
+
|
|
53
|
+
// Styling & State
|
|
54
|
+
CSS Moderno // Custom properties + Grid/Flexbox
|
|
55
|
+
React Hooks Nativos // useState, useEffect, etc.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### **DevTools & Testing**
|
|
59
|
+
```typescript
|
|
60
|
+
// Testing & Quality
|
|
61
|
+
Vitest 3.2.4 // Test runner rápido
|
|
62
|
+
JSDOM // DOM testing environment
|
|
63
|
+
ESLint 9.30.1 // Code quality
|
|
64
|
+
TypeScript Compiler // Type checking
|
|
65
|
+
|
|
66
|
+
// CI/CD & Deploy
|
|
67
|
+
GitHub Actions // Continuous integration
|
|
68
|
+
Docker // Containerização
|
|
69
|
+
Multi-stage builds // Otimização de imagem
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 📁 **Estrutura do Projeto**
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
FluxStack/
|
|
76
|
+
├── core/ # 🔒 FRAMEWORK (read-only)
|
|
77
|
+
│ ├── server/ # Framework Elysia + plugins
|
|
78
|
+
│ ├── config/ # Sistema de configuração
|
|
79
|
+
│ ├── types/ # Types do framework
|
|
80
|
+
│ └── build/ # Sistema de build
|
|
81
|
+
├── app/ # 👨💻 CÓDIGO DA APLICAÇÃO
|
|
82
|
+
│ ├── server/ # Backend (controllers, routes)
|
|
83
|
+
│ │ ├── controllers/ # Lógica de negócio
|
|
84
|
+
│ │ ├── routes/ # Endpoints da API
|
|
85
|
+
│ │ └── app.ts # Export do tipo para Eden Treaty
|
|
86
|
+
│ ├── client/ # Frontend (React + Vite)
|
|
87
|
+
│ │ ├── src/components/ # Componentes React
|
|
88
|
+
│ │ ├── src/lib/ # Cliente Eden Treaty
|
|
89
|
+
│ │ └── src/App.tsx # Interface principal
|
|
90
|
+
│ └── shared/ # Types compartilhados
|
|
91
|
+
├── tests/ # Testes do framework
|
|
92
|
+
├── docs/ # Documentação técnica
|
|
93
|
+
└── ai-context/ # 📖 Esta documentação
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 🚀 **Funcionalidades Principais**
|
|
97
|
+
|
|
98
|
+
### ✨ **1. Type Safety End-to-End**
|
|
99
|
+
```typescript
|
|
100
|
+
// ✅ Eden Treaty infere automaticamente
|
|
101
|
+
const { data: user, error } = await api.users.post({
|
|
102
|
+
name: "João",
|
|
103
|
+
email: "joao@example.com"
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
// TypeScript sabe que:
|
|
107
|
+
// - user: UserResponse = { success: boolean; user?: User; message?: string }
|
|
108
|
+
// - error: undefined (em caso de sucesso)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### ⚡ **2. Hot Reload Independente**
|
|
112
|
+
```bash
|
|
113
|
+
bun run dev # Backend + Frontend juntos
|
|
114
|
+
# Backend recarrega sem afetar frontend
|
|
115
|
+
# Frontend HMR sem reiniciar backend
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 📖 **3. Documentação Automática**
|
|
119
|
+
```typescript
|
|
120
|
+
// ✅ Swagger gerado automaticamente das rotas
|
|
121
|
+
.post("/users", handler, {
|
|
122
|
+
body: t.Object({
|
|
123
|
+
name: t.String(),
|
|
124
|
+
email: t.String({ format: "email" })
|
|
125
|
+
}),
|
|
126
|
+
response: t.Object({
|
|
127
|
+
success: t.Boolean(),
|
|
128
|
+
user: t.Optional(t.Object({...}))
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
// → Vira documentação automática
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 🧪 **4. Testing Integrado**
|
|
135
|
+
```bash
|
|
136
|
+
bun run test # Todos os testes
|
|
137
|
+
bun run test:ui # Interface visual
|
|
138
|
+
bun run test:coverage # Relatório cobertura
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## 🔄 **Fluxo de Desenvolvimento**
|
|
142
|
+
|
|
143
|
+
### **1. Desenvolvimento Local**
|
|
144
|
+
```bash
|
|
145
|
+
bun install # Uma instalação (monorepo)
|
|
146
|
+
bun run dev # Full-stack server
|
|
147
|
+
# → Backend: http://localhost:3000
|
|
148
|
+
# → Frontend: http://localhost:5173
|
|
149
|
+
# → Swagger: http://localhost:3000/swagger
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### **2. Criação de Features**
|
|
153
|
+
```typescript
|
|
154
|
+
// 1. Types em app/shared/
|
|
155
|
+
export interface Product { id: number; name: string }
|
|
156
|
+
|
|
157
|
+
// 2. Controller em app/server/controllers/
|
|
158
|
+
export class ProductsController { ... }
|
|
159
|
+
|
|
160
|
+
// 3. Routes em app/server/routes/
|
|
161
|
+
export const productsRoutes = new Elysia()...
|
|
162
|
+
|
|
163
|
+
// 4. Frontend em app/client/src/
|
|
164
|
+
const { data, error } = await api.products.get()
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### **3. Build & Deploy**
|
|
168
|
+
```bash
|
|
169
|
+
bun run build # Build otimizado
|
|
170
|
+
bun run start # Servidor produção
|
|
171
|
+
# ou
|
|
172
|
+
docker build . # Container Docker
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## 🎯 **Casos de Uso Ideais**
|
|
176
|
+
|
|
177
|
+
### ✅ **Excelente Para:**
|
|
178
|
+
- **APIs REST modernas** com documentação automática
|
|
179
|
+
- **SPAs React** com type safety total
|
|
180
|
+
- **Protótipos rápidos** com hot reload
|
|
181
|
+
- **Microserviços** com alta performance
|
|
182
|
+
- **Apps corporativos** com qualidade enterprise
|
|
183
|
+
|
|
184
|
+
### ⚠️ **Considere Alternativas Para:**
|
|
185
|
+
- **Apps server-side rendering** complexos (use Next.js)
|
|
186
|
+
- **Projetos que precisam de Node.js** específico
|
|
187
|
+
- **Teams sem experiência TypeScript** (curva de aprendizado)
|
|
188
|
+
|
|
189
|
+
## 📈 **Roadmap & Futuro**
|
|
190
|
+
|
|
191
|
+
### 🎯 **Próximas Versões**
|
|
192
|
+
- **Database layer**: Integração nativa com ORMs
|
|
193
|
+
- **Authentication**: Sistema de auth built-in
|
|
194
|
+
- **Real-time**: WebSockets + Server-Sent Events
|
|
195
|
+
- **API versioning**: Versionamento automático
|
|
196
|
+
- **Monitoring**: Métricas e observabilidade
|
|
197
|
+
|
|
198
|
+
### 🔮 **Visão de Longo Prazo**
|
|
199
|
+
- Framework **plug-and-play** para startups
|
|
200
|
+
- **Marketplace de plugins** da comunidade
|
|
201
|
+
- **Templates** para domínios específicos
|
|
202
|
+
- **CLI generator** para scaffolding
|
|
203
|
+
|
|
204
|
+
## 🆘 **Suporte & Comunidade**
|
|
205
|
+
|
|
206
|
+
- **📖 Documentação**: Esta pasta `ai-context/`
|
|
207
|
+
- **🐛 Issues**: GitHub repository
|
|
208
|
+
- **💬 Discussões**: GitHub Discussions
|
|
209
|
+
- **📧 Email**: Para questões privadas
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
**🎯 FluxStack é ideal para desenvolvedores que querem produtividade máxima com type safety garantida e performance de ponta.**
|