From 65a428534c21bb20fe080eb714dfe369900dd159 Mon Sep 17 00:00:00 2001 From: 0x1d Date: Wed, 5 Nov 2025 09:12:34 +0100 Subject: [PATCH] feat: microservice architecture --- .../adr/0029-microservices-architecture.md | 87 ++ .../0030-service-communication-strategy.md | 73 ++ docs/content/adr/README.md | 5 + docs/content/architecture-modules.md | 88 +- docs/content/architecture.md | 165 ++- docs/content/component-relationships.md | 86 +- docs/content/index.md | 2 +- docs/content/plan.md | 1099 ++++++++++------- .../stories/STORY_CONSOLIDATION_GUIDE.md | 179 +++ .../phase0/0.1-project-initialization.md | 162 +++ ...go-module-go-mod-init-githubcomyourorgp.md | 47 - .../phase0/0.1.1-initialize-go-module.md | 47 - .../0.1.2-create-directory-structure.md | 77 -- .../0.1.3-add-gitignore-for-go-projects.md | 56 - .../stories/phase0/0.1.3-add-gitignore.md | 56 - .../phase0/0.1.4-create-initial-readme.md | 63 - ...-initial-readmemd-with-project-overview.md | 63 - .../0.2-configuration-management-system.md | 171 +++ .../0.2.1-install-config-dependencies.md | 47 - ...hubcomspf13viper-and-githubcomspf13cobr.md | 47 - .../phase0/0.2.2-create-config-interface.md | 59 - ....2.2-create-pkgconfigconfiggo-interface.md | 59 - .../phase0/0.2.3-implement-config-loader.md | 60 - ...ment-internalconfigconfiggo-using-viper.md | 60 - ...-configdefaultyaml-with-basic-structure.md | 67 - .../0.2.4-create-configuration-files.md | 67 - ...lconfigloadergo-with-loadconfig-functio.md | 40 - .../phase0/0.3-structured-logging-system.md | 136 ++ .../phase0/0.3.1-install-gouberorgzap.md | 33 - .../0.3.1-install-logging-dependencies.md | 33 - ....3.2-create-pkgloggerloggergo-interface.md | 52 - ....3-implement-internalloggerzap_loggergo.md | 40 - ...est-id-middleware-helper-gin-middleware.md | 40 - .../stories/phase0/0.4-cicd-pipeline.md | 126 ++ .../0.4.1-create-githubworkflowsciyml.md | 40 - ...0.4.2-add-makefile-with-common-commands.md | 40 - .../stories/phase0/0.5-di-and-bootstrap.md | 122 ++ .../phase0/0.5.1-install-gouberorgfx.md | 40 - .../0.5.2-create-internaldicontainergo.md | 40 - ...0.5.3-create-cmdplatformmaingo-skeleton.md | 40 - docs/content/stories/phase0/README.md | 49 +- .../phase1/1.1-enhanced-di-container.md | 95 ++ .../1.1.1-extend-internaldicontainergo.md | 40 - .../1.1.2-create-internaldiprovidersgo.md | 40 - .../1.1.3-add-internaldicore_modulego.md | 40 - .../stories/phase1/1.2-database-layer.md | 144 +++ .../phase1/1.2.1-install-entgoioentcmdent.md | 40 - .../phase1/1.2.2-initialize-ent-schema.md | 46 - ...fine-core-entities-in-internalentschema.md | 40 - ...nerate-ent-code-go-generate-internalent.md | 40 - ....5-create-internalinfradatabaseclientgo.md | 40 - ...dd-database-config-to-configdefaultyaml.md | 40 - .../phase1/1.3-health-metrics-system.md | 126 ++ ...hubcomprometheusclient_golangprometheus.md | 40 - ...hubcomheptiolabshealthcheck-optional-or.md | 40 - ....3.3-create-pkghealthhealthgo-interface.md | 48 - ....3.4-implement-internalhealthregistrygo.md | 40 - .../1.3.5-create-internalmetricsmetricsgo.md | 40 - ...-add-metrics-endpoint-prometheus-format.md | 40 - ...-register-endpoints-in-main-http-router.md | 40 - .../stories/phase1/1.4-error-handling.md | 103 ++ ...-create-pkgerrorbuserrorbusgo-interface.md | 48 - ...implement-internalerrorbuschannel_busgo.md | 40 - ...ecovery-middleware-that-publishes-to-er.md | 40 - ....4.4-register-error-bus-in-di-container.md | 40 - .../content/stories/phase1/1.5-http-server.md | 122 ++ .../1.5.1-install-githubcomgin-gonicgin.md | 40 - .../1.5.2-create-internalserverservergo.md | 40 - ....5.3-wire-http-server-into-fx-lifecycle.md | 40 - ...e-cmdplatformmaingo-to-use-fx-lifecycle.md | 40 - .../stories/phase1/1.6-opentelemetry.md | 117 ++ .../1.6.1-install-opentelemetry-packages.md | 40 - ....2-create-internalobservabilitytracergo.md | 40 - ...6.3-add-http-instrumentation-middleware.md | 40 - ...d-trace-context-propagation-to-requests.md | 40 - .../phase1/1.7-service-abstraction-layer.md | 114 ++ docs/content/stories/phase1/README.md | 90 +- .../stories/phase2/2.1-jwt-authentication.md | 139 +++ .../2.1.1-install-githubcomgolang-jwtjwtv5.md | 40 - .../2.1.2-create-pkgauthauthgo-interfaces.md | 56 - .../2.1.3-implement-internalauthjwt_authgo.md | 40 - .../2.1.4-create-internalauthmiddlewarego.md | 40 - ...-add-login-endpoint-post-apiv1authlogin.md | 40 - ...-refresh-endpoint-post-apiv1authrefresh.md | 40 - .../stories/phase2/2.2-identity-management.md | 82 ++ ...create-pkgidentityidentitygo-interfaces.md | 59 - ...t-internalidentityuser_repogo-using-ent.md | 40 - ...mplement-internalidentityuser_servicego.md | 40 - .../stories/phase2/2.2.4-add-endpoints.md | 40 - .../content/stories/phase2/2.3-rbac-system.md | 70 ++ .../phase2/2.3.1-create-pkgpermpermgo.md | 59 - ....3.2-create-pkgpermresolvergo-interface.md | 49 - ...lement-internalpermin_memory_resolvergo.md | 40 - .../2.3.4-create-pkgauthauthzgo-interface.md | 48 - ...implement-internalauthrbac_authorizergo.md | 40 - .../2.3.6-create-authorization-middleware.md | 40 - .../stories/phase2/2.4-role-management.md | 64 + ....4.1-create-internalidentityrole_repogo.md | 40 - .../stories/phase2/2.4.2-add-endpoints.md | 40 - .../stories/phase2/2.5-audit-logging.md | 74 ++ .../2.5.1-create-pkgauditauditgo-interface.md | 55 - ....2-implement-internalauditent_auditorgo.md | 40 - .../phase2/2.5.3-add-audit-middleware.md | 40 - .../2.5.4-integrate-with-auth-endpoints.md | 40 - .../stories/phase2/2.6-database-seeding.md | 57 + .../phase2/2.6.1-create-internalseedseedgo.md | 40 - docs/content/stories/phase2/README.md | 82 +- .../phase3/3.1-module-system-interface.md | 85 ++ .../phase3/3.1.1-create-pkgmodulemodulego.md | 52 - .../3.1.2-create-pkgmodulemanifestgo.md | 52 - ...uleyaml-schema-used-for-code-generation.md | 40 - .../phase3/3.2-permission-code-generation.md | 65 + ...3.2.1-create-internalregistryregistrygo.md | 40 - .../3.2.2-add-registration-validation.md | 40 - .../stories/phase3/3.3-module-loader.md | 83 ++ ....1-create-scriptsgenerate-permissionsgo.md | 40 - ...d-gogenerate-directive-to-pkgpermpermgo.md | 40 - ...ate-makefile-with-make-generate-command.md | 40 - docs/content/stories/phase3/3.4-module-cli.md | 62 + ...4.1-create-internalpluginloaderloadergo.md | 40 - ...ent-internalpluginloaderstatic_loadergo.md | 40 - ...nternalpluginloaderplugin_loadergo-opti.md | 40 - .../stories/phase3/3.5-service-registry.md | 138 +++ ....5.1-create-internalmoduleinitializergo.md | 40 - .../stories/phase3/3.5.2-run-migrations.md | 40 - .../phase3/3.6.1-extend-pkgmodulemodulego.md | 50 - .../3.6.2-integrate-with-fxlifecycle.md | 40 - .../3.7.1-create-cmdplatformctlmaingo.md | 40 - .../3.7.2-add-to-makefile-make-install-cli.md | 40 - docs/content/stories/phase3/README.md | 76 +- .../content/stories/phase4/4.1-blog-module.md | 169 +++ .../4.1.1-create-modulesblog-directory.md | 58 - .../stories/phase4/4.1.2-initialize-gomod.md | 47 - .../4.2.1-create-modulesblogmoduleyaml.md | 70 -- ...-create-modulesbloginternaldomainpostgo.md | 53 - ...schema-modulesbloginternalentschemapost.md | 40 - ...4.3.3-generate-ent-code-for-blog-module.md | 40 - ...te-modulesbloginternaldomainpost_repogo.md | 52 - ...ement-using-ent-client-shared-from-core.md | 40 - ...odulesbloginternalservicepost_servicego.md | 40 - ...-create-modulesbloginternalapihandlergo.md | 40 - .../4.6.2-use-authorization-middleware.md | 46 - ...4.6.3-register-handlers-in-modules-init.md | 40 - .../4.7.1-create-modulesblogpkgmodulego.md | 70 -- ...pdate-main-gomod-to-include-blog-module.md | 46 - ...import-blog-module-in-cmdplatformmaingo.md | 46 - ...run-permission-generation-make-generate.md | 40 - ...4-verify-blog-permissions-are-generated.md | 40 - ...gration-test-modulesbloginternalapihand.md | 40 - ...d-unit-tests-for-service-and-repository.md | 40 - docs/content/stories/phase4/README.md | 32 +- .../stories/phase5/5.1-cache-system.md | 64 + .../5.1.1-install-githubcomredisgo-redisv9.md | 40 - ...2-create-pkginfracachecachego-interface.md | 50 - ...plement-internalinfracacheredis_cachego.md | 40 - ...4-add-redis-config-to-configdefaultyaml.md | 40 - .../phase5/5.1.5-register-in-di-container.md | 40 - ...middleware-for-selected-routes-optional.md | 40 - docs/content/stories/phase5/5.2-event-bus.md | 69 ++ ...-create-pkgeventbuseventbusgo-interface.md | 49 - ...plement-internalinfrabusinprocess_busgo.md | 40 - ...3-implement-internalinfrabuskafka_busgo.md | 40 - ...4-add-kafka-config-to-configdefaultyaml.md | 40 - ...s-in-di-container-switchable-via-config.md | 40 - .../stories/phase5/5.2.6-add-core-events.md | 40 - .../stories/phase5/5.3-blob-storage.md | 65 + ...tall-githubcomawsaws-sdk-go-v2services3.md | 40 - ...3.2-create-pkginfrablobblobgo-interface.md | 51 - ...3-implement-internalinfrablobs3_storego.md | 40 - ....3.4-add-s3-config-to-configdefaultyaml.md | 40 - .../phase5/5.3.5-register-in-di-container.md | 40 - ...e-upload-endpoint-post-apiv1filesupload.md | 40 - .../stories/phase5/5.4-email-notification.md | 67 + .../5.4.1-install-githubcomgo-mailmail.md | 40 - ...pkgnotificationnotificationgo-interface.md | 49 - ...ement-internalinfraemailsmtp_notifiergo.md | 40 - ...4-add-email-config-to-configdefaultyaml.md | 40 - .../5.4.5-integrate-with-identity-service.md | 40 - .../phase5/5.4.6-register-in-di-container.md | 40 - .../stories/phase5/5.5-scheduler-jobs.md | 74 ++ ...hubcomrobfigcronv3-and-githubcomhibiken.md | 40 - ...reate-pkgschedulerschedulergo-interface.md | 49 - ...internalinfraschedulerasynq_schedulergo.md | 40 - ...te-internalinfraschedulerjob_registrygo.md | 40 - .../stories/phase5/5.5.5-add-example-jobs.md | 40 - ...monitoring-endpoint-get-apiv1jobsstatus.md | 40 - .../stories/phase5/5.6-secret-store.md | 68 + ...create-pkginfrasecretsecretgo-interface.md | 48 - ...nternalinfrasecretvault_storego-hashico.md | 40 - ...nternalinfrasecretaws_secretsgo-aws-sec.md | 40 - .../5.6.4-integrate-with-config-loader.md | 40 - ...ter-in-di-container-optional-via-config.md | 40 - .../stories/phase5/5.7-grpc-services.md | 150 +++ ....7.1-create-pkgtenanttenantgo-interface.md | 48 - ....7.2-implement-internaltenantresolvergo.md | 40 - .../phase5/5.7.3-add-tenant-middleware.md | 40 - ...date-ent-queries-to-filter-by-tenant_id.md | 40 - ...update-user-entity-to-include-tenant_id.md | 40 - docs/content/stories/phase5/README.md | 83 +- .../phase6/6.1-enhanced-observability.md | 72 ++ .../6.1.1-complete-opentelemetry-setup.md | 40 - .../phase6/6.1.2-create-custom-spans.md | 40 - .../6.1.3-add-trace-context-propagation.md | 40 - .../stories/phase6/6.2-error-reporting.md | 53 + ...2.1-install-githubcomgetsentrysentry-go.md | 40 - .../phase6/6.2.2-integrate-with-error-bus.md | 40 - .../phase6/6.2.3-add-sentry-middleware.md | 40 - .../6.2.4-configure-sentry-dsn-via-config.md | 40 - .../stories/phase6/6.3-grafana-dashboards.md | 46 + .../phase6/6.3.1-add-request-correlation.md | 40 - .../phase6/6.3.2-add-structured-fields.md | 40 - .../6.3.3-create-log-aggregation-config.md | 40 - .../stories/phase6/6.4-rate-limiting.md | 53 + .../stories/phase6/6.4.1-add-more-metrics.md | 40 - .../phase6/6.4.2-create-metric-labels.md | 40 - .../stories/phase6/6.5-security-hardening.md | 54 + .../6.5.1-create-opsgrafanadashboards.md | 40 - ...ent-dashboard-setup-in-docsoperationsmd.md | 40 - .../phase6/6.6-performance-optimization.md | 53 + .../6.6.1-install-githubcomululelimiterv3.md | 40 - .../6.6.2-create-rate-limit-middleware.md | 40 - .../phase6/6.6.3-add-rate-limit-config.md | 49 - .../6.6.4-return-x-ratelimit--headers.md | 40 - .../6.7.1-add-security-headers-middleware.md | 40 - .../phase6/6.7.2-add-request-size-limits.md | 40 - .../phase6/6.7.3-add-input-validation.md | 40 - .../6.7.4-add-sql-injection-protection.md | 40 - .../6.8.1-add-database-connection-pooling.md | 40 - .../phase6/6.8.2-add-query-optimization.md | 40 - .../phase6/6.8.3-add-response-compression.md | 40 - .../phase6/6.8.4-add-caching-strategy.md | 40 - docs/content/stories/phase6/README.md | 71 +- .../stories/phase7/7.1-testing-suite.md | 83 ++ ...hieve-80-code-coverage-for-core-modules.md | 40 - ...githubcomstretchrtestify-for-assertions.md | 40 - ...ithubcomgolangmock-or-mockery-for-mocks.md | 40 - .../stories/phase7/7.1.4-add-test-helpers.md | 40 - .../stories/phase7/7.2-documentation.md | 68 + ...ithubcomtestcontainerstestcontainers-go.md | 40 - .../7.2.2-create-integration-test-suite.md | 40 - .../stories/phase7/7.2.3-test-scenarios.md | 40 - .../7.2.4-create-docker-composetestyml.md | 40 - ...7.2.5-add-test-tags-gobuild-integration.md | 40 - .../stories/phase7/7.3-cicd-enhancement.md | 51 + ...ithubcompact-foundationpact-go-optional.md | 40 - .../phase7/7.3.2-create-api-contract-tests.md | 40 - .../phase7/7.3.3-use-openapi-validator.md | 40 - .../stories/phase7/7.4-docker-deployment.md | 77 ++ ...1-create-perf-directory-with-k6-scripts.md | 40 - .../7.4.2-document-performance-benchmarks.md | 40 - .../stories/phase7/7.5.1-create-readmemd.md | 40 - .../phase7/7.5.2-create-docsarchitecturemd.md | 40 - .../7.5.3-create-docsextension-pointsmd.md | 40 - .../stories/phase7/7.5.4-create-docsapimd.md | 40 - .../phase7/7.5.5-create-docsoperationsmd.md | 40 - .../stories/phase7/7.5.6-add-code-examples.md | 40 - .../7.6.1-update-githubworkflowsciyml.md | 40 - .../phase7/7.6.2-add-release-workflow.md | 40 - .../phase7/7.6.3-add-security-scanning.md | 40 - .../7.7.1-create-multi-stage-dockerfile.md | 52 - ...reate-docker-composeyml-for-development.md | 40 - ...te-docker-composeprodyml-for-production.md | 40 - .../7.7.4-add-health-checks-to-dockerfile.md | 40 - ...cument-docker-usage-in-docsdeploymentmd.md | 40 - ...7.8.1-create-docsdeploymentkubernetesmd.md | 40 - .../7.8.2-create-docsdeploymentdockermd.md | 40 - .../7.8.3-create-docsdeploymentcloudmd.md | 40 - ...7.9.1-create-makefile-with-common-tasks.md | 51 - .../phase7/7.9.2-add-development-scripts.md | 40 - ...te-envexample-with-all-config-variables.md | 40 - .../7.9.4-add-pre-commit-hooks-optional.md | 40 - docs/content/stories/phase7/README.md | 74 +- .../stories/phase8/8.1-oidc-support.md | 47 + .../8.1.1-install-githubcomcoreosgo-oidc.md | 40 - .../phase8/8.1.2-implement-oidc-provider.md | 40 - .../phase8/8.1.3-add-oidc-client-support.md | 40 - ...8.1.4-document-oidc-setup-in-docsauthmd.md | 40 - .../content/stories/phase8/8.2-graphql-api.md | 50 + .../8.2.1-install-githubcom99designsgqlgen.md | 40 - .../phase8/8.2.2-create-graphql-schema.md | 40 - .../phase8/8.2.3-implement-resolvers.md | 40 - ...8.2.4-add-graphql-endpoint-post-graphql.md | 40 - .../stories/phase8/8.3-additional-modules.md | 42 + ....3.1-add-requestresponse-transformation.md | 40 - .../8.3.2-add-api-key-authentication.md | 40 - .../phase8/8.3.3-add-request-routing-rules.md | 40 - .../8.3.4-add-api-versioning-support.md | 40 - .../stories/phase8/8.4-final-polish.md | 63 + .../8.4.1-create-modulesnotification.md | 40 - .../phase8/8.4.2-create-modulesanalytics.md | 40 - .../8.5.1-add-database-query-caching.md | 40 - .../phase8/8.5.2-optimize-n1-queries.md | 40 - .../8.5.3-add-response-caching-redis.md | 40 - ...lement-connection-pooling-optimizations.md | 40 - ....5.5-add-database-read-replicas-support.md | 40 - .../phase8/8.6.1-install-i18n-library.md | 40 - .../phase8/8.6.2-add-locale-detection.md | 40 - .../phase8/8.6.3-create-message-catalogs.md | 40 - ...-translation-support-for-error-messages.md | 40 - .../8.7.1-code-review-and-refactoring.md | 40 - .../content/stories/phase8/8.7.10-di-setup.md | 40 - .../stories/phase8/8.7.11-di-container.md | 40 - .../stories/phase8/8.7.12-database-ent.md | 40 - .../stories/phase8/8.7.13-health--metrics.md | 40 - .../stories/phase8/8.7.14-error-bus.md | 40 - .../stories/phase8/8.7.15-http-server.md | 40 - .../stories/phase8/8.7.16-opentelemetry.md | 40 - .../phase8/8.7.17-jwt-authentication.md | 40 - .../phase8/8.7.18-identity-management.md | 40 - .../phase8/8.7.19-roles--permissions.md | 40 - .../content/stories/phase8/8.7.2-bug-fixes.md | 40 - .../phase8/8.7.20-authorization-middleware.md | 40 - .../stories/phase8/8.7.21-audit-logging.md | 40 - .../stories/phase8/8.7.22-module-interface.md | 40 - .../stories/phase8/8.7.23-static-registry.md | 40 - .../phase8/8.7.24-permission-generation.md | 40 - .../stories/phase8/8.7.25-module-loader.md | 40 - .../phase8/8.7.26-module-initialization.md | 40 - .../phase8/8.7.27-blog-module-structure.md | 40 - .../stories/phase8/8.7.28-domain-model.md | 40 - .../phase8/8.7.29-repository--service.md | 40 - .../phase8/8.7.3-performance-profiling.md | 40 - .../stories/phase8/8.7.30-api-handlers.md | 40 - .../phase8/8.7.31-integration-tests.md | 40 - .../stories/phase8/8.7.32-cache-redis.md | 40 - .../stories/phase8/8.7.33-event-bus.md | 40 - .../stories/phase8/8.7.34-blob-storage.md | 40 - .../phase8/8.7.35-email-notification.md | 40 - .../stories/phase8/8.7.36-schedulerjobs.md | 40 - .../phase8/8.7.37-multi-tenancy-optional.md | 40 - .../stories/phase8/8.7.38-opentelemetry.md | 40 - .../phase8/8.7.39-sentry-integration.md | 40 - .../stories/phase8/8.7.4-security-audit.md | 40 - .../stories/phase8/8.7.40-enhanced-logging.md | 40 - .../phase8/8.7.41-prometheus-metrics.md | 40 - .../phase8/8.7.42-grafana-dashboards.md | 40 - .../stories/phase8/8.7.43-rate-limiting.md | 40 - .../phase8/8.7.44-security-hardening.md | 40 - .../phase8/8.7.45-unit-tests-80-coverage.md | 40 - .../phase8/8.7.46-integration-tests.md | 40 - .../stories/phase8/8.7.47-documentation.md | 40 - .../stories/phase8/8.7.48-cicd-pipeline.md | 40 - .../stories/phase8/8.7.49-docker-images.md | 40 - .../phase8/8.7.5-documentation-review.md | 40 - .../phase8/8.7.50-deployment-guides.md | 40 - .../stories/phase8/8.7.51-oidc-support.md | 40 - .../stories/phase8/8.7.52-graphql-api.md | 40 - .../phase8/8.7.53-additional-modules.md | 40 - .../phase8/8.7.54-performance-optimization.md | 40 - .../phase8/8.7.6-repository-structure.md | 40 - .../phase8/8.7.7-configuration-system.md | 40 - .../phase8/8.7.8-logging-foundation.md | 40 - .../stories/phase8/8.7.9-basic-cicd.md | 40 - docs/content/stories/phase8/README.md | 70 +- 354 files changed, 5544 insertions(+), 13141 deletions(-) create mode 100644 docs/content/adr/0029-microservices-architecture.md create mode 100644 docs/content/adr/0030-service-communication-strategy.md create mode 100644 docs/content/stories/STORY_CONSOLIDATION_GUIDE.md create mode 100644 docs/content/stories/phase0/0.1-project-initialization.md delete mode 100644 docs/content/stories/phase0/0.1.1-initialize-go-module-go-mod-init-githubcomyourorgp.md delete mode 100644 docs/content/stories/phase0/0.1.1-initialize-go-module.md delete mode 100644 docs/content/stories/phase0/0.1.2-create-directory-structure.md delete mode 100644 docs/content/stories/phase0/0.1.3-add-gitignore-for-go-projects.md delete mode 100644 docs/content/stories/phase0/0.1.3-add-gitignore.md delete mode 100644 docs/content/stories/phase0/0.1.4-create-initial-readme.md delete mode 100644 docs/content/stories/phase0/0.1.4-create-initial-readmemd-with-project-overview.md create mode 100644 docs/content/stories/phase0/0.2-configuration-management-system.md delete mode 100644 docs/content/stories/phase0/0.2.1-install-config-dependencies.md delete mode 100644 docs/content/stories/phase0/0.2.1-install-githubcomspf13viper-and-githubcomspf13cobr.md delete mode 100644 docs/content/stories/phase0/0.2.2-create-config-interface.md delete mode 100644 docs/content/stories/phase0/0.2.2-create-pkgconfigconfiggo-interface.md delete mode 100644 docs/content/stories/phase0/0.2.3-implement-config-loader.md delete mode 100644 docs/content/stories/phase0/0.2.3-implement-internalconfigconfiggo-using-viper.md delete mode 100644 docs/content/stories/phase0/0.2.4-create-configdefaultyaml-with-basic-structure.md delete mode 100644 docs/content/stories/phase0/0.2.4-create-configuration-files.md delete mode 100644 docs/content/stories/phase0/0.2.5-add-internalconfigloadergo-with-loadconfig-functio.md create mode 100644 docs/content/stories/phase0/0.3-structured-logging-system.md delete mode 100644 docs/content/stories/phase0/0.3.1-install-gouberorgzap.md delete mode 100644 docs/content/stories/phase0/0.3.1-install-logging-dependencies.md delete mode 100644 docs/content/stories/phase0/0.3.2-create-pkgloggerloggergo-interface.md delete mode 100644 docs/content/stories/phase0/0.3.3-implement-internalloggerzap_loggergo.md delete mode 100644 docs/content/stories/phase0/0.3.4-add-request-id-middleware-helper-gin-middleware.md create mode 100644 docs/content/stories/phase0/0.4-cicd-pipeline.md delete mode 100644 docs/content/stories/phase0/0.4.1-create-githubworkflowsciyml.md delete mode 100644 docs/content/stories/phase0/0.4.2-add-makefile-with-common-commands.md create mode 100644 docs/content/stories/phase0/0.5-di-and-bootstrap.md delete mode 100644 docs/content/stories/phase0/0.5.1-install-gouberorgfx.md delete mode 100644 docs/content/stories/phase0/0.5.2-create-internaldicontainergo.md delete mode 100644 docs/content/stories/phase0/0.5.3-create-cmdplatformmaingo-skeleton.md create mode 100644 docs/content/stories/phase1/1.1-enhanced-di-container.md delete mode 100644 docs/content/stories/phase1/1.1.1-extend-internaldicontainergo.md delete mode 100644 docs/content/stories/phase1/1.1.2-create-internaldiprovidersgo.md delete mode 100644 docs/content/stories/phase1/1.1.3-add-internaldicore_modulego.md create mode 100644 docs/content/stories/phase1/1.2-database-layer.md delete mode 100644 docs/content/stories/phase1/1.2.1-install-entgoioentcmdent.md delete mode 100644 docs/content/stories/phase1/1.2.2-initialize-ent-schema.md delete mode 100644 docs/content/stories/phase1/1.2.3-define-core-entities-in-internalentschema.md delete mode 100644 docs/content/stories/phase1/1.2.4-generate-ent-code-go-generate-internalent.md delete mode 100644 docs/content/stories/phase1/1.2.5-create-internalinfradatabaseclientgo.md delete mode 100644 docs/content/stories/phase1/1.2.6-add-database-config-to-configdefaultyaml.md create mode 100644 docs/content/stories/phase1/1.3-health-metrics-system.md delete mode 100644 docs/content/stories/phase1/1.3.1-install-githubcomprometheusclient_golangprometheus.md delete mode 100644 docs/content/stories/phase1/1.3.2-install-githubcomheptiolabshealthcheck-optional-or.md delete mode 100644 docs/content/stories/phase1/1.3.3-create-pkghealthhealthgo-interface.md delete mode 100644 docs/content/stories/phase1/1.3.4-implement-internalhealthregistrygo.md delete mode 100644 docs/content/stories/phase1/1.3.5-create-internalmetricsmetricsgo.md delete mode 100644 docs/content/stories/phase1/1.3.6-add-metrics-endpoint-prometheus-format.md delete mode 100644 docs/content/stories/phase1/1.3.7-register-endpoints-in-main-http-router.md create mode 100644 docs/content/stories/phase1/1.4-error-handling.md delete mode 100644 docs/content/stories/phase1/1.4.1-create-pkgerrorbuserrorbusgo-interface.md delete mode 100644 docs/content/stories/phase1/1.4.2-implement-internalerrorbuschannel_busgo.md delete mode 100644 docs/content/stories/phase1/1.4.3-add-panic-recovery-middleware-that-publishes-to-er.md delete mode 100644 docs/content/stories/phase1/1.4.4-register-error-bus-in-di-container.md create mode 100644 docs/content/stories/phase1/1.5-http-server.md delete mode 100644 docs/content/stories/phase1/1.5.1-install-githubcomgin-gonicgin.md delete mode 100644 docs/content/stories/phase1/1.5.2-create-internalserverservergo.md delete mode 100644 docs/content/stories/phase1/1.5.3-wire-http-server-into-fx-lifecycle.md delete mode 100644 docs/content/stories/phase1/1.5.4-update-cmdplatformmaingo-to-use-fx-lifecycle.md create mode 100644 docs/content/stories/phase1/1.6-opentelemetry.md delete mode 100644 docs/content/stories/phase1/1.6.1-install-opentelemetry-packages.md delete mode 100644 docs/content/stories/phase1/1.6.2-create-internalobservabilitytracergo.md delete mode 100644 docs/content/stories/phase1/1.6.3-add-http-instrumentation-middleware.md delete mode 100644 docs/content/stories/phase1/1.6.4-add-trace-context-propagation-to-requests.md create mode 100644 docs/content/stories/phase1/1.7-service-abstraction-layer.md create mode 100644 docs/content/stories/phase2/2.1-jwt-authentication.md delete mode 100644 docs/content/stories/phase2/2.1.1-install-githubcomgolang-jwtjwtv5.md delete mode 100644 docs/content/stories/phase2/2.1.2-create-pkgauthauthgo-interfaces.md delete mode 100644 docs/content/stories/phase2/2.1.3-implement-internalauthjwt_authgo.md delete mode 100644 docs/content/stories/phase2/2.1.4-create-internalauthmiddlewarego.md delete mode 100644 docs/content/stories/phase2/2.1.5-add-login-endpoint-post-apiv1authlogin.md delete mode 100644 docs/content/stories/phase2/2.1.6-add-refresh-endpoint-post-apiv1authrefresh.md create mode 100644 docs/content/stories/phase2/2.2-identity-management.md delete mode 100644 docs/content/stories/phase2/2.2.1-create-pkgidentityidentitygo-interfaces.md delete mode 100644 docs/content/stories/phase2/2.2.2-implement-internalidentityuser_repogo-using-ent.md delete mode 100644 docs/content/stories/phase2/2.2.3-implement-internalidentityuser_servicego.md delete mode 100644 docs/content/stories/phase2/2.2.4-add-endpoints.md create mode 100644 docs/content/stories/phase2/2.3-rbac-system.md delete mode 100644 docs/content/stories/phase2/2.3.1-create-pkgpermpermgo.md delete mode 100644 docs/content/stories/phase2/2.3.2-create-pkgpermresolvergo-interface.md delete mode 100644 docs/content/stories/phase2/2.3.3-implement-internalpermin_memory_resolvergo.md delete mode 100644 docs/content/stories/phase2/2.3.4-create-pkgauthauthzgo-interface.md delete mode 100644 docs/content/stories/phase2/2.3.5-implement-internalauthrbac_authorizergo.md delete mode 100644 docs/content/stories/phase2/2.3.6-create-authorization-middleware.md create mode 100644 docs/content/stories/phase2/2.4-role-management.md delete mode 100644 docs/content/stories/phase2/2.4.1-create-internalidentityrole_repogo.md delete mode 100644 docs/content/stories/phase2/2.4.2-add-endpoints.md create mode 100644 docs/content/stories/phase2/2.5-audit-logging.md delete mode 100644 docs/content/stories/phase2/2.5.1-create-pkgauditauditgo-interface.md delete mode 100644 docs/content/stories/phase2/2.5.2-implement-internalauditent_auditorgo.md delete mode 100644 docs/content/stories/phase2/2.5.3-add-audit-middleware.md delete mode 100644 docs/content/stories/phase2/2.5.4-integrate-with-auth-endpoints.md create mode 100644 docs/content/stories/phase2/2.6-database-seeding.md delete mode 100644 docs/content/stories/phase2/2.6.1-create-internalseedseedgo.md create mode 100644 docs/content/stories/phase3/3.1-module-system-interface.md delete mode 100644 docs/content/stories/phase3/3.1.1-create-pkgmodulemodulego.md delete mode 100644 docs/content/stories/phase3/3.1.2-create-pkgmodulemanifestgo.md delete mode 100644 docs/content/stories/phase3/3.1.3-define-moduleyaml-schema-used-for-code-generation.md create mode 100644 docs/content/stories/phase3/3.2-permission-code-generation.md delete mode 100644 docs/content/stories/phase3/3.2.1-create-internalregistryregistrygo.md delete mode 100644 docs/content/stories/phase3/3.2.2-add-registration-validation.md create mode 100644 docs/content/stories/phase3/3.3-module-loader.md delete mode 100644 docs/content/stories/phase3/3.3.1-create-scriptsgenerate-permissionsgo.md delete mode 100644 docs/content/stories/phase3/3.3.2-add-gogenerate-directive-to-pkgpermpermgo.md delete mode 100644 docs/content/stories/phase3/3.3.3-update-makefile-with-make-generate-command.md create mode 100644 docs/content/stories/phase3/3.4-module-cli.md delete mode 100644 docs/content/stories/phase3/3.4.1-create-internalpluginloaderloadergo.md delete mode 100644 docs/content/stories/phase3/3.4.2-implement-internalpluginloaderstatic_loadergo.md delete mode 100644 docs/content/stories/phase3/3.4.3-implement-internalpluginloaderplugin_loadergo-opti.md create mode 100644 docs/content/stories/phase3/3.5-service-registry.md delete mode 100644 docs/content/stories/phase3/3.5.1-create-internalmoduleinitializergo.md delete mode 100644 docs/content/stories/phase3/3.5.2-run-migrations.md delete mode 100644 docs/content/stories/phase3/3.6.1-extend-pkgmodulemodulego.md delete mode 100644 docs/content/stories/phase3/3.6.2-integrate-with-fxlifecycle.md delete mode 100644 docs/content/stories/phase3/3.7.1-create-cmdplatformctlmaingo.md delete mode 100644 docs/content/stories/phase3/3.7.2-add-to-makefile-make-install-cli.md create mode 100644 docs/content/stories/phase4/4.1-blog-module.md delete mode 100644 docs/content/stories/phase4/4.1.1-create-modulesblog-directory.md delete mode 100644 docs/content/stories/phase4/4.1.2-initialize-gomod.md delete mode 100644 docs/content/stories/phase4/4.2.1-create-modulesblogmoduleyaml.md delete mode 100644 docs/content/stories/phase4/4.3.1-create-modulesbloginternaldomainpostgo.md delete mode 100644 docs/content/stories/phase4/4.3.2-create-ent-schema-modulesbloginternalentschemapost.md delete mode 100644 docs/content/stories/phase4/4.3.3-generate-ent-code-for-blog-module.md delete mode 100644 docs/content/stories/phase4/4.4.1-create-modulesbloginternaldomainpost_repogo.md delete mode 100644 docs/content/stories/phase4/4.4.2-implement-using-ent-client-shared-from-core.md delete mode 100644 docs/content/stories/phase4/4.5.1-create-modulesbloginternalservicepost_servicego.md delete mode 100644 docs/content/stories/phase4/4.6.1-create-modulesbloginternalapihandlergo.md delete mode 100644 docs/content/stories/phase4/4.6.2-use-authorization-middleware.md delete mode 100644 docs/content/stories/phase4/4.6.3-register-handlers-in-modules-init.md delete mode 100644 docs/content/stories/phase4/4.7.1-create-modulesblogpkgmodulego.md delete mode 100644 docs/content/stories/phase4/4.8.1-update-main-gomod-to-include-blog-module.md delete mode 100644 docs/content/stories/phase4/4.8.2-import-blog-module-in-cmdplatformmaingo.md delete mode 100644 docs/content/stories/phase4/4.8.3-run-permission-generation-make-generate.md delete mode 100644 docs/content/stories/phase4/4.8.4-verify-blog-permissions-are-generated.md delete mode 100644 docs/content/stories/phase4/4.9.1-create-integration-test-modulesbloginternalapihand.md delete mode 100644 docs/content/stories/phase4/4.9.2-add-unit-tests-for-service-and-repository.md create mode 100644 docs/content/stories/phase5/5.1-cache-system.md delete mode 100644 docs/content/stories/phase5/5.1.1-install-githubcomredisgo-redisv9.md delete mode 100644 docs/content/stories/phase5/5.1.2-create-pkginfracachecachego-interface.md delete mode 100644 docs/content/stories/phase5/5.1.3-implement-internalinfracacheredis_cachego.md delete mode 100644 docs/content/stories/phase5/5.1.4-add-redis-config-to-configdefaultyaml.md delete mode 100644 docs/content/stories/phase5/5.1.5-register-in-di-container.md delete mode 100644 docs/content/stories/phase5/5.1.6-add-cache-middleware-for-selected-routes-optional.md create mode 100644 docs/content/stories/phase5/5.2-event-bus.md delete mode 100644 docs/content/stories/phase5/5.2.1-create-pkgeventbuseventbusgo-interface.md delete mode 100644 docs/content/stories/phase5/5.2.2-implement-internalinfrabusinprocess_busgo.md delete mode 100644 docs/content/stories/phase5/5.2.3-implement-internalinfrabuskafka_busgo.md delete mode 100644 docs/content/stories/phase5/5.2.4-add-kafka-config-to-configdefaultyaml.md delete mode 100644 docs/content/stories/phase5/5.2.5-register-bus-in-di-container-switchable-via-config.md delete mode 100644 docs/content/stories/phase5/5.2.6-add-core-events.md create mode 100644 docs/content/stories/phase5/5.3-blob-storage.md delete mode 100644 docs/content/stories/phase5/5.3.1-install-githubcomawsaws-sdk-go-v2services3.md delete mode 100644 docs/content/stories/phase5/5.3.2-create-pkginfrablobblobgo-interface.md delete mode 100644 docs/content/stories/phase5/5.3.3-implement-internalinfrablobs3_storego.md delete mode 100644 docs/content/stories/phase5/5.3.4-add-s3-config-to-configdefaultyaml.md delete mode 100644 docs/content/stories/phase5/5.3.5-register-in-di-container.md delete mode 100644 docs/content/stories/phase5/5.3.6-add-file-upload-endpoint-post-apiv1filesupload.md create mode 100644 docs/content/stories/phase5/5.4-email-notification.md delete mode 100644 docs/content/stories/phase5/5.4.1-install-githubcomgo-mailmail.md delete mode 100644 docs/content/stories/phase5/5.4.2-create-pkgnotificationnotificationgo-interface.md delete mode 100644 docs/content/stories/phase5/5.4.3-implement-internalinfraemailsmtp_notifiergo.md delete mode 100644 docs/content/stories/phase5/5.4.4-add-email-config-to-configdefaultyaml.md delete mode 100644 docs/content/stories/phase5/5.4.5-integrate-with-identity-service.md delete mode 100644 docs/content/stories/phase5/5.4.6-register-in-di-container.md create mode 100644 docs/content/stories/phase5/5.5-scheduler-jobs.md delete mode 100644 docs/content/stories/phase5/5.5.1-install-githubcomrobfigcronv3-and-githubcomhibiken.md delete mode 100644 docs/content/stories/phase5/5.5.2-create-pkgschedulerschedulergo-interface.md delete mode 100644 docs/content/stories/phase5/5.5.3-implement-internalinfraschedulerasynq_schedulergo.md delete mode 100644 docs/content/stories/phase5/5.5.4-create-internalinfraschedulerjob_registrygo.md delete mode 100644 docs/content/stories/phase5/5.5.5-add-example-jobs.md delete mode 100644 docs/content/stories/phase5/5.5.6-add-job-monitoring-endpoint-get-apiv1jobsstatus.md create mode 100644 docs/content/stories/phase5/5.6-secret-store.md delete mode 100644 docs/content/stories/phase5/5.6.1-create-pkginfrasecretsecretgo-interface.md delete mode 100644 docs/content/stories/phase5/5.6.2-implement-internalinfrasecretvault_storego-hashico.md delete mode 100644 docs/content/stories/phase5/5.6.3-implement-internalinfrasecretaws_secretsgo-aws-sec.md delete mode 100644 docs/content/stories/phase5/5.6.4-integrate-with-config-loader.md delete mode 100644 docs/content/stories/phase5/5.6.5-register-in-di-container-optional-via-config.md create mode 100644 docs/content/stories/phase5/5.7-grpc-services.md delete mode 100644 docs/content/stories/phase5/5.7.1-create-pkgtenanttenantgo-interface.md delete mode 100644 docs/content/stories/phase5/5.7.2-implement-internaltenantresolvergo.md delete mode 100644 docs/content/stories/phase5/5.7.3-add-tenant-middleware.md delete mode 100644 docs/content/stories/phase5/5.7.4-update-ent-queries-to-filter-by-tenant_id.md delete mode 100644 docs/content/stories/phase5/5.7.5-update-user-entity-to-include-tenant_id.md create mode 100644 docs/content/stories/phase6/6.1-enhanced-observability.md delete mode 100644 docs/content/stories/phase6/6.1.1-complete-opentelemetry-setup.md delete mode 100644 docs/content/stories/phase6/6.1.2-create-custom-spans.md delete mode 100644 docs/content/stories/phase6/6.1.3-add-trace-context-propagation.md create mode 100644 docs/content/stories/phase6/6.2-error-reporting.md delete mode 100644 docs/content/stories/phase6/6.2.1-install-githubcomgetsentrysentry-go.md delete mode 100644 docs/content/stories/phase6/6.2.2-integrate-with-error-bus.md delete mode 100644 docs/content/stories/phase6/6.2.3-add-sentry-middleware.md delete mode 100644 docs/content/stories/phase6/6.2.4-configure-sentry-dsn-via-config.md create mode 100644 docs/content/stories/phase6/6.3-grafana-dashboards.md delete mode 100644 docs/content/stories/phase6/6.3.1-add-request-correlation.md delete mode 100644 docs/content/stories/phase6/6.3.2-add-structured-fields.md delete mode 100644 docs/content/stories/phase6/6.3.3-create-log-aggregation-config.md create mode 100644 docs/content/stories/phase6/6.4-rate-limiting.md delete mode 100644 docs/content/stories/phase6/6.4.1-add-more-metrics.md delete mode 100644 docs/content/stories/phase6/6.4.2-create-metric-labels.md create mode 100644 docs/content/stories/phase6/6.5-security-hardening.md delete mode 100644 docs/content/stories/phase6/6.5.1-create-opsgrafanadashboards.md delete mode 100644 docs/content/stories/phase6/6.5.2-document-dashboard-setup-in-docsoperationsmd.md create mode 100644 docs/content/stories/phase6/6.6-performance-optimization.md delete mode 100644 docs/content/stories/phase6/6.6.1-install-githubcomululelimiterv3.md delete mode 100644 docs/content/stories/phase6/6.6.2-create-rate-limit-middleware.md delete mode 100644 docs/content/stories/phase6/6.6.3-add-rate-limit-config.md delete mode 100644 docs/content/stories/phase6/6.6.4-return-x-ratelimit--headers.md delete mode 100644 docs/content/stories/phase6/6.7.1-add-security-headers-middleware.md delete mode 100644 docs/content/stories/phase6/6.7.2-add-request-size-limits.md delete mode 100644 docs/content/stories/phase6/6.7.3-add-input-validation.md delete mode 100644 docs/content/stories/phase6/6.7.4-add-sql-injection-protection.md delete mode 100644 docs/content/stories/phase6/6.8.1-add-database-connection-pooling.md delete mode 100644 docs/content/stories/phase6/6.8.2-add-query-optimization.md delete mode 100644 docs/content/stories/phase6/6.8.3-add-response-compression.md delete mode 100644 docs/content/stories/phase6/6.8.4-add-caching-strategy.md create mode 100644 docs/content/stories/phase7/7.1-testing-suite.md delete mode 100644 docs/content/stories/phase7/7.1.1-achieve-80-code-coverage-for-core-modules.md delete mode 100644 docs/content/stories/phase7/7.1.2-use-githubcomstretchrtestify-for-assertions.md delete mode 100644 docs/content/stories/phase7/7.1.3-use-githubcomgolangmock-or-mockery-for-mocks.md delete mode 100644 docs/content/stories/phase7/7.1.4-add-test-helpers.md create mode 100644 docs/content/stories/phase7/7.2-documentation.md delete mode 100644 docs/content/stories/phase7/7.2.1-install-githubcomtestcontainerstestcontainers-go.md delete mode 100644 docs/content/stories/phase7/7.2.2-create-integration-test-suite.md delete mode 100644 docs/content/stories/phase7/7.2.3-test-scenarios.md delete mode 100644 docs/content/stories/phase7/7.2.4-create-docker-composetestyml.md delete mode 100644 docs/content/stories/phase7/7.2.5-add-test-tags-gobuild-integration.md create mode 100644 docs/content/stories/phase7/7.3-cicd-enhancement.md delete mode 100644 docs/content/stories/phase7/7.3.1-install-githubcompact-foundationpact-go-optional.md delete mode 100644 docs/content/stories/phase7/7.3.2-create-api-contract-tests.md delete mode 100644 docs/content/stories/phase7/7.3.3-use-openapi-validator.md create mode 100644 docs/content/stories/phase7/7.4-docker-deployment.md delete mode 100644 docs/content/stories/phase7/7.4.1-create-perf-directory-with-k6-scripts.md delete mode 100644 docs/content/stories/phase7/7.4.2-document-performance-benchmarks.md delete mode 100644 docs/content/stories/phase7/7.5.1-create-readmemd.md delete mode 100644 docs/content/stories/phase7/7.5.2-create-docsarchitecturemd.md delete mode 100644 docs/content/stories/phase7/7.5.3-create-docsextension-pointsmd.md delete mode 100644 docs/content/stories/phase7/7.5.4-create-docsapimd.md delete mode 100644 docs/content/stories/phase7/7.5.5-create-docsoperationsmd.md delete mode 100644 docs/content/stories/phase7/7.5.6-add-code-examples.md delete mode 100644 docs/content/stories/phase7/7.6.1-update-githubworkflowsciyml.md delete mode 100644 docs/content/stories/phase7/7.6.2-add-release-workflow.md delete mode 100644 docs/content/stories/phase7/7.6.3-add-security-scanning.md delete mode 100644 docs/content/stories/phase7/7.7.1-create-multi-stage-dockerfile.md delete mode 100644 docs/content/stories/phase7/7.7.2-create-docker-composeyml-for-development.md delete mode 100644 docs/content/stories/phase7/7.7.3-create-docker-composeprodyml-for-production.md delete mode 100644 docs/content/stories/phase7/7.7.4-add-health-checks-to-dockerfile.md delete mode 100644 docs/content/stories/phase7/7.7.5-document-docker-usage-in-docsdeploymentmd.md delete mode 100644 docs/content/stories/phase7/7.8.1-create-docsdeploymentkubernetesmd.md delete mode 100644 docs/content/stories/phase7/7.8.2-create-docsdeploymentdockermd.md delete mode 100644 docs/content/stories/phase7/7.8.3-create-docsdeploymentcloudmd.md delete mode 100644 docs/content/stories/phase7/7.9.1-create-makefile-with-common-tasks.md delete mode 100644 docs/content/stories/phase7/7.9.2-add-development-scripts.md delete mode 100644 docs/content/stories/phase7/7.9.3-create-envexample-with-all-config-variables.md delete mode 100644 docs/content/stories/phase7/7.9.4-add-pre-commit-hooks-optional.md create mode 100644 docs/content/stories/phase8/8.1-oidc-support.md delete mode 100644 docs/content/stories/phase8/8.1.1-install-githubcomcoreosgo-oidc.md delete mode 100644 docs/content/stories/phase8/8.1.2-implement-oidc-provider.md delete mode 100644 docs/content/stories/phase8/8.1.3-add-oidc-client-support.md delete mode 100644 docs/content/stories/phase8/8.1.4-document-oidc-setup-in-docsauthmd.md create mode 100644 docs/content/stories/phase8/8.2-graphql-api.md delete mode 100644 docs/content/stories/phase8/8.2.1-install-githubcom99designsgqlgen.md delete mode 100644 docs/content/stories/phase8/8.2.2-create-graphql-schema.md delete mode 100644 docs/content/stories/phase8/8.2.3-implement-resolvers.md delete mode 100644 docs/content/stories/phase8/8.2.4-add-graphql-endpoint-post-graphql.md create mode 100644 docs/content/stories/phase8/8.3-additional-modules.md delete mode 100644 docs/content/stories/phase8/8.3.1-add-requestresponse-transformation.md delete mode 100644 docs/content/stories/phase8/8.3.2-add-api-key-authentication.md delete mode 100644 docs/content/stories/phase8/8.3.3-add-request-routing-rules.md delete mode 100644 docs/content/stories/phase8/8.3.4-add-api-versioning-support.md create mode 100644 docs/content/stories/phase8/8.4-final-polish.md delete mode 100644 docs/content/stories/phase8/8.4.1-create-modulesnotification.md delete mode 100644 docs/content/stories/phase8/8.4.2-create-modulesanalytics.md delete mode 100644 docs/content/stories/phase8/8.5.1-add-database-query-caching.md delete mode 100644 docs/content/stories/phase8/8.5.2-optimize-n1-queries.md delete mode 100644 docs/content/stories/phase8/8.5.3-add-response-caching-redis.md delete mode 100644 docs/content/stories/phase8/8.5.4-implement-connection-pooling-optimizations.md delete mode 100644 docs/content/stories/phase8/8.5.5-add-database-read-replicas-support.md delete mode 100644 docs/content/stories/phase8/8.6.1-install-i18n-library.md delete mode 100644 docs/content/stories/phase8/8.6.2-add-locale-detection.md delete mode 100644 docs/content/stories/phase8/8.6.3-create-message-catalogs.md delete mode 100644 docs/content/stories/phase8/8.6.4-add-translation-support-for-error-messages.md delete mode 100644 docs/content/stories/phase8/8.7.1-code-review-and-refactoring.md delete mode 100644 docs/content/stories/phase8/8.7.10-di-setup.md delete mode 100644 docs/content/stories/phase8/8.7.11-di-container.md delete mode 100644 docs/content/stories/phase8/8.7.12-database-ent.md delete mode 100644 docs/content/stories/phase8/8.7.13-health--metrics.md delete mode 100644 docs/content/stories/phase8/8.7.14-error-bus.md delete mode 100644 docs/content/stories/phase8/8.7.15-http-server.md delete mode 100644 docs/content/stories/phase8/8.7.16-opentelemetry.md delete mode 100644 docs/content/stories/phase8/8.7.17-jwt-authentication.md delete mode 100644 docs/content/stories/phase8/8.7.18-identity-management.md delete mode 100644 docs/content/stories/phase8/8.7.19-roles--permissions.md delete mode 100644 docs/content/stories/phase8/8.7.2-bug-fixes.md delete mode 100644 docs/content/stories/phase8/8.7.20-authorization-middleware.md delete mode 100644 docs/content/stories/phase8/8.7.21-audit-logging.md delete mode 100644 docs/content/stories/phase8/8.7.22-module-interface.md delete mode 100644 docs/content/stories/phase8/8.7.23-static-registry.md delete mode 100644 docs/content/stories/phase8/8.7.24-permission-generation.md delete mode 100644 docs/content/stories/phase8/8.7.25-module-loader.md delete mode 100644 docs/content/stories/phase8/8.7.26-module-initialization.md delete mode 100644 docs/content/stories/phase8/8.7.27-blog-module-structure.md delete mode 100644 docs/content/stories/phase8/8.7.28-domain-model.md delete mode 100644 docs/content/stories/phase8/8.7.29-repository--service.md delete mode 100644 docs/content/stories/phase8/8.7.3-performance-profiling.md delete mode 100644 docs/content/stories/phase8/8.7.30-api-handlers.md delete mode 100644 docs/content/stories/phase8/8.7.31-integration-tests.md delete mode 100644 docs/content/stories/phase8/8.7.32-cache-redis.md delete mode 100644 docs/content/stories/phase8/8.7.33-event-bus.md delete mode 100644 docs/content/stories/phase8/8.7.34-blob-storage.md delete mode 100644 docs/content/stories/phase8/8.7.35-email-notification.md delete mode 100644 docs/content/stories/phase8/8.7.36-schedulerjobs.md delete mode 100644 docs/content/stories/phase8/8.7.37-multi-tenancy-optional.md delete mode 100644 docs/content/stories/phase8/8.7.38-opentelemetry.md delete mode 100644 docs/content/stories/phase8/8.7.39-sentry-integration.md delete mode 100644 docs/content/stories/phase8/8.7.4-security-audit.md delete mode 100644 docs/content/stories/phase8/8.7.40-enhanced-logging.md delete mode 100644 docs/content/stories/phase8/8.7.41-prometheus-metrics.md delete mode 100644 docs/content/stories/phase8/8.7.42-grafana-dashboards.md delete mode 100644 docs/content/stories/phase8/8.7.43-rate-limiting.md delete mode 100644 docs/content/stories/phase8/8.7.44-security-hardening.md delete mode 100644 docs/content/stories/phase8/8.7.45-unit-tests-80-coverage.md delete mode 100644 docs/content/stories/phase8/8.7.46-integration-tests.md delete mode 100644 docs/content/stories/phase8/8.7.47-documentation.md delete mode 100644 docs/content/stories/phase8/8.7.48-cicd-pipeline.md delete mode 100644 docs/content/stories/phase8/8.7.49-docker-images.md delete mode 100644 docs/content/stories/phase8/8.7.5-documentation-review.md delete mode 100644 docs/content/stories/phase8/8.7.50-deployment-guides.md delete mode 100644 docs/content/stories/phase8/8.7.51-oidc-support.md delete mode 100644 docs/content/stories/phase8/8.7.52-graphql-api.md delete mode 100644 docs/content/stories/phase8/8.7.53-additional-modules.md delete mode 100644 docs/content/stories/phase8/8.7.54-performance-optimization.md delete mode 100644 docs/content/stories/phase8/8.7.6-repository-structure.md delete mode 100644 docs/content/stories/phase8/8.7.7-configuration-system.md delete mode 100644 docs/content/stories/phase8/8.7.8-logging-foundation.md delete mode 100644 docs/content/stories/phase8/8.7.9-basic-cicd.md diff --git a/docs/content/adr/0029-microservices-architecture.md b/docs/content/adr/0029-microservices-architecture.md new file mode 100644 index 0000000..9de1101 --- /dev/null +++ b/docs/content/adr/0029-microservices-architecture.md @@ -0,0 +1,87 @@ +# ADR-0029: Microservices Architecture + +## Status +Accepted + +## Context +The platform needs to scale independently, support team autonomy, and enable flexible deployment. A microservices architecture provides these benefits from day one, and the complexity of supporting both monolith and microservices modes is unnecessary. + +## Decision +Design the platform as **microservices architecture from day one**: + +1. **Service-Based Architecture**: All modules are independent services: + - Each module is a separate service with its own process + - Services communicate via gRPC (primary) or HTTP (fallback) + - Service client interfaces for all inter-service communication + - No direct in-process calls between services + +2. **Service Registry**: Central registry for service discovery: + - All services register on startup + - Service discovery via registry + - Health checking and automatic deregistration + - Support for Consul, etcd, or Kubernetes service discovery + +3. **Communication Patterns**: + - **Synchronous**: gRPC service calls (primary), HTTP/REST (fallback) + - **Asynchronous**: Event bus via Kafka + - **Shared State**: Cache (Redis) and Database (PostgreSQL) + +4. **Service Boundaries**: Each module is an independent service: + - Independent Go modules (`go.mod`) + - Own database schema (via Ent) + - Own API routes + - Own process and deployment + - Can be scaled independently + +5. **Development Simplification**: For local development, multiple services can run in the same process, but they still communicate via service clients (no direct calls) + +## Consequences + +### Positive +- **Simplified Architecture**: Single architecture pattern, no dual-mode complexity +- **Independent Scaling**: Scale individual services based on load +- **Team Autonomy**: Teams can own and deploy their services independently +- **Technology Diversity**: Different services can use different tech stacks (future) +- **Fault Isolation**: Failure in one service doesn't bring down entire platform +- **Deployment Flexibility**: Deploy services independently +- **Clear Boundaries**: Service boundaries are explicit from the start + +### Negative +- **Network Latency**: Inter-service calls have network overhead +- **Distributed System Challenges**: Need to handle network failures, retries, timeouts +- **Service Discovery Overhead**: Additional infrastructure needed +- **Debugging Complexity**: Distributed tracing becomes essential +- **Data Consistency**: Cross-service transactions become challenging +- **Development Setup**: More complex local development (multiple services) + +### Mitigations +- **Service Mesh**: Use service mesh (Istio, Linkerd) for advanced microservices features +- **API Gateway**: Central gateway for routing and cross-cutting concerns +- **Event Sourcing**: Use events for eventual consistency +- **Circuit Breakers**: Implement circuit breakers for resilience +- **Comprehensive Observability**: OpenTelemetry, metrics, logging essential +- **Docker Compose**: Simplify local development with docker-compose +- **Development Mode**: Run multiple services in same process for local dev (still use service clients) + +## Implementation Strategy + +### Phase 1: Service Client Interfaces (Phase 1) +- Define service client interfaces for all core services +- All inter-service communication goes through interfaces + +### Phase 2: Service Registry (Phase 3) +- Create service registry interface +- Implement service discovery +- Support for Consul, Kubernetes service discovery + +### Phase 3: gRPC Services (Phase 5) +- Implement gRPC service definitions +- Create gRPC servers for all services +- Create gRPC clients for service communication +- HTTP clients as fallback option + +## References +- [Service Abstraction Pattern](https://microservices.io/patterns/data/service-per-database.html) +- [Service Discovery Patterns](https://microservices.io/patterns/service-registry.html) +- [gRPC Documentation](https://grpc.io/docs/) + diff --git a/docs/content/adr/0030-service-communication-strategy.md b/docs/content/adr/0030-service-communication-strategy.md new file mode 100644 index 0000000..ce08c1e --- /dev/null +++ b/docs/content/adr/0030-service-communication-strategy.md @@ -0,0 +1,73 @@ +# ADR-0030: Service Communication Strategy + +## Status +Accepted + +## Context +Services need to communicate with each other in a microservices architecture. All communication must go through well-defined interfaces that support network calls. + +## Decision +Use a **service client-based communication strategy**: + +1. **Service Client Interfaces** (Primary for synchronous calls): + - Define interfaces in `pkg/services/` for all services + - All implementations are network-based: + - `internal/services/grpc/client/` - gRPC clients (primary) + - `internal/services/http/client/` - HTTP clients (fallback) + +2. **Event Bus** (Primary for asynchronous communication): + - Distributed via Kafka + - Preferred for cross-service communication + - Event-driven architecture for loose coupling + +3. **Shared Infrastructure** (For state): + - Redis for cache and distributed state + - PostgreSQL for persistent data + - Kafka for events + +## Service Client Pattern + +```go +// Interface in pkg/services/ +type IdentityServiceClient interface { + GetUser(ctx context.Context, id string) (*User, error) + CreateUser(ctx context.Context, user *User) (*User, error) +} + +// gRPC implementation (primary) +type grpcIdentityClient struct { + conn *grpc.ClientConn + client pb.IdentityServiceClient +} + +// HTTP implementation (fallback) +type httpIdentityClient struct { + baseURL string + httpClient *http.Client +} +``` + +## Development Mode +For local development, multiple services can run in the same process, but they still communicate via service clients (gRPC or HTTP) - no direct in-process calls. This ensures the architecture is consistent. + +## Consequences + +### Positive +- **Unified Interface**: Consistent interface across all services +- **Easy Testing**: Can mock service clients +- **Type Safety**: gRPC provides type-safe contracts +- **Clear Boundaries**: Service boundaries are explicit +- **Scalability**: Services can be scaled independently + +### Negative +- **Network Overhead**: All calls go over network +- **Interface Evolution**: Changes require coordination +- **Versioning**: Need service versioning strategy +- **Development Complexity**: More setup required for local development + +## Implementation +- All services use gRPC clients (primary) +- HTTP clients as fallback option +- Service registry for service discovery +- Circuit breakers and retries for resilience + diff --git a/docs/content/adr/README.md b/docs/content/adr/README.md index 18fa212..2c5ab0b 100644 --- a/docs/content/adr/README.md +++ b/docs/content/adr/README.md @@ -69,6 +69,11 @@ Each ADR follows this structure: - [ADR-0028: Testing Strategy](./0028-testing-strategy.md) - Multi-layered (unit, integration, contract, load) +### Architecture & Scaling + +- [ADR-0029: Microservices Architecture](./0029-microservices-architecture.md) - Microservices architecture from day one +- [ADR-0030: Service Communication Strategy](./0030-service-communication-strategy.md) - Service client abstraction and communication patterns + ## Adding New ADRs When making a new architectural decision: diff --git a/docs/content/architecture-modules.md b/docs/content/architecture-modules.md index 264f1a1..41eec7f 100644 --- a/docs/content/architecture-modules.md +++ b/docs/content/architecture-modules.md @@ -264,45 +264,54 @@ graph LR ## Module Communication -Modules communicate through well-defined interfaces provided by the core platform. +Modules (services) communicate through service client interfaces. All inter-service communication uses gRPC (primary) or HTTP (fallback). ### Communication Patterns ```mermaid graph TB subgraph "Communication Patterns" - Direct[Direct Service Calls
via DI] - Events[Event Bus
Publish/Subscribe] - Shared[Shared Interfaces
Core Services] + ServiceClients[Service Clients
gRPC/HTTP] + Events[Event Bus
Kafka] + Shared[Shared Infrastructure
Redis, PostgreSQL] end - subgraph "Module A" - AService[Service A] - AHandler[Handler A] + subgraph "Blog Service" + BlogService[Blog Service] + BlogHandler[Blog Handler] + end + + subgraph "Service Clients" + AuthClient[Auth Service Client] + IdentityClient[Identity Service Client] + AuthzClient[Authz Service Client] end subgraph "Core Services" EventBus[Event Bus] - AuthService[Auth Service] - CacheService[Cache Service] + AuthService[Auth Service
:8081] + IdentityService[Identity Service
:8082] end - subgraph "Module B" - BService[Service B] - BHandler[Handler B] + subgraph "Analytics Service" + AnalyticsService[Analytics Service] end - AHandler --> AService - AService --> AuthService - AService --> CacheService - AService -->|Publish| EventBus - EventBus -->|Subscribe| BService - BService --> AuthService - BHandler --> BService + BlogHandler --> BlogService + BlogService -->|gRPC| AuthClient + BlogService -->|gRPC| IdentityClient + BlogService -->|gRPC| AuthzClient + BlogService -->|Publish| EventBus + EventBus -->|Subscribe| AnalyticsService + + AuthClient --> AuthService + IdentityClient --> IdentityService + AuthzClient --> IdentityService style EventBus fill:#4a90e2,stroke:#2e5c8a,stroke-width:3px,color:#fff - style AService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff - style BService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff + style BlogService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff + style AnalyticsService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff + style ServiceClients fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff ``` ### Event-Driven Communication @@ -412,25 +421,30 @@ graph TB PostEntity[Post Entity] end - subgraph "Core Services Used" - AuthService[Auth Service] - AuthzService[Authorization Service] - EventBus[Event Bus] - AuditService[Audit Service] - CacheService[Cache Service] + subgraph "Service Clients" + AuthClient[Auth Service Client
gRPC] + AuthzClient[Authz Service Client
gRPC] + IdentityClient[Identity Service Client
gRPC] + AuditClient[Audit Service Client
gRPC] + end + + subgraph "Core Services" + EventBus[Event Bus
Kafka] + CacheService[Cache Service
Redis] end subgraph "Database" PostsTable[(blog_posts)] end - BlogHandler --> AuthService - BlogHandler --> AuthzService BlogHandler --> BlogService + BlogService -->|gRPC| AuthClient + BlogService -->|gRPC| AuthzClient + BlogService -->|gRPC| IdentityClient + BlogService -->|gRPC| AuditClient BlogService --> PostRepo BlogService --> EventBus - BlogService --> AuditService BlogService --> CacheService PostRepo --> PostsTable @@ -454,9 +468,15 @@ graph LR DB[(Database)] end + subgraph "Service Clients" + AuthClient[Auth Service Client] + IdentityClient[Identity Service Client] + AuthzClient[Authz Service Client] + end + subgraph "Side Effects" EventBus[Event Bus] - Audit[Audit Log] + AuditClient[Audit Service Client] Cache[Cache] end @@ -467,12 +487,16 @@ graph LR Service --> Repo Repo --> DB + Service -->|gRPC| AuthClient + Service -->|gRPC| IdentityClient + Service -->|gRPC| AuthzClient + Service -->|gRPC| AuditClient Service --> EventBus - Service --> Audit Service --> Cache style Request fill:#4a90e2,stroke:#2e5c8a,stroke-width:2px,color:#fff style Service fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff + style ServiceClients fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff ``` ## Module Registration Flow diff --git a/docs/content/architecture.md b/docs/content/architecture.md index 2a28e70..50bc88f 100644 --- a/docs/content/architecture.md +++ b/docs/content/architecture.md @@ -13,7 +13,12 @@ This document provides a comprehensive overview of the Go Platform architecture, ## High-Level Architecture -The Go Platform follows a **modular monolith** architecture that can evolve into microservices. The platform consists of a core kernel and pluggable feature modules. +The Go Platform follows a **microservices architecture** where each module is an independent service: +- **Core Services**: Authentication, Identity, Authorization, Audit, etc. +- **Feature Services**: Blog, Billing, Analytics, etc. (modules) +- **Infrastructure Services**: Cache, Event Bus, Scheduler, etc. + +All services communicate via gRPC (primary) or HTTP (fallback), with service discovery via a service registry. Services share infrastructure (PostgreSQL, Redis, Kafka) but are independently deployable and scalable. ```mermaid graph TB @@ -581,10 +586,168 @@ graph TB style Module fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff ``` +## Microservices Architecture + +The platform is designed as **microservices from day one**, with each module being an independent service. + +### Service Architecture + +```mermaid +graph TB + subgraph "API Gateway" + Gateway[API Gateway
Routing & Auth] + end + + subgraph "Core Services" + AuthSvc[Auth Service
:8081] + IdentitySvc[Identity Service
:8082] + AuthzSvc[Authz Service
:8083] + AuditSvc[Audit Service
:8084] + end + + subgraph "Feature Services" + BlogSvc[Blog Service
:8091] + BillingSvc[Billing Service
:8092] + AnalyticsSvc[Analytics Service
:8093] + end + + subgraph "Infrastructure" + DB[(PostgreSQL)] + Cache[(Redis)] + Queue[Kafka] + Registry[Service Registry] + end + + Gateway --> AuthSvc + Gateway --> IdentitySvc + Gateway --> BlogSvc + Gateway --> BillingSvc + + AuthSvc --> IdentitySvc + AuthSvc --> Registry + BlogSvc --> AuthzSvc + BlogSvc --> IdentitySvc + BlogSvc --> Registry + BillingSvc --> IdentitySvc + BillingSvc --> Registry + + AuthSvc --> DB + IdentitySvc --> DB + BlogSvc --> DB + BillingSvc --> DB + + AuthSvc --> Cache + BlogSvc --> Cache + BillingSvc --> Cache + + BlogSvc --> Queue + BillingSvc --> Queue + AnalyticsSvc --> Queue + + style Gateway fill:#4a90e2,stroke:#2e5c8a,stroke-width:3px,color:#fff + style Registry fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff +``` + +### Service Communication + +All inter-service communication uses service client interfaces: + +```mermaid +graph TB + subgraph "Service Client Interface" + Interface[Service Interface
pkg/services/] + end + + subgraph "Implementations" + GRPC[gRPC Client
Primary] + HTTP[HTTP Client
Fallback] + end + + subgraph "Service Registry" + Registry[Service Registry
Discovery & Resolution] + end + + Interface --> GRPC + Interface --> HTTP + + Registry --> GRPC + Registry --> HTTP + + style Interface fill:#4a90e2,stroke:#2e5c8a,stroke-width:3px,color:#fff + style Registry fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff +``` + +### Service Communication Patterns + +The platform uses three communication patterns: + +1. **Synchronous Service Calls** (via Service Clients): + - gRPC calls (primary) - type-safe, efficient + - HTTP/REST calls (fallback) - for external integration + - All calls go through service client interfaces + - Service discovery via registry + +2. **Asynchronous Events** (via Event Bus): + - Distributed via Kafka + - Preferred for cross-service communication + - Event-driven architecture for loose coupling + +3. **Shared Infrastructure** (For state): + - Redis for cache and distributed state + - PostgreSQL for persistent data + - Kafka for events + +### Service Registry + +The service registry enables service discovery and resolution: + +```mermaid +graph TB + subgraph "Service Registry" + Registry[Service Registry Interface] + Consul[Consul Registry] + K8s[K8s Service Discovery] + Etcd[etcd Registry] + end + + subgraph "Services" + AuthSvc[Auth Service] + IdentitySvc[Identity Service] + BlogSvc[Blog Service] + end + + Registry --> Consul + Registry --> K8s + Registry --> Etcd + + Consul --> AuthSvc + K8s --> IdentitySvc + Etcd --> BlogSvc + + style Registry fill:#4a90e2,stroke:#2e5c8a,stroke-width:3px,color:#fff +``` + +### Scaling Strategy + +#### Independent Service Scaling +- Scale individual services based on load +- Independent resource allocation +- Independent deployment +- Better resource utilization +- Team autonomy + +#### Development Mode +- For local development, multiple services can run in the same process +- Services still communicate via gRPC/HTTP (no direct calls) +- Docker Compose for easy local setup +- Maintains microservices architecture even in development + ## Next Steps - [Module Architecture](./architecture-modules.md) - Detailed module architecture and design - [Module Requirements](./module-requirements.md) - Requirements for each module - [Component Relationships](./component-relationships.md) - Detailed component interactions - [ADRs](../adr/README.md) - Architecture Decision Records +- [ADR-0029: Microservices Architecture](../adr/0029-microservices-architecture.md) - Microservices strategy +- [ADR-0030: Service Communication](../adr/0030-service-communication-strategy.md) - Communication patterns diff --git a/docs/content/component-relationships.md b/docs/content/component-relationships.md index aff238e..81b7fef 100644 --- a/docs/content/component-relationships.md +++ b/docs/content/component-relationships.md @@ -75,23 +75,30 @@ graph TD ## Module to Core Integration -Modules integrate with core services through well-defined interfaces and dependency injection. +Modules (services) integrate with core services through service client interfaces. All communication uses gRPC or HTTP. ```mermaid graph LR - subgraph "Feature Module" + subgraph "Feature Service (e.g., Blog)" ModuleHandler[Module Handler] ModuleService[Module Service] ModuleRepo[Module Repository] end + subgraph "Service Clients" + AuthClient[Auth Service Client] + AuthzClient[Authz Service Client] + IdentityClient[Identity Service Client] + AuditClient[Audit Service Client] + end + subgraph "Core Services" - AuthService[Auth Service] - AuthzService[Authz Service] - EventBusService[Event Bus] - CacheService[Cache Service] - AuditService[Audit Service] - LoggerService[Logger Service] + AuthService[Auth Service
:8081] + AuthzService[Authz Service
:8083] + IdentityService[Identity Service
:8082] + AuditService[Audit Service
:8084] + EventBusService[Event Bus
Kafka] + CacheService[Cache Service
Redis] end subgraph "Infrastructure" @@ -100,15 +107,20 @@ graph LR QueueClient[Message Queue] end - ModuleHandler --> AuthService - ModuleHandler --> AuthzService ModuleHandler --> ModuleService + ModuleService -->|gRPC| AuthClient + ModuleService -->|gRPC| AuthzClient + ModuleService -->|gRPC| IdentityClient + ModuleService -->|gRPC| AuditClient ModuleService --> ModuleRepo ModuleService --> EventBusService ModuleService --> CacheService - ModuleService --> AuditService - ModuleService --> LoggerService + + AuthClient --> AuthService + AuthzClient --> AuthzService + IdentityClient --> IdentityService + AuditClient --> AuditService ModuleRepo --> DBClient CacheService --> CacheClient @@ -117,6 +129,7 @@ graph LR style ModuleService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff style AuthService fill:#4a90e2,stroke:#2e5c8a,stroke-width:2px,color:#fff style DBClient fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff + style ServiceClients fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff ``` ## Service Interaction Patterns @@ -334,12 +347,14 @@ graph TB Audit --> Logger ModuleLoader --> DI - ModuleHandler --> Auth - ModuleHandler --> Authz + ModuleHandler --> ModuleService ModuleService --> ModuleRepo + ModuleService -->|gRPC| Auth + ModuleService -->|gRPC| Authz + ModuleService -->|gRPC| Identity + ModuleService -->|gRPC| Audit ModuleService --> EventBus ModuleService --> Cache - ModuleService --> Audit ModuleRepo --> DB Scheduler --> Cache @@ -418,33 +433,44 @@ graph TB style DB fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff ``` -### Cross-Module Communication +### Cross-Service Communication ```mermaid graph LR - subgraph "Module A" - AService[Service A] + subgraph "Blog Service" + BlogService[Blog Service] end - subgraph "Module B" - BService[Service B] + subgraph "Analytics Service" + AnalyticsService[Analytics Service] + end + + subgraph "Service Clients" + AuthzClient[Authz Service Client] + IdentityClient[Identity Service Client] end subgraph "Core Services" - EventBus[Event Bus] - Authz[Authz Service] - Cache[Cache] + EventBus[Event Bus
Kafka] + AuthzService[Authz Service
:8083] + IdentityService[Identity Service
:8082] + Cache[Cache
Redis] end - AService -->|Direct Call| Authz - AService -->|Publish Event| EventBus - EventBus -->|Subscribe| BService - AService -->|Cache Access| Cache - BService -->|Cache Access| Cache + BlogService -->|gRPC| AuthzClient + BlogService -->|gRPC| IdentityClient + BlogService -->|Publish Event| EventBus + EventBus -->|Subscribe| AnalyticsService + BlogService -->|Cache Access| Cache + AnalyticsService -->|Cache Access| Cache - style AService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff - style BService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff + AuthzClient --> AuthzService + IdentityClient --> IdentityService + + style BlogService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff + style AnalyticsService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff style EventBus fill:#4a90e2,stroke:#2e5c8a,stroke-width:3px,color:#fff + style ServiceClients fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff ``` ## Next Steps diff --git a/docs/content/index.md b/docs/content/index.md index 934663a..ddfe383 100644 --- a/docs/content/index.md +++ b/docs/content/index.md @@ -58,7 +58,7 @@ Detailed task definitions for each phase are available in the [Stories section]( ## Key Principles - **Clean/Hexagonal Architecture**: Clear separation between core and plugins -- **Modular Monolith**: Start simple, evolve to microservices if needed +- **Microservices Architecture**: Each module is an independent service from day one - **Plugin-First Design**: Extensible architecture supporting static and dynamic modules - **Security-by-Design**: Built-in authentication, authorization, and audit capabilities - **Observability**: Comprehensive logging, metrics, and tracing diff --git a/docs/content/plan.md b/docs/content/plan.md index 7e6b7b1..e239ffe 100644 --- a/docs/content/plan.md +++ b/docs/content/plan.md @@ -15,7 +15,9 @@ This plan breaks down the implementation into **8 phases**, each with specific d **Key Principles:** - **Clean/Hexagonal Architecture** with clear separation between `pkg/` (interfaces) and `internal/` (implementations) - **Dependency Injection** using `uber-go/fx` for lifecycle management -- **Modular Monolith** design that can evolve into microservices +- **Microservices Architecture** - each module is an independent service from day one +- **Service Client Interfaces** - all inter-service communication via gRPC/HTTP +- **Service Discovery** - all services register and discover via service registry - **Plugin-first** architecture supporting both static and dynamic module loading - **Security-by-Design** with JWT auth, RBAC/ABAC, and audit logging - **Observability** via OpenTelemetry, Prometheus, and structured logging @@ -25,127 +27,131 @@ This plan breaks down the implementation into **8 phases**, each with specific d ## Phase 0: Project Setup & Foundation (Week 1) ### Objectives -- Initialize repository structure -- Set up Go modules and basic tooling -- Create configuration management foundation -- Establish CI/CD skeleton +- Initialize repository structure with proper Go project layout +- Implement configuration management system +- Establish structured logging system +- Set up CI/CD pipeline and development tooling +- Bootstrap dependency injection and application entry point -### Tasks +### Stories -#### 0.1 Repository Bootstrap -- [ ] Initialize Go module: `go mod init github.com/yourorg/platform` -- [ ] Create directory structure: - ``` - platform/ - ├── cmd/ - │ └── platform/ # Main entry point - ├── internal/ # Private implementation code - │ ├── di/ # Dependency injection container - │ ├── registry/ # Module registry - │ ├── pluginloader/ # Plugin loader (optional) - │ └── infra/ # Infrastructure adapters - ├── pkg/ # Public interfaces (exported) - │ ├── config/ # ConfigProvider interface - │ ├── logger/ # Logger interface - │ ├── module/ # IModule interface - │ ├── auth/ # Auth interfaces - │ ├── perm/ # Permission DSL - │ └── infra/ # Infrastructure interfaces - ├── modules/ # Feature modules - │ └── blog/ # Sample Blog module (Phase 4) - ├── config/ # Configuration files - │ ├── default.yaml - │ ├── development.yaml - │ └── production.yaml - ├── api/ # OpenAPI specs - ├── scripts/ # Build/test scripts - ├── docs/ # Documentation - ├── ops/ # Operations (Grafana dashboards, etc.) - ├── .github/ - │ └── workflows/ - │ └── ci.yml - ├── Dockerfile - ├── docker-compose.yml - ├── docker-compose.test.yml - └── go.mod - ``` -- [ ] Add `.gitignore` for Go projects -- [ ] Create initial `README.md` with project overview +#### 0.1 Project Initialization and Repository Structure +**Goal:** Establish a properly structured Go project with all necessary directories, configuration files, and documentation. -#### 0.2 Configuration System -- [ ] Install `github.com/spf13/viper` and `github.com/spf13/cobra` -- [ ] Create `pkg/config/config.go` interface: - ```go - type ConfigProvider interface { - Get(key string) any - Unmarshal(v any) error - GetString(key string) string - GetInt(key string) int - GetBool(key string) bool - } - ``` -- [ ] Implement `internal/config/config.go` using Viper: - - Load `config/default.yaml` as baseline - - Merge environment-specific YAML (development/production) - - Apply environment variable overrides - - Support secret manager integration (placeholder for Phase 6) -- [ ] Create `config/default.yaml` with basic structure: - ```yaml - environment: development - server: - port: 8080 - host: "0.0.0.0" - database: - driver: "postgres" - dsn: "" - logging: - level: "info" - format: "json" - ``` -- [ ] Add `internal/config/loader.go` with `LoadConfig()` function +**Deliverables:** +- Initialize Go module with correct module path +- Create complete directory structure (`cmd/`, `internal/`, `pkg/`, `modules/`, `config/`, etc.) +- Add `.gitignore` for Go projects +- Create comprehensive `README.md` with project overview, setup instructions, and architecture overview +- Set up basic project documentation structure -#### 0.3 Logging Foundation -- [ ] Install `go.uber.org/zap` -- [ ] Create `pkg/logger/logger.go` interface: - ```go - type Logger interface { - Debug(msg string, fields ...Field) - Info(msg string, fields ...Field) - Warn(msg string, fields ...Field) - Error(msg string, fields ...Field) - With(fields ...Field) Logger - } - ``` -- [ ] Implement `internal/logger/zap_logger.go`: - - Structured JSON logging - - Configurable log levels +**Acceptance Criteria:** +- `go mod init` creates module with correct path +- All directories are in place following Go best practices +- `.gitignore` excludes build artifacts, dependencies, and IDE files +- `README.md` provides clear project overview and setup instructions +- Project structure matches architecture documentation + +#### 0.2 Configuration Management System +**Goal:** Implement a flexible configuration system that loads settings from YAML files, environment variables, and supports type-safe access. + +**Deliverables:** +- `ConfigProvider` interface in `pkg/config/` for abstraction +- Viper-based implementation in `internal/config/` that: + - Loads `config/default.yaml` as baseline + - Merges environment-specific YAML files (development/production) + - Applies environment variable overrides + - Supports nested configuration keys + - Provides type-safe getters (GetString, GetInt, GetBool, etc.) + - Supports unmarshaling into structs +- Configuration files (`config/default.yaml`, `config/development.yaml`, `config/production.yaml`) +- Configuration loader with validation + +**Acceptance Criteria:** +- Configuration loads from YAML files successfully +- Environment variables override YAML values +- Type-safe getters work correctly +- Configuration can be unmarshaled into structs +- Config system is injectable via DI container +- All modules can access configuration through interface + +#### 0.3 Structured Logging System +**Goal:** Implement a production-ready logging system with structured JSON output, request correlation, and configurable log levels. + +**Deliverables:** +- `Logger` interface in `pkg/logger/` with methods for all log levels +- Zap-based implementation in `internal/logger/` with: + - Structured JSON logging for production + - Human-readable logging for development + - Configurable log levels (debug, info, warn, error) - Request-scoped fields support - - Export global logger via `pkg/logger` -- [ ] Add request ID middleware helper (Gin middleware) + - Context-aware logging +- Request ID middleware for Gin that: + - Generates unique request IDs + - Adds request ID to all logs within request context + - Returns request ID in response headers +- Global logger export via `pkg/logger` package -#### 0.4 Basic CI/CD Pipeline -- [ ] Create `.github/workflows/ci.yml`: - - Go 1.22 setup - - Module caching - - Linting (golangci-lint or staticcheck) - - Unit tests (basic skeleton) - - Build binary -- [ ] Add `Makefile` with common commands: - - `make test` - run tests - - `make lint` - run linter - - `make build` - build binary +**Acceptance Criteria:** +- Logs are structured JSON in production mode +- Log levels are configurable and respected +- Request IDs are generated and included in all logs +- Logger can be injected via DI container +- All modules can use logger through interface +- Request correlation works across service boundaries + +#### 0.4 CI/CD Pipeline and Development Tooling +**Goal:** Establish automated testing, linting, and build processes with a developer-friendly Makefile. + +**Deliverables:** +- GitHub Actions workflow (`.github/workflows/ci.yml`) that: + - Sets up Go environment + - Caches Go modules + - Runs linters (golangci-lint or staticcheck) + - Runs unit tests + - Builds binary artifacts + - Validates code formatting +- Comprehensive `Makefile` with commands: + - `make test` - run all tests + - `make lint` - run linters + - `make build` - build platform binary - `make docker-build` - build Docker image + - `make clean` - clean build artifacts + - `make fmt` - format code + - `make generate` - run code generation -#### 0.5 Dependency Injection Setup -- [ ] Install `go.uber.org/fx` -- [ ] Create `internal/di/container.go`: - - Initialize fx container - - Register Config and Logger providers - - Basic lifecycle hooks -- [ ] Create `cmd/platform/main.go` skeleton: - - Load config - - Initialize DI container - - Start minimal HTTP server (placeholder) +**Acceptance Criteria:** +- CI pipeline runs on every push and PR +- All linting checks pass +- Tests run successfully (even if empty initially) +- Binary builds successfully +- Docker image builds successfully +- Makefile commands work as expected +- CI pipeline fails fast on errors + +#### 0.5 Dependency Injection and Application Bootstrap +**Goal:** Set up dependency injection container using Uber FX and create the application entry point that initializes the platform. + +**Deliverables:** +- DI container in `internal/di/container.go` that: + - Initializes Uber FX container + - Registers Config and Logger providers + - Provides lifecycle management hooks + - Supports service overrides for testing +- Application entry point in `cmd/platform/main.go` that: + - Loads configuration + - Initializes DI container + - Sets up basic application lifecycle + - Starts minimal HTTP server (placeholder for Phase 1) + - Handles graceful shutdown + +**Acceptance Criteria:** +- DI container initializes successfully +- Config and Logger are provided via DI +- Application starts and shuts down gracefully +- Lifecycle hooks work correctly +- Services can be overridden for testing +- Application compiles and runs successfully ### Deliverables - ✅ Repository structure in place @@ -165,113 +171,209 @@ This plan breaks down the implementation into **8 phases**, each with specific d ## Phase 1: Core Kernel & Infrastructure (Week 2-3) ### Objectives -- Implement dependency injection container -- Set up database (Ent ORM) -- Create health and metrics endpoints -- Implement error bus -- Add basic HTTP server with middleware +- Extend DI container to support all core services +- Implement database layer with Ent ORM +- Build health monitoring and metrics system +- Create error handling and error bus +- Establish HTTP server with comprehensive middleware stack +- Integrate OpenTelemetry for distributed tracing +- Create service client interfaces for microservices architecture -### Tasks +### Stories -#### 1.1 Dependency Injection Container -- [ ] Extend `internal/di/container.go`: - - Register all core services - - Provide lifecycle management via fx - - Support service overrides -- [ ] Create `internal/di/providers.go`: - - `ProvideConfig()` - config provider - - `ProvideLogger()` - logger - - `ProvideDatabase()` - Ent client (after 1.2) +#### 1.1 Enhanced Dependency Injection Container +**Goal:** Extend the DI container to provide all core infrastructure services with proper lifecycle management. + +**Deliverables:** +- Extended `internal/di/container.go` with: + - Registration of all core services + - Lifecycle management via FX + - Service override support for testing +- `internal/di/providers.go` with provider functions: + - `ProvideConfig()` - configuration provider + - `ProvideLogger()` - logger service + - `ProvideDatabase()` - Ent database client - `ProvideHealthCheckers()` - health check registry - - `ProvideMetrics()` - Prometheus registry - - `ProvideErrorBus()` - error bus -- [ ] Add `internal/di/core_module.go`: - - Export `CoreModule` fx.Option that provides all core services + - `ProvideMetrics()` - Prometheus metrics registry + - `ProvideErrorBus()` - error bus service +- `internal/di/core_module.go` exporting `CoreModule` fx.Option that provides all core services -#### 1.2 Database Setup (Ent) -- [ ] Install `entgo.io/ent/cmd/ent` -- [ ] Initialize Ent schema: - ```bash - go run entgo.io/ent/cmd/ent init User Role Permission AuditLog - ``` -- [ ] Define core entities in `internal/ent/schema/`: - - `user.go`: ID, email, password_hash, verified, created_at, updated_at - - `role.go`: ID, name, description, created_at - - `permission.go`: ID, name (string format: "module.resource.action") - - `audit_log.go`: ID, actor_id, action, target_id, metadata (JSON), timestamp - - `role_permissions.go`: Many-to-many relationship - - `user_roles.go`: Many-to-many relationship -- [ ] Generate Ent code: `go generate ./internal/ent` -- [ ] Create `internal/infra/database/client.go`: +**Acceptance Criteria:** +- All core services are provided via DI container +- Services are initialized in correct dependency order +- Lifecycle hooks work for all services +- Services can be overridden for testing +- DI container compiles without errors + +#### 1.2 Database Layer with Ent ORM +**Goal:** Set up a complete database layer using Ent ORM with core domain entities, migrations, and connection management. + +**Deliverables:** +- Ent schema initialization and core entities: + - `User` entity: ID, email, password_hash, verified, created_at, updated_at + - `Role` entity: ID, name, description, created_at + - `Permission` entity: ID, name (format: "module.resource.action") + - `AuditLog` entity: ID, actor_id, action, target_id, metadata (JSON), timestamp + - Many-to-many relationships: `role_permissions` and `user_roles` +- Generated Ent code with proper type safety +- Database client in `internal/infra/database/client.go`: - `NewEntClient(dsn string) (*ent.Client, error)` - - Connection pooling configuration + - Connection pooling configuration (max connections, idle timeout) - Migration runner wrapper -- [ ] Add database config to `config/default.yaml` + - Database health check integration +- Database configuration in `config/default.yaml` with: + - Connection string (DSN) + - Connection pool settings + - Migration settings -#### 1.3 Health & Metrics -- [ ] Install `github.com/prometheus/client_golang/prometheus` -- [ ] Install `github.com/heptiolabs/healthcheck` (optional, or custom) -- [ ] Create `pkg/health/health.go` interface: - ```go - type HealthChecker interface { - Check(ctx context.Context) error - } - ``` -- [ ] Implement `internal/health/registry.go`: - - Registry of health checkers - - `/healthz` endpoint (liveness) - - `/ready` endpoint (readiness with DB check) -- [ ] Create `internal/metrics/metrics.go`: +**Acceptance Criteria:** +- Ent schema compiles and generates code successfully +- Database client connects to PostgreSQL +- Core entities can be created and queried +- Migrations run successfully on startup +- Connection pooling is configured correctly +- Database health check works +- All entities have proper indexes and relationships + +#### 1.3 Health Monitoring and Metrics System +**Goal:** Implement comprehensive health checks and Prometheus metrics for monitoring platform health and performance. + +**Deliverables:** +- Health check system: + - `HealthChecker` interface in `pkg/health/health.go` + - Health check registry in `internal/health/registry.go`: + - Register multiple health checkers + - `GET /healthz` endpoint (liveness probe) + - `GET /ready` endpoint (readiness probe with database check) + - Individual component health checks +- Prometheus metrics system: + - Metrics registry setup - HTTP request duration histogram - - HTTP request counter - - Database query duration (via Ent interceptor) - - Error counter -- [ ] Add `/metrics` endpoint (Prometheus format) -- [ ] Register endpoints in main HTTP router + - HTTP request counter (by method, path, status) + - Database query duration histogram (via Ent interceptor) + - Error counter (by type) + - `GET /metrics` endpoint (Prometheus format) +- Integration with HTTP server and DI container -#### 1.4 Error Bus -- [ ] Create `pkg/errorbus/errorbus.go` interface: - ```go - type ErrorPublisher interface { - Publish(err error) - } - ``` -- [ ] Implement `internal/errorbus/channel_bus.go`: - - Channel-based error bus +**Acceptance Criteria:** +- `/healthz` returns 200 when service is alive +- `/ready` checks database connectivity and returns appropriate status +- `/metrics` exposes Prometheus metrics in correct format +- All HTTP requests are measured +- Database queries are instrumented +- Metrics are registered in DI container +- Health checks can be extended by modules + +#### 1.4 Error Handling and Error Bus +**Goal:** Implement centralized error handling with an error bus that captures, logs, and optionally reports all application errors. + +**Deliverables:** +- Error bus interface in `pkg/errorbus/errorbus.go`: + - `ErrorPublisher` interface with `Publish(err error)` method +- Channel-based error bus implementation in `internal/errorbus/channel_bus.go`: + - Buffered channel for error publishing - Background goroutine consumes errors - - Log all errors - - Optional: Sentry integration (Phase 6) -- [ ] Add panic recovery middleware that publishes to error bus -- [ ] Register error bus in DI container + - Logs all errors with context + - Optional: Sentry integration (Phase 6 placeholder) +- Panic recovery middleware: + - Recovers from panics in HTTP handlers + - Publishes panics to error bus + - Returns appropriate HTTP error responses +- Integration with DI container and HTTP middleware stack -#### 1.5 HTTP Server Foundation -- [ ] Install `github.com/gin-gonic/gin` -- [ ] Create `internal/server/server.go`: - - Initialize Gin router - - Add middleware: - - Request ID generator - - Structured logging +**Acceptance Criteria:** +- Errors are captured and logged via error bus +- Panics are recovered and logged +- HTTP handlers return proper error responses +- Error bus is injectable via DI +- Error context (request ID, user ID) is preserved +- Background error consumer works correctly + +#### 1.5 HTTP Server Foundation with Middleware Stack +**Goal:** Create a production-ready HTTP server with comprehensive middleware for security, observability, and error handling. + +**Deliverables:** +- HTTP server in `internal/server/server.go`: + - Gin router initialization + - Comprehensive middleware stack: + - Request ID generator (unique per request) + - Structured logging middleware (logs all requests) - Panic recovery → error bus - - Prometheus metrics - - CORS (configurable) - - Register core routes: - - `GET /healthz` - - `GET /ready` - - `GET /metrics` -- [ ] Wire HTTP server into fx lifecycle: - - Start on `OnStart` - - Graceful shutdown on `OnStop` -- [ ] Update `cmd/platform/main.go` to use fx lifecycle + - Prometheus metrics collection + - CORS support (configurable) + - Request timeout handling + - Response compression + - Core route registration: + - `GET /healthz` - liveness probe + - `GET /ready` - readiness probe + - `GET /metrics` - Prometheus metrics +- FX lifecycle integration: + - HTTP server starts on `OnStart` hook + - Graceful shutdown on `OnStop` hook (drains connections) + - Port configuration from config +- Integration with main application entry point -#### 1.6 OpenTelemetry Setup -- [ ] Install OpenTelemetry packages: - - `go.opentelemetry.io/otel` - - `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` -- [ ] Create `internal/observability/tracer.go`: - - Initialize OTEL TracerProvider - - Export to stdout (development) or OTLP (production) -- [ ] Add HTTP instrumentation middleware -- [ ] Add trace context propagation to requests +**Acceptance Criteria:** +- HTTP server starts successfully +- All middleware executes in correct order +- Request IDs are generated and logged +- Metrics are collected for all requests +- Panics are recovered and handled +- Graceful shutdown works correctly +- Server is configurable via config system +- CORS is configurable per environment + +#### 1.6 OpenTelemetry Distributed Tracing +**Goal:** Integrate OpenTelemetry for distributed tracing across the platform to enable observability in production. + +#### 1.7 Service Client Interfaces +**Goal:** Create service client interfaces for all core services to enable microservices communication. + +**Deliverables:** +- Service client interfaces in `pkg/services/` for all core services: + - `IdentityServiceClient` - User and identity operations + - `AuthServiceClient` - Authentication operations + - `AuthzServiceClient` - Authorization operations + - `PermissionServiceClient` - Permission resolution + - `AuditServiceClient` - Audit logging +- Service client factory in `internal/services/factory.go`: + - Create gRPC clients (primary) + - Create HTTP clients (fallback) + - Support service registry integration + - Handle client lifecycle and connection pooling +- Configuration for service protocol selection + +**Acceptance Criteria:** +- Service client interfaces are defined for all core services +- Service factory creates gRPC clients +- Service factory creates HTTP clients (fallback) +- Service clients are injectable via DI +- Configuration supports protocol selection +- All inter-service communication goes through service clients + +**Deliverables:** +- OpenTelemetry setup in `internal/observability/tracer.go`: + - TracerProvider initialization + - Export to stdout (development mode) + - Export to OTLP collector (production mode) + - Trace context propagation +- HTTP instrumentation middleware: + - Automatic span creation for HTTP requests + - Trace context propagation via headers + - Span attributes (method, path, status code, etc.) +- Database instrumentation: + - Ent interceptor for database queries + - Query spans with timing and parameters +- Integration with logger (include trace ID in logs) + +**Acceptance Criteria:** +- HTTP requests create OpenTelemetry spans +- Database queries are traced +- Trace context propagates across service boundaries +- Trace IDs are included in logs +- Traces export correctly to configured backend +- Tracing works in both development and production modes +- Tracing has minimal performance impact ### Deliverables - ✅ DI container with all core services @@ -280,6 +382,7 @@ This plan breaks down the implementation into **8 phases**, each with specific d - ✅ Error bus captures and logs errors - ✅ HTTP server with middleware stack - ✅ Basic observability with OpenTelemetry +- ✅ Service client interfaces for microservices ### Acceptance Criteria - `GET /healthz` returns 200 @@ -294,173 +397,210 @@ This plan breaks down the implementation into **8 phases**, each with specific d ## Phase 2: Authentication & Authorization (Week 3-4) ### Objectives -- Implement JWT authentication -- Create identity management (User CRUD) -- Build role and permission system -- Add authorization middleware -- Implement audit logging +- Implement complete JWT-based authentication system +- Build comprehensive identity management with user lifecycle +- Create role-based access control (RBAC) system +- Implement authorization middleware and permission checks +- Add comprehensive audit logging for security compliance +- Provide database seeding for initial setup -### Tasks +### Stories -#### 2.1 Authentication (JWT) -- [ ] Install `github.com/golang-jwt/jwt/v5` -- [ ] Create `pkg/auth/auth.go` interfaces: - ```go - type Authenticator interface { - GenerateToken(userID string, roles []string, tenantID string) (string, error) - VerifyToken(token string) (*TokenClaims, error) - } - - type TokenClaims struct { - UserID string - Roles []string - TenantID string - ExpiresAt time.Time - } - ``` -- [ ] Implement `internal/auth/jwt_auth.go`: - - Generate access tokens (short-lived, 15min) - - Generate refresh tokens (long-lived, 7 days) - - Verify token signature and expiration - - Extract claims -- [ ] Create `internal/auth/middleware.go`: +#### 2.1 JWT Authentication System +**Goal:** Implement a complete JWT-based authentication system with access tokens, refresh tokens, and secure token management. + +**Deliverables:** +- Authentication interfaces in `pkg/auth/auth.go`: + - `Authenticator` interface for token generation and verification + - `TokenClaims` struct with user ID, roles, tenant ID, expiration +- JWT implementation in `internal/auth/jwt_auth.go`: + - Generate short-lived access tokens (15 minutes) + - Generate long-lived refresh tokens (7 days) + - Token signature verification + - Token expiration validation + - Claims extraction +- Authentication middleware in `internal/auth/middleware.go`: - Extract JWT from `Authorization: Bearer ` header - - Verify token - - Inject `User` into `context.Context` - - Helper: `auth.FromContext(ctx) *User` -- [ ] Add login endpoint: `POST /api/v1/auth/login` - - Validate credentials - - Return access + refresh tokens -- [ ] Add refresh endpoint: `POST /api/v1/auth/refresh` - - Validate refresh token - - Issue new access token + - Verify token validity + - Inject authenticated user into request context + - Helper function: `auth.FromContext(ctx) *User` +- Authentication endpoints: + - `POST /api/v1/auth/login` - Authenticate user and return tokens + - `POST /api/v1/auth/refresh` - Refresh access token using refresh token + - Password validation against stored hashes +- Integration with DI container and HTTP server -#### 2.2 Identity Management -- [ ] Create `pkg/identity/identity.go` interfaces: - ```go - type UserRepository interface { - FindByID(ctx context.Context, id string) (*User, error) - FindByEmail(ctx context.Context, email string) (*User, error) - Create(ctx context.Context, u *User) error - Update(ctx context.Context, u *User) error - Delete(ctx context.Context, id string) error - } - - type UserService interface { - Register(ctx context.Context, email, password string) (*User, error) - VerifyEmail(ctx context.Context, token string) error - ResetPassword(ctx context.Context, email string) error - ChangePassword(ctx context.Context, userID, oldPassword, newPassword string) error - } - ``` -- [ ] Implement `internal/identity/user_repo.go` using Ent: - - CRUD operations +**Acceptance Criteria:** +- Users can login and receive access and refresh tokens +- Access tokens expire after configured duration +- Refresh tokens can be used to obtain new access tokens +- Invalid tokens are rejected with appropriate errors +- Authenticated user is available in request context +- Login attempts are logged +- Token secrets are configurable + +#### 2.2 Identity Management System +**Goal:** Build a complete user identity management system with registration, email verification, password management, and user CRUD operations. + +**Deliverables:** +- Identity interfaces in `pkg/identity/identity.go`: + - `UserRepository` interface for user data access + - `UserService` interface for user business logic +- User repository implementation in `internal/identity/user_repo.go`: + - CRUD operations using Ent - Password hashing (bcrypt or argon2) + - Email uniqueness validation + - User lookup by ID and email +- User service implementation in `internal/identity/user_service.go`: + - User registration with email verification token generation - Email verification flow -- [ ] Implement `internal/identity/user_service.go`: - - User registration with email verification - - Password reset flow (token-based) - - Password change - - Email verification -- [ ] Add endpoints: - - `POST /api/v1/users` - Register - - `GET /api/v1/users/:id` - Get user - - `PUT /api/v1/users/:id` - Update user - - `POST /api/v1/users/verify-email` - Verify email - - `POST /api/v1/users/reset-password` - Request reset + - Password reset flow (token-based, time-limited) + - Password change with old password verification + - User profile updates +- User management API endpoints: + - `POST /api/v1/users` - Register new user + - `GET /api/v1/users/:id` - Get user profile (authorized) + - `PUT /api/v1/users/:id` - Update user profile (authorized) + - `DELETE /api/v1/users/:id` - Delete user (admin only) + - `POST /api/v1/users/verify-email` - Verify email with token + - `POST /api/v1/users/reset-password` - Request password reset - `POST /api/v1/users/change-password` - Change password +- Integration with email notification system (Phase 5) -#### 2.3 Roles & Permissions -- [ ] Create `pkg/perm/perm.go`: - ```go - type Permission string - - // Core permissions - var ( - SystemHealthCheck Permission = "system.health.check" - UserCreate Permission = "user.create" - UserRead Permission = "user.read" - UserUpdate Permission = "user.update" - UserDelete Permission = "user.delete" - RoleCreate Permission = "role.create" - RoleRead Permission = "role.read" - RoleUpdate Permission = "role.update" - RoleDelete Permission = "role.delete" - ) - ``` -- [ ] Create `pkg/perm/resolver.go` interface: - ```go - type PermissionResolver interface { - HasPermission(ctx context.Context, userID string, perm Permission) (bool, error) - GetUserPermissions(ctx context.Context, userID string) ([]Permission, error) - } - ``` -- [ ] Implement `internal/perm/in_memory_resolver.go`: - - Load user roles from DB - - Load role permissions from DB - - Check if user has specific permission - - Cache permission lookups (optional) -- [ ] Create `pkg/auth/authz.go` interface: - ```go - type Authorizer interface { - Authorize(ctx context.Context, perm Permission) error - } - ``` -- [ ] Implement `internal/auth/rbac_authorizer.go`: +**Acceptance Criteria:** +- Users can register with email and password +- Passwords are securely hashed +- Email verification tokens are generated and validated +- Password reset flow works end-to-end +- Users can update their profiles +- User operations require proper authentication +- All user actions are audited + +#### 2.3 Role-Based Access Control (RBAC) System +**Goal:** Implement a complete RBAC system with permissions, role management, and authorization middleware. + +**Deliverables:** +- Permission system in `pkg/perm/perm.go`: + - `Permission` type (string format: "module.resource.action") + - Core permission constants (system, user, role permissions) + - Permission validation utilities +- Permission resolver interface in `pkg/perm/resolver.go`: + - `HasPermission(ctx, userID, perm)` method + - `GetUserPermissions(ctx, userID)` method +- Permission resolver implementation in `internal/perm/in_memory_resolver.go`: + - Load user roles from database + - Load role permissions from database + - Check user permissions (with caching) + - Permission inheritance via roles +- Authorization interface in `pkg/auth/authz.go`: + - `Authorizer` interface with `Authorize(ctx, perm)` method +- RBAC authorizer implementation in `internal/auth/rbac_authorizer.go`: - Extract user from context - - Check permission via PermissionResolver - - Return error if unauthorized -- [ ] Create authorization middleware: - - Decorator pattern: `RequirePermission(perm Permission) gin.HandlerFunc` - - Use with route registration + - Resolve user permissions + - Check permission against required permission + - Return authorization errors +- Authorization middleware: + - `RequirePermission(perm Permission) gin.HandlerFunc` decorator + - Integration with route registration + - Proper error responses for unauthorized access + +**Acceptance Criteria:** +- Permissions are defined and can be checked +- Users inherit permissions through roles +- Authorization middleware protects routes +- Unauthorized requests return 403 errors +- Permission checks are cached for performance +- Permission system is extensible by modules #### 2.4 Role Management API -- [ ] Create `internal/identity/role_repo.go`: - - CRUD for roles - - Assign permissions to roles - - Assign roles to users -- [ ] Add endpoints: - - `POST /api/v1/roles` - Create role - - `GET /api/v1/roles` - List roles - - `GET /api/v1/roles/:id` - Get role +**Goal:** Provide complete API for managing roles, assigning permissions to roles, and assigning roles to users. + +**Deliverables:** +- Role repository in `internal/identity/role_repo.go`: + - CRUD operations for roles + - Assign permissions to roles (many-to-many) + - Assign roles to users (many-to-many) + - List roles with permissions + - List users with roles +- Role management API endpoints: + - `POST /api/v1/roles` - Create new role + - `GET /api/v1/roles` - List all roles (with pagination) + - `GET /api/v1/roles/:id` - Get role details with permissions - `PUT /api/v1/roles/:id` - Update role - `DELETE /api/v1/roles/:id` - Delete role - - `POST /api/v1/roles/:id/permissions` - Assign permissions + - `POST /api/v1/roles/:id/permissions` - Assign permissions to role + - `DELETE /api/v1/roles/:id/permissions/:permId` - Remove permission from role - `POST /api/v1/users/:id/roles` - Assign roles to user + - `DELETE /api/v1/users/:id/roles/:roleId` - Remove role from user +- Authorization on all endpoints (admin only) +- Validation and error handling -#### 2.5 Audit Logging -- [ ] Create `pkg/audit/audit.go` interface: - ```go - type Auditor interface { - Record(ctx context.Context, act AuditAction) error - } - - type AuditAction struct { - ActorID string - Action string - TargetID string - Metadata map[string]any - } - ``` -- [ ] Implement `internal/audit/ent_auditor.go`: - - Write to `audit_log` table - - Capture actor from context - - Include request ID, IP address, user agent -- [ ] Add audit middleware: +**Acceptance Criteria:** +- Admin users can create and manage roles +- Permissions can be assigned to roles +- Roles can be assigned to users +- Role changes affect user permissions immediately +- All role operations are audited +- API endpoints are protected with proper permissions + +#### 2.5 Audit Logging System +**Goal:** Implement comprehensive audit logging that records all security-sensitive actions for compliance and security monitoring. + +**Deliverables:** +- Audit interface in `pkg/audit/audit.go`: + - `Auditor` interface with `Record(ctx, action)` method + - `AuditAction` struct with actor, action, target, metadata +- Audit implementation in `internal/audit/ent_auditor.go`: + - Write audit logs to `audit_log` table + - Capture actor from request context + - Include request metadata (ID, IP, user agent, timestamp) + - Store action details and target information + - Support JSON metadata for flexible logging +- Audit middleware: - Intercept all authenticated requests - - Record action (method + path) - - Store in audit log -- [ ] Integrate with auth endpoints: - - Log login attempts (success/failure) + - Record action (HTTP method + path) + - Extract user and request context + - Store audit log entry +- Integration with authentication endpoints: + - Log login attempts (success and failure) - Log password changes - - Log role assignments + - Log role assignments and removals + - Log permission changes + - Log user registration +- Audit log query API (admin only): + - `GET /api/v1/audit-logs` - Query audit logs with filters -#### 2.6 Seed Data -- [ ] Create `internal/seed/seed.go`: +**Acceptance Criteria:** +- All authenticated actions are logged +- Audit logs include complete context (actor, action, target, metadata) +- Audit logs are immutable (no updates/deletes) +- Audit logs can be queried and filtered +- Audit logging has minimal performance impact +- Audit logs are stored securely + +#### 2.6 Database Seeding and Initialization +**Goal:** Provide database seeding functionality to create initial admin user, default roles, and core permissions. + +**Deliverables:** +- Seed script in `internal/seed/seed.go`: - Create default admin user (if doesn't exist) - Create default roles (admin, user, guest) - - Assign permissions to roles - - Script: `go run cmd/seed/main.go` + - Assign core permissions to roles + - Set up initial role hierarchy +- Seed command in `cmd/seed/main.go`: + - Command-line interface for seeding + - Idempotent seeding (safe to run multiple times) + - Configuration via environment variables +- Integration with application startup (optional): + - Auto-seed on first startup in development + - Manual seeding in production + +**Acceptance Criteria:** +- Seed script creates admin user successfully +- Default roles are created with proper permissions +- Seeding is idempotent (can run multiple times safely) +- Seed script can be run via CLI +- Admin user can login and manage system ### Deliverables - ✅ JWT authentication with access/refresh tokens @@ -483,110 +623,136 @@ This plan breaks down the implementation into **8 phases**, each with specific d ## Phase 3: Module Framework (Week 4-5) ### Objectives -- Define module interface and registration system -- Implement static module registry -- Create permission code generation tool -- Build module loader (support both static and plugin modes) -- Add module discovery and initialization +- Design and implement complete module system interface +- Build module registry with dependency resolution +- Create permission code generation from module manifests +- Implement module loader supporting static and dynamic loading +- Add module lifecycle management and initialization +- Provide CLI tooling for module management +- Implement service registry and discovery for microservices -### Tasks +### Stories -#### 3.1 Module Interface -- [ ] Create `pkg/module/module.go`: - ```go - type IModule interface { - Name() string - Version() string - Dependencies() []string - Init() fx.Option - Migrations() []func(*ent.Client) error - } - ``` -- [ ] Create `pkg/module/manifest.go`: - ```go - type Manifest struct { - Name string - Version string - Dependencies []string - Permissions []string - Routes []Route - } - ``` -- [ ] Define `module.yaml` schema (used for code generation) +#### 3.1 Module System Interface and Registry +**Goal:** Design and implement the complete module system interface with registration, dependency resolution, and lifecycle management. -#### 3.2 Static Module Registry -- [ ] Create `internal/registry/registry.go`: +**Deliverables:** +- Module interface in `pkg/module/module.go`: + - `IModule` interface with Name(), Version(), Dependencies(), Init(), Migrations() + - Optional lifecycle hooks: OnStart() and OnStop() +- Module manifest in `pkg/module/manifest.go`: + - `Manifest` struct with Name, Version, Dependencies, Permissions, Routes + - `module.yaml` schema definition +- Module registry in `internal/registry/registry.go`: - Thread-safe module map - - `Register(m IModule)` function - - `All() []IModule` function - - `Get(name string) (IModule, error)` function -- [ ] Add registration validation: - - Check dependencies are satisfied - - Check for duplicate names - - Validate version compatibility + - Register(), All(), Get() functions + - Dependency validation (check dependencies are satisfied) + - Duplicate name detection + - Version compatibility checking -#### 3.3 Permission Code Generation -- [ ] Create `scripts/generate-permissions.go`: +**Acceptance Criteria:** +- Modules can register via `registry.Register()` +- Registry validates dependencies +- Registry prevents duplicate registrations +- Module interface is extensible + +#### 3.2 Permission Code Generation System +**Goal:** Create automated permission code generation from module manifests to ensure type-safe permission constants. + +**Deliverables:** +- Permission generation script in `scripts/generate-permissions.go`: - Scan all `modules/*/module.yaml` files - Extract permissions from manifests - - Generate `pkg/perm/generated.go`: - ```go - // Code generated by generate-permissions. DO NOT EDIT. - var ( - BlogPostCreate Permission = "blog.post.create" - BlogPostRead Permission = "blog.post.read" - // ... - ) - ``` -- [ ] Add `//go:generate` directive to `pkg/perm/perm.go` -- [ ] Update `Makefile` with `make generate` command + - Generate `pkg/perm/generated.go` with Permission constants + - Support for multiple modules +- Go generate integration: + - `//go:generate` directive in `pkg/perm/perm.go` + - `make generate` command in Makefile + - Automatic generation on build -#### 3.4 Module Loader -- [ ] Create `internal/pluginloader/loader.go`: - - Support static registration (preferred) - - Optional: support Go plugin loading (`.so` files) - - Scan `modules/*/module.yaml` for discovery - - Load modules in dependency order -- [ ] Implement `internal/pluginloader/static_loader.go`: - - Import modules via `import _ "github.com/yourorg/blog"` (side-effect registration) +**Acceptance Criteria:** +- Permission constants are generated from `module.yaml` +- Generated code is type-safe +- Code generation runs automatically +- Permissions follow naming convention + +#### 3.3 Module Loader and Initialization +**Goal:** Implement module loading (static and dynamic) with dependency resolution and automatic initialization. + +**Deliverables:** +- Module loader in `internal/pluginloader/loader.go`: + - Support static registration (preferred method) + - Optional: Go plugin loading (`.so` files) + - Module discovery from `modules/*/module.yaml` +- Static loader in `internal/pluginloader/static_loader.go`: + - Import modules via side-effect imports - Collect all registered modules -- [ ] Implement `internal/pluginloader/plugin_loader.go` (optional): - - Scan `./plugins/*.so` +- Optional plugin loader in `internal/pluginloader/plugin_loader.go`: + - Scan `./plugins/*.so` files - Load via `plugin.Open()` - - Extract `Module` symbol - - Validate version compatibility - -#### 3.5 Module Initialization -- [ ] Create `internal/module/initializer.go`: + - Extract and validate module symbols +- Module initializer in `internal/module/initializer.go`: - Collect all registered modules - Resolve dependency order (topological sort) - Initialize each module's `Init()` fx.Option - Merge all options into main fx container -- [ ] Run migrations: - - Collect all module migrations - - Run core migrations first - - Run module migrations in dependency order - - Handle migration errors gracefully + - Run migrations in dependency order + - Handle errors gracefully +- FX lifecycle integration: + - Call `OnStart()` during app startup + - Call `OnStop()` during graceful shutdown -#### 3.6 Module Lifecycle Hooks -- [ ] Extend `pkg/module/module.go`: - ```go - type IModule interface { - // ... existing methods - OnStart(ctx context.Context) error // Optional - OnStop(ctx context.Context) error // Optional - } - ``` -- [ ] Integrate with fx.Lifecycle: - - Call `OnStart` during app startup - - Call `OnStop` during graceful shutdown +**Acceptance Criteria:** +- Modules load in correct dependency order +- Module migrations run automatically +- Module initialization integrates with FX +- Lifecycle hooks work correctly +- Dependency resolution handles cycles -#### 3.7 Module CLI Tool -- [ ] Create `cmd/platformctl/main.go`: - - `platformctl modules list` - List all loaded modules +#### 3.4 Module Management CLI Tool +**Goal:** Provide CLI tooling for managing modules, validating dependencies, and testing module loading. + +**Deliverables:** +- CLI tool in `cmd/platformctl/main.go`: + - `platformctl modules list` - List all loaded modules with versions - `platformctl modules validate` - Validate module dependencies - `platformctl modules test ` - Test module loading -- [ ] Add to `Makefile`: `make install-cli` + - `platformctl modules info ` - Show module details +- Makefile integration: + - `make install-cli` - Install CLI tool + - `make cli` - Build CLI tool + +**Acceptance Criteria:** +- CLI tool lists all modules +- Dependency validation works +- Module testing works +- CLI is installable and usable + +#### 3.5 Service Registry and Discovery +**Goal:** Implement a service registry that enables service discovery for microservices. + +**Deliverables:** +- Service registry interface in `pkg/services/registry.go`: + - `ServiceRegistry` interface with Register, Discover, GetService methods + - `ServiceInfo` struct with service metadata +- Consul registry in `internal/services/registry/consul.go`: + - Consul integration for service discovery + - Service registration and discovery + - Health status tracking +- Kubernetes service discovery in `internal/services/registry/kubernetes.go`: + - Kubernetes service discovery + - Service health checking +- Service auto-registration on startup +- Configuration for registry type selection + +**Acceptance Criteria:** +- Service registry interface is defined +- Consul registry works correctly +- Kubernetes registry works correctly +- Services are auto-registered on startup +- Service discovery works +- Health checking works +- Registry is configurable ### Deliverables - ✅ Module interface and registration system @@ -595,6 +761,7 @@ This plan breaks down the implementation into **8 phases**, each with specific d - ✅ Module loader with dependency resolution - ✅ Module initialization in main app - ✅ CLI tool for module management +- ✅ Service registry for discovery ### Acceptance Criteria - Modules can register via `registry.Register()` @@ -793,6 +960,7 @@ This plan breaks down the implementation into **8 phases**, each with specific d - Make adapters swappable via interfaces - Add scheduler/background jobs system - Implement event bus (in-process and Kafka) +- Add gRPC service definitions and clients for microservices communication ### Tasks @@ -909,25 +1077,34 @@ This plan breaks down the implementation into **8 phases**, each with specific d - Load secrets lazily (cache) - [ ] Register in DI container (optional, via config) -#### 5.7 Multi-tenancy Support (Optional) -- [ ] Create `pkg/tenant/tenant.go` interface: - ```go - type TenantResolver interface { - Resolve(ctx context.Context) (string, error) - } - ``` -- [ ] Implement `internal/tenant/resolver.go`: - - Extract from header: `X-Tenant-ID` - - Extract from subdomain - - Extract from JWT claim -- [ ] Add tenant middleware: - - Resolve tenant ID - - Inject into context - - Helper: `tenant.FromContext(ctx) string` -- [ ] Update Ent queries to filter by tenant_id: - - Add interceptor to Ent client - - Automatically add `WHERE tenant_id = ?` to queries -- [ ] Update User entity to include tenant_id +#### 5.7 gRPC Service Definitions and Clients +**Goal:** Implement gRPC service definitions and clients to enable microservices communication, allowing modules to be extracted as independent services. + +**Deliverables:** +- gRPC service definitions in `api/proto/`: + - Protocol Buffer files for core services (identity, auth, authz, permission, audit) + - Service and message definitions + - Proper versioning +- gRPC server implementations in `internal/services/grpc/server/`: + - Server implementations wrapping existing services + - Error handling and validation + - Request/response conversion +- gRPC client implementations in `internal/services/grpc/client/`: + - Clients that satisfy service client interfaces + - Connection pooling and retry logic + - Circuit breaker support + - Timeout handling +- gRPC server setup and integration +- Code generation from protobuf files +- Configuration for enabling gRPC services + +**Acceptance Criteria:** +- gRPC service definitions are created +- gRPC servers are implemented +- gRPC clients implement service interfaces +- Service factory can create gRPC clients +- gRPC services can be enabled via configuration +- Code generation works ### Deliverables - ✅ Cache adapter (Redis) working @@ -936,7 +1113,7 @@ This plan breaks down the implementation into **8 phases**, each with specific d - ✅ Email notification system - ✅ Scheduler and background jobs - ✅ Secret store integration (optional) -- ✅ Multi-tenancy support (optional) +- ✅ gRPC service definitions and clients ### Acceptance Criteria - Cache stores and retrieves data correctly diff --git a/docs/content/stories/STORY_CONSOLIDATION_GUIDE.md b/docs/content/stories/STORY_CONSOLIDATION_GUIDE.md new file mode 100644 index 0000000..2812130 --- /dev/null +++ b/docs/content/stories/STORY_CONSOLIDATION_GUIDE.md @@ -0,0 +1,179 @@ +# Story Consolidation Guide + +## Overview +The stories have been reworked from granular, task-based items into meaningful, cohesive stories that solve complete problems. Each story now represents a complete feature or capability that can be tested end-to-end. + +## Transformation Pattern + +### Before (Granular Tasks) +- ❌ "Install dependency X" +- ❌ "Create file Y" +- ❌ "Add function Z" +- ❌ Multiple tiny tasks that don't deliver value alone + +### After (Meaningful Stories) +- ✅ "Configuration Management System" - Complete config system with interface, implementation, and files +- ✅ "JWT Authentication System" - Complete auth with tokens, middleware, and endpoints +- ✅ "Database Layer with Ent ORM" - Complete database setup with entities, migrations, and client + +## Story Structure + +Each consolidated story follows this structure: + +1. **Goal** - High-level objective +2. **Description** - What problem it solves +3. **Deliverables** - Complete list of what will be delivered +4. **Acceptance Criteria** - How we know it's done +5. **Implementation Steps** - High-level steps (not micro-tasks) + +## Phase 0 - Completed Examples + +### 0.1 Project Initialization and Repository Structure +**Consolidates:** Go module init, directory structure, .gitignore, README + +### 0.2 Configuration Management System +**Consolidates:** Install viper, create interface, implement loader, create config files + +### 0.3 Structured Logging System +**Consolidates:** Install zap, create interface, implement logger, request ID middleware + +### 0.4 CI/CD Pipeline +**Consolidates:** GitHub Actions workflow, Makefile creation + +### 0.5 DI and Application Bootstrap +**Consolidates:** Install FX, create DI container, create main.go + +## Remaining Phases - Consolidation Pattern + +### Phase 1: Core Kernel +- **1.1 Enhanced DI Container** - All DI providers and extensions +- **1.2 Database Layer** - Complete Ent setup with entities and migrations +- **1.3 Health & Metrics** - Complete monitoring system +- **1.4 Error Handling** - Complete error bus system +- **1.5 HTTP Server** - Complete server with all middleware +- **1.6 OpenTelemetry** - Complete tracing setup + +### Phase 2: Authentication & Authorization +- **2.1 JWT Authentication System** - Complete auth with tokens +- **2.2 Identity Management** - Complete user lifecycle +- **2.3 RBAC System** - Complete permission system +- **2.4 Role Management API** - Complete role management +- **2.5 Audit Logging** - Complete audit system +- **2.6 Database Seeding** - Complete seeding system + +### Phase 3: Module Framework +- **3.1 Module Interface & Registry** - Complete module system +- **3.2 Permission Code Generation** - Complete code gen system +- **3.3 Module Loader** - Complete loading and initialization +- **3.4 Module CLI** - Complete CLI tool + +### Phase 4: Sample Blog Module +- **4.1 Complete Blog Module** - Full module with CRUD, permissions, API + +### Phase 5: Infrastructure Adapters +- **5.1 Cache System** - Complete Redis cache +- **5.2 Event Bus** - Complete event system +- **5.3 Blob Storage** - Complete S3 storage +- **5.4 Email Notification** - Complete email system +- **5.5 Scheduler & Jobs** - Complete job system +- **5.6 Secret Store** - Complete secret management +- **5.7 Multi-tenancy** - Complete tenant support + +### Phase 6: Observability +- **6.1 Enhanced OpenTelemetry** - Complete tracing +- **6.2 Error Reporting** - Complete Sentry integration +- **6.3 Enhanced Logging** - Complete log correlation +- **6.4 Metrics Expansion** - Complete metrics +- **6.5 Grafana Dashboards** - Complete dashboards +- **6.6 Rate Limiting** - Complete rate limiting +- **6.7 Security Hardening** - Complete security +- **6.8 Performance Optimization** - Complete optimizations + +### Phase 7: Testing & Documentation +- **7.1 Unit Testing** - Complete test suite +- **7.2 Integration Testing** - Complete integration tests +- **7.3 Documentation** - Complete docs +- **7.4 CI/CD Enhancement** - Complete pipeline +- **7.5 Docker & Deployment** - Complete deployment setup + +### Phase 8: Advanced Features +- **8.1 OIDC Support** - Complete OIDC +- **8.2 GraphQL API** - Complete GraphQL +- **8.3 Additional Modules** - Complete sample modules +- **8.4 Performance** - Complete optimizations + +## Creating New Story Files + +When creating story files for remaining phases, follow this template: + +```markdown +# Story X.Y: [Meaningful Title] + +## Metadata +- **Story ID**: X.Y +- **Title**: [Complete Feature Name] +- **Phase**: X - [Phase Name] +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: [hours] +- **Dependencies**: [story IDs] + +## Goal +[High-level objective - what problem does this solve?] + +## Description +[What this story delivers as a complete capability] + +## Deliverables +- [Complete list of deliverables - not just files, but complete features] +- [Interface definitions] +- [Implementations] +- [API endpoints] +- [Integration points] + +## Implementation Steps +1. [High-level step 1] +2. [High-level step 2] +3. [High-level step 3] + +## Acceptance Criteria +- [ ] [End-to-end testable criteria] +- [ ] [Feature works completely] +- [ ] [Integration works] + +## Related ADRs +- [ADR links] + +## Implementation Notes +- [Important considerations] + +## Testing +[How to test the complete feature] + +## Files to Create/Modify +- [List of files] +``` + +## Key Principles + +1. **Each story solves a complete problem** - Not just "install X" or "create file Y" +2. **Stories are testable end-to-end** - You can verify the complete feature works +3. **Stories deliver business value** - Even infrastructure stories solve complete problems +4. **Stories are independent where possible** - Can be worked on separately +5. **Stories have clear acceptance criteria** - You know when they're done + +## Next Steps + +1. Update remaining phase README files to reference consolidated stories +2. Create story files for remaining phases following the pattern +3. Update plan.md to complete all phases with story-based structure +4. Remove old granular task files (or archive them) + +## Benefits of This Approach + +- **Better Planning**: Stories represent complete features +- **Clearer Progress**: You can see complete features being delivered +- **Better Testing**: Each story can be tested end-to-end +- **Reduced Overhead**: Fewer story files to manage +- **More Meaningful**: Stories solve real problems, not just tasks + diff --git a/docs/content/stories/phase0/0.1-project-initialization.md b/docs/content/stories/phase0/0.1-project-initialization.md new file mode 100644 index 0000000..08b0057 --- /dev/null +++ b/docs/content/stories/phase0/0.1-project-initialization.md @@ -0,0 +1,162 @@ +# Story 0.1: Project Initialization and Repository Structure + +## Metadata +- **Story ID**: 0.1 +- **Title**: Project Initialization and Repository Structure +- **Phase**: 0 - Project Setup & Foundation +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 2-3 hours +- **Dependencies**: None + +## Goal +Establish a properly structured Go project with all necessary directories, configuration files, and documentation that follows Go best practices and supports the platform's modular architecture. + +## Description +This story covers the complete project initialization, including Go module setup, directory structure creation, and initial documentation. The project structure must support the microservices architecture with clear separation between core services, feature services (modules), and infrastructure. + +## Deliverables + +### 1. Go Module Initialization +- Initialize Go module with correct module path: `git.dcentral.systems/toolz/goplt` +- Set Go version to 1.24 in `go.mod` +- Verify module initialization with `go mod verify` + +### 2. Complete Directory Structure +Create the following directory structure: +``` +platform/ +├── cmd/ +│ └── platform/ # Main entry point +├── internal/ # Private implementation code +│ ├── di/ # Dependency injection container +│ ├── registry/ # Module registry +│ ├── pluginloader/ # Plugin loader (optional) +│ ├── config/ # Config implementation +│ ├── logger/ # Logger implementation +│ ├── infra/ # Infrastructure adapters +│ └── ent/ # Ent ORM schemas +├── pkg/ # Public interfaces (exported) +│ ├── config/ # ConfigProvider interface +│ ├── logger/ # Logger interface +│ ├── module/ # IModule interface +│ ├── auth/ # Auth interfaces +│ ├── perm/ # Permission DSL +│ └── infra/ # Infrastructure interfaces +├── modules/ # Feature modules +│ └── blog/ # Sample Blog module (Phase 4) +├── config/ # Configuration files +│ ├── default.yaml +│ ├── development.yaml +│ └── production.yaml +├── api/ # OpenAPI specs +├── scripts/ # Build/test scripts +├── docs/ # Documentation +├── ops/ # Operations (Grafana dashboards, etc.) +├── .github/ +│ └── workflows/ +│ └── ci.yml +├── Dockerfile +├── docker-compose.yml +├── docker-compose.test.yml +├── .gitignore +├── README.md +└── go.mod +``` + +### 3. .gitignore Configuration +- Exclude build artifacts (`bin/`, `dist/`) +- Exclude Go build cache +- Exclude IDE files (`.vscode/`, `.idea/`, etc.) +- Exclude test coverage files +- Exclude dependency directories +- Exclude environment-specific files + +### 4. Initial README.md +Create comprehensive README with: +- Project overview and purpose +- Architecture overview +- Quick start guide +- Development setup instructions +- Directory structure explanation +- Links to documentation +- Contributing guidelines + +### 5. Basic Documentation Structure +- Set up `docs/` directory +- Create architecture documentation placeholder +- Create API documentation structure + +## Implementation Steps + +1. **Initialize Go Module** + ```bash + go mod init git.dcentral.systems/toolz/goplt + ``` + - Verify `go.mod` is created + - Set Go version constraint + +2. **Create Directory Structure** + - Create all directories listed above + - Ensure proper nesting and organization + - Add placeholder `.gitkeep` files in empty directories if needed + +3. **Configure .gitignore** + - Add Go-specific ignore patterns + - Add IDE-specific patterns + - Add OS-specific patterns + - Add build artifact patterns + +4. **Create README.md** + - Write comprehensive project overview + - Document architecture principles + - Provide setup instructions + - Include example commands + +5. **Verify Structure** + - Run `go mod verify` + - Check all directories exist + - Verify .gitignore works + - Test README formatting + +## Acceptance Criteria +- [ ] `go mod init` creates module with correct path `git.dcentral.systems/toolz/goplt` +- [ ] Go version is set to `1.24` in `go.mod` +- [ ] All directories from the structure are in place +- [ ] `.gitignore` excludes build artifacts, dependencies, and IDE files +- [ ] `README.md` provides clear project overview and setup instructions +- [ ] Project structure matches architecture documentation +- [ ] `go mod verify` passes +- [ ] Directory structure follows Go best practices + +## Related ADRs +- [ADR-0001: Go Module Path](../../adr/0001-go-module-path.md) +- [ADR-0002: Go Version](../../adr/0002-go-version.md) +- [ADR-0007: Project Directory Structure](../../adr/0007-project-directory-structure.md) + +## Implementation Notes +- The module path should match the organization's Git hosting structure +- All internal packages must use `internal/` prefix to ensure they are not importable by external modules +- Public interfaces in `pkg/` should be minimal and well-documented +- Empty directories can have `.gitkeep` files to ensure they are tracked in Git +- The directory structure should be documented in the README + +## Testing +```bash +# Verify module initialization +go mod verify +go mod tidy + +# Check directory structure +tree -L 3 -a + +# Verify .gitignore +git status +``` + +## Files to Create/Modify +- `go.mod` - Go module definition +- `README.md` - Project documentation +- `.gitignore` - Git ignore patterns +- All directory structure as listed above + diff --git a/docs/content/stories/phase0/0.1.1-initialize-go-module-go-mod-init-githubcomyourorgp.md b/docs/content/stories/phase0/0.1.1-initialize-go-module-go-mod-init-githubcomyourorgp.md deleted file mode 100644 index 5607dd4..0000000 --- a/docs/content/stories/phase0/0.1.1-initialize-go-module-go-mod-init-githubcomyourorgp.md +++ /dev/null @@ -1,47 +0,0 @@ -# Task 0.1.1: Initialize Go Module - -## Metadata -- **Task ID**: 0.1.1 -- **Title**: Initialize Go Module -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.1 Repository Bootstrap -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 5 minutes -- **Dependencies**: None - -## Description -Initialize the Go module with the correct module path for the platform. - -## Requirements -- Use module path: `git.dcentral.systems/toolz/goplt` -- Go version: 1.24.3 -- Ensure `go.mod` file is created correctly - -## Implementation Steps -1. Run `go mod init git.dcentral.systems/toolz/goplt` in the project root -2. Verify `go.mod` file is created with correct module path -3. Set Go version in `go.mod`: `go 1.24` - -## Acceptance Criteria -- [ ] `go.mod` file exists in project root -- [ ] Module path is `git.dcentral.systems/toolz/goplt` -- [ ] Go version is set to `1.24` -- [ ] `go mod verify` passes - -## Related ADRs -- [ADR-0001: Go Module Path](../../adr/0001-go-module-path.md) -- [ADR-0002: Go Version](../../adr/0002-go-version.md) - -## Implementation Notes -- Ensure the module path matches the organization's Git hosting structure -- The module path will be used for all internal imports -- Update any documentation that references placeholder module paths - -## Testing -```bash -# Verify module initialization -go mod verify -go mod tidy -``` - diff --git a/docs/content/stories/phase0/0.1.1-initialize-go-module.md b/docs/content/stories/phase0/0.1.1-initialize-go-module.md deleted file mode 100644 index 5607dd4..0000000 --- a/docs/content/stories/phase0/0.1.1-initialize-go-module.md +++ /dev/null @@ -1,47 +0,0 @@ -# Task 0.1.1: Initialize Go Module - -## Metadata -- **Task ID**: 0.1.1 -- **Title**: Initialize Go Module -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.1 Repository Bootstrap -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 5 minutes -- **Dependencies**: None - -## Description -Initialize the Go module with the correct module path for the platform. - -## Requirements -- Use module path: `git.dcentral.systems/toolz/goplt` -- Go version: 1.24.3 -- Ensure `go.mod` file is created correctly - -## Implementation Steps -1. Run `go mod init git.dcentral.systems/toolz/goplt` in the project root -2. Verify `go.mod` file is created with correct module path -3. Set Go version in `go.mod`: `go 1.24` - -## Acceptance Criteria -- [ ] `go.mod` file exists in project root -- [ ] Module path is `git.dcentral.systems/toolz/goplt` -- [ ] Go version is set to `1.24` -- [ ] `go mod verify` passes - -## Related ADRs -- [ADR-0001: Go Module Path](../../adr/0001-go-module-path.md) -- [ADR-0002: Go Version](../../adr/0002-go-version.md) - -## Implementation Notes -- Ensure the module path matches the organization's Git hosting structure -- The module path will be used for all internal imports -- Update any documentation that references placeholder module paths - -## Testing -```bash -# Verify module initialization -go mod verify -go mod tidy -``` - diff --git a/docs/content/stories/phase0/0.1.2-create-directory-structure.md b/docs/content/stories/phase0/0.1.2-create-directory-structure.md deleted file mode 100644 index 1ec1250..0000000 --- a/docs/content/stories/phase0/0.1.2-create-directory-structure.md +++ /dev/null @@ -1,77 +0,0 @@ -# Task 0.1.2: Create directory structure: - -## Metadata -- **Task ID**: 0.1.2 -- **Title**: Create directory structure: -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create directory structure: - -## Requirements -- Create directory structure: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.1.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -platform/ - ├── cmd/ - │ └── platform/ # Main entry point - ├── internal/ # Private implementation code - │ ├── di/ # Dependency injection container - │ ├── registry/ # Module registry - │ ├── pluginloader/ # Plugin loader (optional) - │ └── infra/ # Infrastructure adapters - ├── pkg/ # Public interfaces (exported) - │ ├── config/ # ConfigProvider interface - │ ├── logger/ # Logger interface - │ ├── module/ # IModule interface - │ ├── auth/ # Auth interfaces - │ ├── perm/ # Permission DSL - │ └── infra/ # Infrastructure interfaces - ├── modules/ # Feature modules - │ └── blog/ # Sample Blog module (Phase 4) - ├── config/ # Configuration files - │ ├── default.yaml - │ ├── development.yaml - │ └── production.yaml - ├── api/ # OpenAPI specs - ├── scripts/ # Build/test scripts - ├── docs/ # Documentation - ├── ops/ # Operations (Grafana dashboards, etc.) - ├── .github/ - │ └── workflows/ - │ └── ci.yml - ├── Dockerfile - ├── docker-compose.yml - ├── docker-compose.test.yml - └── go.mod -``` diff --git a/docs/content/stories/phase0/0.1.3-add-gitignore-for-go-projects.md b/docs/content/stories/phase0/0.1.3-add-gitignore-for-go-projects.md deleted file mode 100644 index b1c068f..0000000 --- a/docs/content/stories/phase0/0.1.3-add-gitignore-for-go-projects.md +++ /dev/null @@ -1,56 +0,0 @@ -# Task 0.1.3: Add Gitignore - -## Metadata -- **Task ID**: 0.1.3 -- **Title**: Add Gitignore -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.1 Repository Bootstrap -- **Status**: Pending -- **Priority**: Medium -- **Estimated Time**: 5 minutes -- **Dependencies**: 0.1.1 - -## Description -Create a comprehensive `.gitignore` file for Go projects that excludes build artifacts, dependencies, IDE files, and sensitive data. - -## Requirements -- Ignore Go build artifacts -- Ignore dependency caches -- Ignore IDE-specific files -- Ignore environment-specific files -- Ignore secrets and sensitive data - -## Implementation Steps -1. Create `.gitignore` in project root -2. Add standard Go ignores: - - `*.exe`, `*.exe~`, `*.dll`, `*.so`, `*.dylib` - - `*.test`, `*.out` - - `go.work`, `go.work.sum` -3. Add IDE ignores: - - `.vscode/`, `.idea/`, `*.swp`, `*.swo` -4. Add environment ignores: - - `.env`, `.env.local`, `config/secrets/` -5. Add OS ignores: - - `.DS_Store`, `Thumbs.db` -6. Add build artifacts: - - `bin/`, `dist/`, `tmp/` - -## Acceptance Criteria -- [ ] `.gitignore` file exists -- [ ] Common Go artifacts are ignored -- [ ] IDE files are ignored -- [ ] Sensitive files are ignored -- [ ] Test with `git status` to verify - -## Implementation Notes -- Use standard Go `.gitignore` templates -- Ensure `config/secrets/` is ignored (for secret files) -- Consider adding `*.log` for log files - -## Testing -```bash -# Verify gitignore works -git status -# Should not show build artifacts or IDE files -``` - diff --git a/docs/content/stories/phase0/0.1.3-add-gitignore.md b/docs/content/stories/phase0/0.1.3-add-gitignore.md deleted file mode 100644 index b1c068f..0000000 --- a/docs/content/stories/phase0/0.1.3-add-gitignore.md +++ /dev/null @@ -1,56 +0,0 @@ -# Task 0.1.3: Add Gitignore - -## Metadata -- **Task ID**: 0.1.3 -- **Title**: Add Gitignore -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.1 Repository Bootstrap -- **Status**: Pending -- **Priority**: Medium -- **Estimated Time**: 5 minutes -- **Dependencies**: 0.1.1 - -## Description -Create a comprehensive `.gitignore` file for Go projects that excludes build artifacts, dependencies, IDE files, and sensitive data. - -## Requirements -- Ignore Go build artifacts -- Ignore dependency caches -- Ignore IDE-specific files -- Ignore environment-specific files -- Ignore secrets and sensitive data - -## Implementation Steps -1. Create `.gitignore` in project root -2. Add standard Go ignores: - - `*.exe`, `*.exe~`, `*.dll`, `*.so`, `*.dylib` - - `*.test`, `*.out` - - `go.work`, `go.work.sum` -3. Add IDE ignores: - - `.vscode/`, `.idea/`, `*.swp`, `*.swo` -4. Add environment ignores: - - `.env`, `.env.local`, `config/secrets/` -5. Add OS ignores: - - `.DS_Store`, `Thumbs.db` -6. Add build artifacts: - - `bin/`, `dist/`, `tmp/` - -## Acceptance Criteria -- [ ] `.gitignore` file exists -- [ ] Common Go artifacts are ignored -- [ ] IDE files are ignored -- [ ] Sensitive files are ignored -- [ ] Test with `git status` to verify - -## Implementation Notes -- Use standard Go `.gitignore` templates -- Ensure `config/secrets/` is ignored (for secret files) -- Consider adding `*.log` for log files - -## Testing -```bash -# Verify gitignore works -git status -# Should not show build artifacts or IDE files -``` - diff --git a/docs/content/stories/phase0/0.1.4-create-initial-readme.md b/docs/content/stories/phase0/0.1.4-create-initial-readme.md deleted file mode 100644 index 3bc4a22..0000000 --- a/docs/content/stories/phase0/0.1.4-create-initial-readme.md +++ /dev/null @@ -1,63 +0,0 @@ -# Task 0.1.4: Create Initial README - -## Metadata -- **Task ID**: 0.1.4 -- **Title**: Create Initial README -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.1 Repository Bootstrap -- **Status**: Pending -- **Priority**: Medium -- **Estimated Time**: 20 minutes -- **Dependencies**: 0.1.1 - -## Description -Create an initial `README.md` file that provides an overview of the project, its purpose, architecture, and quick start instructions. - -## Requirements -- Project overview and description -- Architecture overview -- Quick start guide -- Links to documentation -- Build and run instructions - -## Implementation Steps -1. Create `README.md` in project root -2. Add project title and description -3. Add architecture overview section -4. Add quick start instructions -5. Add links to documentation (`docs/`) -6. Add build and run commands -7. Add contribution guidelines (placeholder) - -## Acceptance Criteria -- [ ] `README.md` exists -- [ ] Project overview is clear -- [ ] Quick start instructions are present -- [ ] Links to documentation work -- [ ] Build instructions are accurate - -## Implementation Notes -- Keep README concise but informative -- Update as project evolves -- Include badges (build status, etc.) later -- Reference ADRs for architecture decisions - -## Content Structure -```markdown -# Go Platform (goplt) - -[Description] - -## Architecture -[Overview] - -## Quick Start -[Instructions] - -## Documentation -[Links] - -## Development -[Setup instructions] -``` - diff --git a/docs/content/stories/phase0/0.1.4-create-initial-readmemd-with-project-overview.md b/docs/content/stories/phase0/0.1.4-create-initial-readmemd-with-project-overview.md deleted file mode 100644 index 3bc4a22..0000000 --- a/docs/content/stories/phase0/0.1.4-create-initial-readmemd-with-project-overview.md +++ /dev/null @@ -1,63 +0,0 @@ -# Task 0.1.4: Create Initial README - -## Metadata -- **Task ID**: 0.1.4 -- **Title**: Create Initial README -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.1 Repository Bootstrap -- **Status**: Pending -- **Priority**: Medium -- **Estimated Time**: 20 minutes -- **Dependencies**: 0.1.1 - -## Description -Create an initial `README.md` file that provides an overview of the project, its purpose, architecture, and quick start instructions. - -## Requirements -- Project overview and description -- Architecture overview -- Quick start guide -- Links to documentation -- Build and run instructions - -## Implementation Steps -1. Create `README.md` in project root -2. Add project title and description -3. Add architecture overview section -4. Add quick start instructions -5. Add links to documentation (`docs/`) -6. Add build and run commands -7. Add contribution guidelines (placeholder) - -## Acceptance Criteria -- [ ] `README.md` exists -- [ ] Project overview is clear -- [ ] Quick start instructions are present -- [ ] Links to documentation work -- [ ] Build instructions are accurate - -## Implementation Notes -- Keep README concise but informative -- Update as project evolves -- Include badges (build status, etc.) later -- Reference ADRs for architecture decisions - -## Content Structure -```markdown -# Go Platform (goplt) - -[Description] - -## Architecture -[Overview] - -## Quick Start -[Instructions] - -## Documentation -[Links] - -## Development -[Setup instructions] -``` - diff --git a/docs/content/stories/phase0/0.2-configuration-management-system.md b/docs/content/stories/phase0/0.2-configuration-management-system.md new file mode 100644 index 0000000..2a3b675 --- /dev/null +++ b/docs/content/stories/phase0/0.2-configuration-management-system.md @@ -0,0 +1,171 @@ +# Story 0.2: Configuration Management System + +## Metadata +- **Story ID**: 0.2 +- **Title**: Configuration Management System +- **Phase**: 0 - Project Setup & Foundation +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 4-6 hours +- **Dependencies**: 0.1 + +## Goal +Implement a flexible configuration system that loads settings from YAML files, environment variables, and supports type-safe access. The system must be injectable via DI and usable by all modules. + +## Description +This story implements a complete configuration management system using Viper that provides a clean interface for accessing configuration values. The system supports multiple configuration sources (YAML files, environment variables) with proper precedence and type-safe accessors. + +## Deliverables + +### 1. Configuration Interface (`pkg/config/config.go`) +Define `ConfigProvider` interface with: +- `Get(key string) any` - Get any value +- `Unmarshal(v any) error` - Unmarshal into struct +- `GetString(key string) string` - Type-safe string getter +- `GetInt(key string) int` - Type-safe int getter +- `GetBool(key string) bool` - Type-safe bool getter +- `GetStringSlice(key string) []string` - Type-safe slice getter +- `GetDuration(key string) time.Duration` - Type-safe duration getter +- `IsSet(key string) bool` - Check if key exists + +### 2. Viper Implementation (`internal/config/config.go`) +Implement `ConfigProvider` using Viper: +- Load `config/default.yaml` as baseline +- Merge environment-specific YAML files (development/production) +- Apply environment variable overrides (uppercase with underscores) +- Support nested configuration keys (dot notation) +- Provide all type-safe getters +- Support unmarshaling into structs +- Handle configuration validation errors + +### 3. Configuration Loader (`internal/config/loader.go`) +- `LoadConfig(env string) (ConfigProvider, error)` function +- Environment detection (development/production) +- Configuration file discovery +- Validation of required configuration keys +- Error handling and reporting + +### 4. Configuration Files +Create configuration files: + +**`config/default.yaml`** - Base configuration: +```yaml +environment: development +server: + port: 8080 + host: "0.0.0.0" + read_timeout: 30s + write_timeout: 30s +database: + driver: "postgres" + dsn: "" + max_connections: 25 + max_idle_connections: 5 +logging: + level: "info" + format: "json" + output: "stdout" +``` + +**`config/development.yaml`** - Development overrides: +```yaml +environment: development +logging: + level: "debug" + format: "console" +``` + +**`config/production.yaml`** - Production overrides: +```yaml +environment: production +logging: + level: "warn" + format: "json" +``` + +### 5. DI Integration +- Provider function for ConfigProvider +- Register in DI container +- Make configurable via FX + +## Implementation Steps + +1. **Install Dependencies** + ```bash + go get github.com/spf13/viper@v1.18.0 + go get github.com/spf13/cobra@v1.8.0 + ``` + +2. **Create Configuration Interface** + - Define `ConfigProvider` interface in `pkg/config/config.go` + - Add package documentation + - Export interface for use by modules + +3. **Implement Viper Configuration** + - Create `internal/config/config.go` + - Implement all interface methods + - Handle configuration loading and merging + - Support nested keys and environment variables + +4. **Create Configuration Loader** + - Implement `LoadConfig()` function + - Add environment detection logic + - Add validation logic + - Handle errors gracefully + +5. **Create Configuration Files** + - Create `config/default.yaml` with base configuration + - Create `config/development.yaml` with dev overrides + - Create `config/production.yaml` with prod overrides + - Ensure proper YAML structure + +6. **Integrate with DI** + - Create provider function + - Register in DI container + - Test injection + +## Acceptance Criteria +- [ ] `ConfigProvider` interface is defined and documented +- [ ] Viper implementation loads YAML files successfully +- [ ] Environment variables override YAML values +- [ ] Type-safe getters work correctly (string, int, bool, etc.) +- [ ] Configuration can be unmarshaled into structs +- [ ] Nested keys work with dot notation +- [ ] Configuration system is injectable via DI container +- [ ] All modules can access configuration through interface +- [ ] Configuration validation works +- [ ] Error handling is comprehensive + +## Related ADRs +- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md) + +## Implementation Notes +- Use Viper's automatic environment variable support (uppercase with underscores) +- Support both single-level and nested configuration keys +- Consider adding configuration schema validation in future +- Environment variable format: `SERVER_PORT`, `DATABASE_DSN`, etc. +- Configuration files should be in YAML for readability +- Support secret manager integration placeholder (Phase 6) + +## Testing +```bash +# Test configuration loading +go test ./internal/config/... + +# Test type-safe getters +go run -c "test config getters" + +# Test environment variable overrides +export SERVER_PORT=9090 +go run cmd/platform/main.go +``` + +## Files to Create/Modify +- `pkg/config/config.go` - Configuration interface +- `internal/config/config.go` - Viper implementation +- `internal/config/loader.go` - Configuration loader +- `config/default.yaml` - Base configuration +- `config/development.yaml` - Development configuration +- `config/production.yaml` - Production configuration +- `internal/di/providers.go` - Add config provider + diff --git a/docs/content/stories/phase0/0.2.1-install-config-dependencies.md b/docs/content/stories/phase0/0.2.1-install-config-dependencies.md deleted file mode 100644 index 667f1be..0000000 --- a/docs/content/stories/phase0/0.2.1-install-config-dependencies.md +++ /dev/null @@ -1,47 +0,0 @@ -# Task 0.2.1: Install Configuration Dependencies - -## Metadata -- **Task ID**: 0.2.1 -- **Title**: Install Configuration Dependencies -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.2 Configuration System -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 5 minutes -- **Dependencies**: 0.1.1 - -## Description -Install Viper and Cobra packages for configuration management and CLI support. - -## Requirements -- Install `github.com/spf13/viper` v1.18.0+ -- Install `github.com/spf13/cobra` v1.8.0+ -- Add to `go.mod` with proper version constraints - -## Implementation Steps -1. Run `go get github.com/spf13/viper@v1.18.0` -2. Run `go get github.com/spf13/cobra@v1.8.0` -3. Run `go mod tidy` to update dependencies -4. Verify packages in `go.mod` - -## Acceptance Criteria -- [ ] Viper is listed in `go.mod` -- [ ] Cobra is listed in `go.mod` -- [ ] `go mod verify` passes -- [ ] Dependencies are properly versioned - -## Related ADRs -- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md) - -## Implementation Notes -- Use specific versions for reproducibility -- Consider using `go get -u` for latest patch versions -- Document version choices in ADR - -## Testing -```bash -go mod verify -go list -m github.com/spf13/viper -go list -m github.com/spf13/cobra -``` - diff --git a/docs/content/stories/phase0/0.2.1-install-githubcomspf13viper-and-githubcomspf13cobr.md b/docs/content/stories/phase0/0.2.1-install-githubcomspf13viper-and-githubcomspf13cobr.md deleted file mode 100644 index 667f1be..0000000 --- a/docs/content/stories/phase0/0.2.1-install-githubcomspf13viper-and-githubcomspf13cobr.md +++ /dev/null @@ -1,47 +0,0 @@ -# Task 0.2.1: Install Configuration Dependencies - -## Metadata -- **Task ID**: 0.2.1 -- **Title**: Install Configuration Dependencies -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.2 Configuration System -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 5 minutes -- **Dependencies**: 0.1.1 - -## Description -Install Viper and Cobra packages for configuration management and CLI support. - -## Requirements -- Install `github.com/spf13/viper` v1.18.0+ -- Install `github.com/spf13/cobra` v1.8.0+ -- Add to `go.mod` with proper version constraints - -## Implementation Steps -1. Run `go get github.com/spf13/viper@v1.18.0` -2. Run `go get github.com/spf13/cobra@v1.8.0` -3. Run `go mod tidy` to update dependencies -4. Verify packages in `go.mod` - -## Acceptance Criteria -- [ ] Viper is listed in `go.mod` -- [ ] Cobra is listed in `go.mod` -- [ ] `go mod verify` passes -- [ ] Dependencies are properly versioned - -## Related ADRs -- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md) - -## Implementation Notes -- Use specific versions for reproducibility -- Consider using `go get -u` for latest patch versions -- Document version choices in ADR - -## Testing -```bash -go mod verify -go list -m github.com/spf13/viper -go list -m github.com/spf13/cobra -``` - diff --git a/docs/content/stories/phase0/0.2.2-create-config-interface.md b/docs/content/stories/phase0/0.2.2-create-config-interface.md deleted file mode 100644 index a039a4c..0000000 --- a/docs/content/stories/phase0/0.2.2-create-config-interface.md +++ /dev/null @@ -1,59 +0,0 @@ -# Task 0.2.2: Create Config Interface - -## Metadata -- **Task ID**: 0.2.2 -- **Title**: Create Config Interface -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.2 Configuration System -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 15 minutes -- **Dependencies**: 0.2.1 - -## Description -Create the `ConfigProvider` interface in `pkg/config/` to abstract configuration access. This interface will be used by all modules and services. - -## Requirements -- Define interface in `pkg/config/config.go` -- Include methods for type-safe access -- Support nested configuration keys -- Support unmarshaling into structs - -## Implementation Steps -1. Create `pkg/config/config.go` -2. Define `ConfigProvider` interface: - ```go - type ConfigProvider interface { - Get(key string) any - Unmarshal(v any) error - GetString(key string) string - GetInt(key string) int - GetBool(key string) bool - GetStringSlice(key string) []string - } - ``` -3. Add package documentation -4. Export interface for use by modules - -## Acceptance Criteria -- [ ] `pkg/config/config.go` exists -- [ ] `ConfigProvider` interface is defined -- [ ] Interface methods match requirements -- [ ] Package documentation is present -- [ ] Interface compiles without errors - -## Related ADRs -- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md) - -## Implementation Notes -- Interface should be minimal and focused -- Additional methods can be added later if needed -- Consider adding `GetDuration()` for time.Duration values -- Consider adding `IsSet(key string) bool` to check if key exists - -## Testing -```bash -go build ./pkg/config -go vet ./pkg/config -``` - diff --git a/docs/content/stories/phase0/0.2.2-create-pkgconfigconfiggo-interface.md b/docs/content/stories/phase0/0.2.2-create-pkgconfigconfiggo-interface.md deleted file mode 100644 index a039a4c..0000000 --- a/docs/content/stories/phase0/0.2.2-create-pkgconfigconfiggo-interface.md +++ /dev/null @@ -1,59 +0,0 @@ -# Task 0.2.2: Create Config Interface - -## Metadata -- **Task ID**: 0.2.2 -- **Title**: Create Config Interface -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.2 Configuration System -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 15 minutes -- **Dependencies**: 0.2.1 - -## Description -Create the `ConfigProvider` interface in `pkg/config/` to abstract configuration access. This interface will be used by all modules and services. - -## Requirements -- Define interface in `pkg/config/config.go` -- Include methods for type-safe access -- Support nested configuration keys -- Support unmarshaling into structs - -## Implementation Steps -1. Create `pkg/config/config.go` -2. Define `ConfigProvider` interface: - ```go - type ConfigProvider interface { - Get(key string) any - Unmarshal(v any) error - GetString(key string) string - GetInt(key string) int - GetBool(key string) bool - GetStringSlice(key string) []string - } - ``` -3. Add package documentation -4. Export interface for use by modules - -## Acceptance Criteria -- [ ] `pkg/config/config.go` exists -- [ ] `ConfigProvider` interface is defined -- [ ] Interface methods match requirements -- [ ] Package documentation is present -- [ ] Interface compiles without errors - -## Related ADRs -- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md) - -## Implementation Notes -- Interface should be minimal and focused -- Additional methods can be added later if needed -- Consider adding `GetDuration()` for time.Duration values -- Consider adding `IsSet(key string) bool` to check if key exists - -## Testing -```bash -go build ./pkg/config -go vet ./pkg/config -``` - diff --git a/docs/content/stories/phase0/0.2.3-implement-config-loader.md b/docs/content/stories/phase0/0.2.3-implement-config-loader.md deleted file mode 100644 index 24e1883..0000000 --- a/docs/content/stories/phase0/0.2.3-implement-config-loader.md +++ /dev/null @@ -1,60 +0,0 @@ -# Task 0.2.3: Implement Config Loader - -## Metadata -- **Task ID**: 0.2.3 -- **Title**: Implement Config Loader -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.2 Configuration System -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 30 minutes -- **Dependencies**: 0.2.1, 0.2.2 - -## Description -Implement the Viper-based configuration loader in `internal/config/` that implements the `ConfigProvider` interface. This loader will handle hierarchical configuration loading from files and environment variables. - -## Requirements -- Implement `ConfigProvider` interface using Viper -- Load configuration in order: defaults → environment-specific → env vars -- Support YAML configuration files -- Support environment variable overrides -- Provide placeholder for secret manager integration (Phase 6) - -## Implementation Steps -1. Create `internal/config/config.go`: - - Implement `ConfigProvider` interface - - Wrap Viper instance - - Implement all interface methods -2. Create `internal/config/loader.go`: - - `LoadConfig()` function - - Load `config/default.yaml` as baseline - - Merge environment-specific YAML (development/production) - - Apply environment variable overrides - - Set up automatic environment variable binding -3. Add error handling for missing config files -4. Add logging for configuration loading - -## Acceptance Criteria -- [ ] `internal/config/config.go` implements `ConfigProvider` -- [ ] `internal/config/loader.go` has `LoadConfig()` function -- [ ] Configuration loads from `config/default.yaml` -- [ ] Environment-specific configs are merged correctly -- [ ] Environment variables override file values -- [ ] Errors are handled gracefully - -## Related ADRs -- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md) - -## Implementation Notes -- Use Viper's `SetConfigName()` and `AddConfigPath()` -- Use `MergeInConfig()` for environment-specific files -- Use `AutomaticEnv()` for environment variable binding -- Set environment variable prefix (e.g., `GOPLT_`) -- Use `SetEnvKeyReplacer()` to replace dots with underscores - -## Testing -```bash -# Test config loading -go test ./internal/config -v -``` - diff --git a/docs/content/stories/phase0/0.2.3-implement-internalconfigconfiggo-using-viper.md b/docs/content/stories/phase0/0.2.3-implement-internalconfigconfiggo-using-viper.md deleted file mode 100644 index 24e1883..0000000 --- a/docs/content/stories/phase0/0.2.3-implement-internalconfigconfiggo-using-viper.md +++ /dev/null @@ -1,60 +0,0 @@ -# Task 0.2.3: Implement Config Loader - -## Metadata -- **Task ID**: 0.2.3 -- **Title**: Implement Config Loader -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.2 Configuration System -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 30 minutes -- **Dependencies**: 0.2.1, 0.2.2 - -## Description -Implement the Viper-based configuration loader in `internal/config/` that implements the `ConfigProvider` interface. This loader will handle hierarchical configuration loading from files and environment variables. - -## Requirements -- Implement `ConfigProvider` interface using Viper -- Load configuration in order: defaults → environment-specific → env vars -- Support YAML configuration files -- Support environment variable overrides -- Provide placeholder for secret manager integration (Phase 6) - -## Implementation Steps -1. Create `internal/config/config.go`: - - Implement `ConfigProvider` interface - - Wrap Viper instance - - Implement all interface methods -2. Create `internal/config/loader.go`: - - `LoadConfig()` function - - Load `config/default.yaml` as baseline - - Merge environment-specific YAML (development/production) - - Apply environment variable overrides - - Set up automatic environment variable binding -3. Add error handling for missing config files -4. Add logging for configuration loading - -## Acceptance Criteria -- [ ] `internal/config/config.go` implements `ConfigProvider` -- [ ] `internal/config/loader.go` has `LoadConfig()` function -- [ ] Configuration loads from `config/default.yaml` -- [ ] Environment-specific configs are merged correctly -- [ ] Environment variables override file values -- [ ] Errors are handled gracefully - -## Related ADRs -- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md) - -## Implementation Notes -- Use Viper's `SetConfigName()` and `AddConfigPath()` -- Use `MergeInConfig()` for environment-specific files -- Use `AutomaticEnv()` for environment variable binding -- Set environment variable prefix (e.g., `GOPLT_`) -- Use `SetEnvKeyReplacer()` to replace dots with underscores - -## Testing -```bash -# Test config loading -go test ./internal/config -v -``` - diff --git a/docs/content/stories/phase0/0.2.4-create-configdefaultyaml-with-basic-structure.md b/docs/content/stories/phase0/0.2.4-create-configdefaultyaml-with-basic-structure.md deleted file mode 100644 index c6f3f6e..0000000 --- a/docs/content/stories/phase0/0.2.4-create-configdefaultyaml-with-basic-structure.md +++ /dev/null @@ -1,67 +0,0 @@ -# Task 0.2.4: Create Configuration Files - -## Metadata -- **Task ID**: 0.2.4 -- **Title**: Create Configuration Files -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.2 Configuration System -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 15 minutes -- **Dependencies**: 0.1.2 - -## Description -Create the baseline configuration YAML files that define the default configuration structure for the platform. - -## Requirements -- Create `config/default.yaml` with baseline values -- Create `config/development.yaml` with development overrides -- Create `config/production.yaml` with production overrides -- Define configuration schema for all core services - -## Implementation Steps -1. Create `config/default.yaml`: - ```yaml - environment: development - server: - port: 8080 - host: "0.0.0.0" - database: - driver: "postgres" - dsn: "" - logging: - level: "info" - format: "json" - ``` -2. Create `config/development.yaml`: - - Override logging level to "debug" - - Add development-specific settings -3. Create `config/production.yaml`: - - Override logging level to "warn" - - Add production-specific settings -4. Document configuration options - -## Acceptance Criteria -- [ ] `config/default.yaml` exists with complete structure -- [ ] `config/development.yaml` exists -- [ ] `config/production.yaml` exists -- [ ] All configuration files are valid YAML -- [ ] Configuration structure is documented - -## Related ADRs -- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md) - -## Implementation Notes -- Use consistent indentation (2 spaces) -- Add comments for unclear configuration options -- Use environment variables for sensitive values (DSN, secrets) -- Consider adding validation schema later - -## Testing -```bash -# Validate YAML syntax -yamllint config/*.yaml -# or -python3 -c "import yaml; yaml.safe_load(open('config/default.yaml'))" -``` - diff --git a/docs/content/stories/phase0/0.2.4-create-configuration-files.md b/docs/content/stories/phase0/0.2.4-create-configuration-files.md deleted file mode 100644 index c6f3f6e..0000000 --- a/docs/content/stories/phase0/0.2.4-create-configuration-files.md +++ /dev/null @@ -1,67 +0,0 @@ -# Task 0.2.4: Create Configuration Files - -## Metadata -- **Task ID**: 0.2.4 -- **Title**: Create Configuration Files -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.2 Configuration System -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 15 minutes -- **Dependencies**: 0.1.2 - -## Description -Create the baseline configuration YAML files that define the default configuration structure for the platform. - -## Requirements -- Create `config/default.yaml` with baseline values -- Create `config/development.yaml` with development overrides -- Create `config/production.yaml` with production overrides -- Define configuration schema for all core services - -## Implementation Steps -1. Create `config/default.yaml`: - ```yaml - environment: development - server: - port: 8080 - host: "0.0.0.0" - database: - driver: "postgres" - dsn: "" - logging: - level: "info" - format: "json" - ``` -2. Create `config/development.yaml`: - - Override logging level to "debug" - - Add development-specific settings -3. Create `config/production.yaml`: - - Override logging level to "warn" - - Add production-specific settings -4. Document configuration options - -## Acceptance Criteria -- [ ] `config/default.yaml` exists with complete structure -- [ ] `config/development.yaml` exists -- [ ] `config/production.yaml` exists -- [ ] All configuration files are valid YAML -- [ ] Configuration structure is documented - -## Related ADRs -- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md) - -## Implementation Notes -- Use consistent indentation (2 spaces) -- Add comments for unclear configuration options -- Use environment variables for sensitive values (DSN, secrets) -- Consider adding validation schema later - -## Testing -```bash -# Validate YAML syntax -yamllint config/*.yaml -# or -python3 -c "import yaml; yaml.safe_load(open('config/default.yaml'))" -``` - diff --git a/docs/content/stories/phase0/0.2.5-add-internalconfigloadergo-with-loadconfig-functio.md b/docs/content/stories/phase0/0.2.5-add-internalconfigloadergo-with-loadconfig-functio.md deleted file mode 100644 index 546b6a3..0000000 --- a/docs/content/stories/phase0/0.2.5-add-internalconfigloadergo-with-loadconfig-functio.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 0.2.5: Add `internal/config/loader.go` with `LoadConfig()` function - -## Metadata -- **Task ID**: 0.2.5 -- **Title**: Add `internal/config/loader.go` with `LoadConfig()` function -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add `internal/config/loader.go` with `LoadConfig()` function - -## Requirements -- Add `internal/config/loader.go` with `LoadConfig()` function - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.2.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase0/0.3-structured-logging-system.md b/docs/content/stories/phase0/0.3-structured-logging-system.md new file mode 100644 index 0000000..effd530 --- /dev/null +++ b/docs/content/stories/phase0/0.3-structured-logging-system.md @@ -0,0 +1,136 @@ +# Story 0.3: Structured Logging System + +## Metadata +- **Story ID**: 0.3 +- **Title**: Structured Logging System +- **Phase**: 0 - Project Setup & Foundation +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 4-6 hours +- **Dependencies**: 0.1, 0.2 + +## Goal +Implement a production-ready logging system with structured JSON output, request correlation, and configurable log levels that can be used by all modules. + +## Description +This story implements a complete logging system using Zap that provides structured logging, request correlation via request IDs, and context-aware logging. The system must support both development (human-readable) and production (JSON) formats. + +## Deliverables + +### 1. Logger Interface (`pkg/logger/logger.go`) +Define `Logger` interface with: +- `Debug(msg string, fields ...Field)` - Debug level logging +- `Info(msg string, fields ...Field)` - Info level logging +- `Warn(msg string, fields ...Field)` - Warning level logging +- `Error(msg string, fields ...Field)` - Error level logging +- `With(fields ...Field) Logger` - Create child logger with fields +- `WithContext(ctx context.Context) Logger` - Create logger with context fields +- `Field` type for structured fields +- Package-level convenience functions + +### 2. Zap Implementation (`internal/logger/zap_logger.go`) +Implement `Logger` interface using Zap: +- Structured JSON logging for production mode +- Human-readable console logging for development mode +- Configurable log levels (debug, info, warn, error) +- Request-scoped fields support +- Context-aware logging (extract request ID, user ID from context) +- Field mapping to Zap fields +- Error stack trace support + +### 3. Request ID Middleware (`internal/logger/middleware.go`) +Gin middleware for request correlation: +- Generate unique request ID per HTTP request +- Add request ID to request context +- Add request ID to all logs within request context +- Return request ID in response headers (`X-Request-ID`) +- Support for existing request IDs in headers + +### 4. Global Logger Export (`pkg/logger/global.go`) +- Export default logger instance +- Package-level convenience functions +- Thread-safe logger access + +### 5. DI Integration +- Provider function for Logger +- Register in DI container +- Make configurable via FX + +## Implementation Steps + +1. **Install Dependencies** + ```bash + go get go.uber.org/zap@v1.26.0 + ``` + +2. **Create Logger Interface** + - Define `Logger` interface in `pkg/logger/logger.go` + - Define `Field` type for structured fields + - Add package documentation + +3. **Implement Zap Logger** + - Create `internal/logger/zap_logger.go` + - Implement all interface methods + - Support both JSON and console encoders + - Handle log levels and field mapping + +4. **Create Request ID Middleware** + - Create `internal/logger/middleware.go` + - Implement Gin middleware + - Generate and propagate request IDs + - Add to response headers + +5. **Add Global Logger** + - Create `pkg/logger/global.go` + - Export default logger + - Add convenience functions + +6. **Integrate with DI** + - Create provider function + - Register in DI container + - Test injection + +## Acceptance Criteria +- [ ] `Logger` interface is defined and documented +- [ ] Zap implementation supports JSON and console formats +- [ ] Log levels are configurable and respected +- [ ] Request IDs are generated and included in all logs +- [ ] Request ID middleware works with Gin +- [ ] Context-aware logging extracts request ID and user ID +- [ ] Logger can be injected via DI container +- [ ] All modules can use logger through interface +- [ ] Request correlation works across service boundaries +- [ ] Structured fields work correctly + +## Related ADRs +- [ADR-0005: Logging Framework](../../adr/0005-logging-framework.md) +- [ADR-0012: Logger Interface Design](../../adr/0012-logger-interface-design.md) + +## Implementation Notes +- Use Zap's production and development presets +- Request IDs should be UUIDs or similar unique identifiers +- Context should be propagated through all service calls +- Log levels should be configurable via configuration system +- Consider adding log sampling for high-volume production +- Support for log rotation and file output (future enhancement) + +## Testing +```bash +# Test logger interface +go test ./pkg/logger/... + +# Test Zap implementation +go test ./internal/logger/... + +# Test request ID middleware +go test ./internal/logger/... -run TestRequestIDMiddleware +``` + +## Files to Create/Modify +- `pkg/logger/logger.go` - Logger interface +- `pkg/logger/global.go` - Global logger export +- `internal/logger/zap_logger.go` - Zap implementation +- `internal/logger/middleware.go` - Request ID middleware +- `internal/di/providers.go` - Add logger provider +- `config/default.yaml` - Add logging configuration + diff --git a/docs/content/stories/phase0/0.3.1-install-gouberorgzap.md b/docs/content/stories/phase0/0.3.1-install-gouberorgzap.md deleted file mode 100644 index 972bbd9..0000000 --- a/docs/content/stories/phase0/0.3.1-install-gouberorgzap.md +++ /dev/null @@ -1,33 +0,0 @@ -# Task 0.3.1: Install Logging Dependencies - -## Metadata -- **Task ID**: 0.3.1 -- **Title**: Install Logging Dependencies -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.3 Logging Foundation -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 5 minutes -- **Dependencies**: 0.1.1 - -## Description -Install the Zap logging library for structured logging. - -## Requirements -- Install `go.uber.org/zap` v1.26.0+ -- Add to `go.mod` with proper version constraints - -## Implementation Steps -1. Run `go get go.uber.org/zap@v1.26.0` -2. Run `go mod tidy` -3. Verify package in `go.mod` - -## Acceptance Criteria -- [ ] Zap is listed in `go.mod` -- [ ] Version is v1.26.0 or later -- [ ] `go mod verify` passes - -## Related ADRs -- [ADR-0005: Logging Framework](../../adr/0005-logging-framework.md) -- [ADR-0012: Logger Interface Design](../../adr/0012-logger-interface-design.md) - diff --git a/docs/content/stories/phase0/0.3.1-install-logging-dependencies.md b/docs/content/stories/phase0/0.3.1-install-logging-dependencies.md deleted file mode 100644 index 972bbd9..0000000 --- a/docs/content/stories/phase0/0.3.1-install-logging-dependencies.md +++ /dev/null @@ -1,33 +0,0 @@ -# Task 0.3.1: Install Logging Dependencies - -## Metadata -- **Task ID**: 0.3.1 -- **Title**: Install Logging Dependencies -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.3 Logging Foundation -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: 5 minutes -- **Dependencies**: 0.1.1 - -## Description -Install the Zap logging library for structured logging. - -## Requirements -- Install `go.uber.org/zap` v1.26.0+ -- Add to `go.mod` with proper version constraints - -## Implementation Steps -1. Run `go get go.uber.org/zap@v1.26.0` -2. Run `go mod tidy` -3. Verify package in `go.mod` - -## Acceptance Criteria -- [ ] Zap is listed in `go.mod` -- [ ] Version is v1.26.0 or later -- [ ] `go mod verify` passes - -## Related ADRs -- [ADR-0005: Logging Framework](../../adr/0005-logging-framework.md) -- [ADR-0012: Logger Interface Design](../../adr/0012-logger-interface-design.md) - diff --git a/docs/content/stories/phase0/0.3.2-create-pkgloggerloggergo-interface.md b/docs/content/stories/phase0/0.3.2-create-pkgloggerloggergo-interface.md deleted file mode 100644 index 75e679a..0000000 --- a/docs/content/stories/phase0/0.3.2-create-pkgloggerloggergo-interface.md +++ /dev/null @@ -1,52 +0,0 @@ -# Task 0.3.2: Create `pkg/logger/logger.go` interface: - -## Metadata -- **Task ID**: 0.3.2 -- **Title**: Create `pkg/logger/logger.go` interface: -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/logger/logger.go` interface: - -## Requirements -- Create `pkg/logger/logger.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.3.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Logger interface { - Debug(msg string, fields ...Field) - Info(msg string, fields ...Field) - Warn(msg string, fields ...Field) - Error(msg string, fields ...Field) - With(fields ...Field) Logger - } -``` diff --git a/docs/content/stories/phase0/0.3.3-implement-internalloggerzap_loggergo.md b/docs/content/stories/phase0/0.3.3-implement-internalloggerzap_loggergo.md deleted file mode 100644 index b4f7310..0000000 --- a/docs/content/stories/phase0/0.3.3-implement-internalloggerzap_loggergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 0.3.3: Implement `internal/logger/zap_logger.go`: - -## Metadata -- **Task ID**: 0.3.3 -- **Title**: Implement `internal/logger/zap_logger.go`: -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/logger/zap_logger.go`: - -## Requirements -- Implement `internal/logger/zap_logger.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.3.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase0/0.3.4-add-request-id-middleware-helper-gin-middleware.md b/docs/content/stories/phase0/0.3.4-add-request-id-middleware-helper-gin-middleware.md deleted file mode 100644 index c13a130..0000000 --- a/docs/content/stories/phase0/0.3.4-add-request-id-middleware-helper-gin-middleware.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 0.3.4: Add request ID middleware helper (Gin middleware) - -## Metadata -- **Task ID**: 0.3.4 -- **Title**: Add request ID middleware helper (Gin middleware) -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add request ID middleware helper (Gin middleware) - -## Requirements -- Add request ID middleware helper (Gin middleware) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.3.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase0/0.4-cicd-pipeline.md b/docs/content/stories/phase0/0.4-cicd-pipeline.md new file mode 100644 index 0000000..c2d5f0b --- /dev/null +++ b/docs/content/stories/phase0/0.4-cicd-pipeline.md @@ -0,0 +1,126 @@ +# Story 0.4: CI/CD Pipeline and Development Tooling + +## Metadata +- **Story ID**: 0.4 +- **Title**: CI/CD Pipeline and Development Tooling +- **Phase**: 0 - Project Setup & Foundation +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 3-4 hours +- **Dependencies**: 0.1 + +## Goal +Establish automated testing, linting, and build processes with a developer-friendly Makefile that enables efficient development workflow. + +## Description +This story sets up the complete CI/CD pipeline using GitHub Actions and provides a comprehensive Makefile with common development commands. The pipeline should run on every push and pull request, ensuring code quality and buildability. + +## Deliverables + +### 1. GitHub Actions Workflow (`.github/workflows/ci.yml`) +Complete CI pipeline with: +- Go 1.24 setup +- Go module caching for faster builds +- Linting with golangci-lint or staticcheck +- Unit tests execution +- Test coverage reporting +- Binary build validation +- Code formatting validation (gofmt) +- Artifact uploads for build outputs + +### 2. Comprehensive Makefile +Developer-friendly Makefile with commands: +- `make test` - Run all tests +- `make test-coverage` - Run tests with coverage report +- `make lint` - Run linters +- `make fmt` - Format code +- `make fmt-check` - Check code formatting +- `make build` - Build platform binary +- `make clean` - Clean build artifacts +- `make docker-build` - Build Docker image +- `make docker-run` - Run Docker container +- `make generate` - Run code generation +- `make verify` - Verify code (fmt, lint, test) +- `make help` - Show available commands + +### 3. Linter Configuration +- `.golangci.yml` or similar linter config +- Configured rules and exclusions +- Reasonable defaults for Go projects + +### 4. Pre-commit Hooks (Optional) +- Git hooks for formatting and linting +- Prevent committing unformatted code + +## Implementation Steps + +1. **Create GitHub Actions Workflow** + - Create `.github/workflows/ci.yml` + - Set up Go environment + - Configure module caching + - Add linting step + - Add testing step + - Add build step + - Add artifact uploads + +2. **Create Makefile** + - Define common variables (GO, BINARY_NAME, etc.) + - Add test target + - Add lint target + - Add build target + - Add format targets + - Add Docker targets + - Add help target + +3. **Configure Linter** + - Install golangci-lint or configure staticcheck + - Create linter configuration file + - Set up reasonable rules + +4. **Test CI Pipeline** + - Push changes to trigger CI + - Verify all steps pass + - Check artifact uploads + +## Acceptance Criteria +- [ ] CI pipeline runs on every push and PR +- [ ] All linting checks pass +- [ ] Tests run successfully (even if empty initially) +- [ ] Binary builds successfully +- [ ] Docker image builds successfully +- [ ] Makefile commands work as expected +- [ ] CI pipeline fails fast on errors +- [ ] Code formatting is validated +- [ ] Test coverage is reported +- [ ] Artifacts are uploaded correctly + +## Related ADRs +- [ADR-0010: CI/CD Platform](../../adr/0010-ci-cd-platform.md) + +## Implementation Notes +- Use Go 1.24 in CI to match project requirements +- Cache Go modules to speed up CI runs +- Use golangci-lint for comprehensive linting +- Set up test coverage threshold (e.g., 80%) +- Make sure CI fails on any error +- Consider adding security scanning (gosec) in future +- Docker builds should use multi-stage builds + +## Testing +```bash +# Test Makefile commands +make test +make lint +make build +make clean + +# Test CI locally (using act or similar) +act push +``` + +## Files to Create/Modify +- `.github/workflows/ci.yml` - GitHub Actions workflow +- `Makefile` - Development commands +- `.golangci.yml` - Linter configuration (optional) +- `.git/hooks/pre-commit` - Pre-commit hooks (optional) + diff --git a/docs/content/stories/phase0/0.4.1-create-githubworkflowsciyml.md b/docs/content/stories/phase0/0.4.1-create-githubworkflowsciyml.md deleted file mode 100644 index ba25c3c..0000000 --- a/docs/content/stories/phase0/0.4.1-create-githubworkflowsciyml.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 0.4.1: Create `.github/workflows/ci.yml`: - -## Metadata -- **Task ID**: 0.4.1 -- **Title**: Create `.github/workflows/ci.yml`: -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `.github/workflows/ci.yml`: - -## Requirements -- Create `.github/workflows/ci.yml`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.4.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase0/0.4.2-add-makefile-with-common-commands.md b/docs/content/stories/phase0/0.4.2-add-makefile-with-common-commands.md deleted file mode 100644 index dca0d59..0000000 --- a/docs/content/stories/phase0/0.4.2-add-makefile-with-common-commands.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 0.4.2: Add `Makefile` with common commands: - -## Metadata -- **Task ID**: 0.4.2 -- **Title**: Add `Makefile` with common commands: -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add `Makefile` with common commands: - -## Requirements -- Add `Makefile` with common commands: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.4.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase0/0.5-di-and-bootstrap.md b/docs/content/stories/phase0/0.5-di-and-bootstrap.md new file mode 100644 index 0000000..4793a6f --- /dev/null +++ b/docs/content/stories/phase0/0.5-di-and-bootstrap.md @@ -0,0 +1,122 @@ +# Story 0.5: Dependency Injection and Application Bootstrap + +## Metadata +- **Story ID**: 0.5 +- **Title**: Dependency Injection and Application Bootstrap +- **Phase**: 0 - Project Setup & Foundation +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 4-5 hours +- **Dependencies**: 0.1, 0.2, 0.3 + +## Goal +Set up dependency injection container using Uber FX and create the application entry point that initializes the platform with proper lifecycle management. + +## Description +This story implements the dependency injection system using Uber FX and creates the main application entry point. The DI container will manage service lifecycle, dependencies, and provide a clean way to wire services together. + +## Deliverables + +### 1. DI Container (`internal/di/container.go`) +FX-based dependency injection container: +- Initialize FX container +- Register Config and Logger providers +- Basic lifecycle hooks (OnStart, OnStop) +- Support service overrides for testing +- Graceful shutdown handling + +### 2. DI Providers (`internal/di/providers.go`) +Provider functions for core services: +- `ProvideConfig() fx.Option` - Configuration provider +- `ProvideLogger() fx.Option` - Logger provider +- Provider functions return FX options for easy composition + +### 3. Application Entry Point (`cmd/platform/main.go`) +Main application bootstrap: +- Load configuration +- Initialize DI container with core services +- Set up basic application lifecycle +- Start minimal HTTP server (placeholder for Phase 1) +- Handle graceful shutdown (SIGINT, SIGTERM) +- Proper error handling and logging + +### 4. Core Module (`internal/di/core_module.go`) +Optional: Export core module as FX option: +- `CoreModule() fx.Option` - Provides all core services +- Easy to compose with future modules + +## Implementation Steps + +1. **Install Dependencies** + ```bash + go get go.uber.org/fx@latest + ``` + +2. **Create DI Container** + - Create `internal/di/container.go` + - Initialize FX app + - Set up lifecycle hooks + - Add graceful shutdown + +3. **Create Provider Functions** + - Create `internal/di/providers.go` + - Implement `ProvideConfig()` function + - Implement `ProvideLogger()` function + - Return FX options + +4. **Create Application Entry Point** + - Create `cmd/platform/main.go` + - Load configuration + - Initialize FX app with providers + - Set up signal handling + - Start minimal server (placeholder) + - Handle shutdown gracefully + +5. **Test Application** + - Verify application starts + - Verify graceful shutdown works + - Test service injection + +## Acceptance Criteria +- [ ] DI container initializes successfully +- [ ] Config and Logger are provided via DI +- [ ] Application starts and runs +- [ ] Application shuts down gracefully on signals +- [ ] Lifecycle hooks work correctly +- [ ] Services can be overridden for testing +- [ ] Application compiles and runs successfully +- [ ] Error handling is comprehensive +- [ ] Logging works during startup/shutdown + +## Related ADRs +- [ADR-0003: Dependency Injection Framework](../../adr/0003-dependency-injection-framework.md) + +## Implementation Notes +- Use FX for dependency injection and lifecycle management +- Support graceful shutdown with context cancellation +- Handle SIGINT and SIGTERM signals +- Log startup and shutdown events +- Make services easily testable via interfaces +- Consider adding health check endpoint in future +- Support for service overrides is important for testing + +## Testing +```bash +# Test application startup +go run cmd/platform/main.go + +# Test graceful shutdown +# Start app, then send SIGTERM +kill -TERM + +# Test DI container +go test ./internal/di/... +``` + +## Files to Create/Modify +- `internal/di/container.go` - DI container +- `internal/di/providers.go` - Provider functions +- `internal/di/core_module.go` - Core module (optional) +- `cmd/platform/main.go` - Application entry point +- `go.mod` - Add FX dependency + diff --git a/docs/content/stories/phase0/0.5.1-install-gouberorgfx.md b/docs/content/stories/phase0/0.5.1-install-gouberorgfx.md deleted file mode 100644 index 195db41..0000000 --- a/docs/content/stories/phase0/0.5.1-install-gouberorgfx.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 0.5.1: Install `go.uber.org/fx` - -## Metadata -- **Task ID**: 0.5.1 -- **Title**: Install `go.uber.org/fx` -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `go.uber.org/fx` - -## Requirements -- Install `go.uber.org/fx` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.5.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase0/0.5.2-create-internaldicontainergo.md b/docs/content/stories/phase0/0.5.2-create-internaldicontainergo.md deleted file mode 100644 index 25b02dd..0000000 --- a/docs/content/stories/phase0/0.5.2-create-internaldicontainergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 0.5.2: Create `internal/di/container.go`: - -## Metadata -- **Task ID**: 0.5.2 -- **Title**: Create `internal/di/container.go`: -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/di/container.go`: - -## Requirements -- Create `internal/di/container.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.5.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase0/0.5.3-create-cmdplatformmaingo-skeleton.md b/docs/content/stories/phase0/0.5.3-create-cmdplatformmaingo-skeleton.md deleted file mode 100644 index d51fc32..0000000 --- a/docs/content/stories/phase0/0.5.3-create-cmdplatformmaingo-skeleton.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 0.5.3: Create `cmd/platform/main.go` skeleton: - -## Metadata -- **Task ID**: 0.5.3 -- **Title**: Create `cmd/platform/main.go` skeleton: -- **Phase**: 0 - Project Setup & Foundation -- **Section**: 0.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `cmd/platform/main.go` skeleton: - -## Requirements -- Create `cmd/platform/main.go` skeleton: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 0.5.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase0/README.md b/docs/content/stories/phase0/README.md index 3f1d02e..4b34f02 100644 --- a/docs/content/stories/phase0/README.md +++ b/docs/content/stories/phase0/README.md @@ -1,36 +1,34 @@ # Phase 0: Project Setup & Foundation ## Overview -Initialize repository structure, set up Go modules and basic tooling, create configuration management foundation, and establish CI/CD skeleton. +Initialize repository structure with proper Go project layout, implement configuration management system, establish structured logging system, set up CI/CD pipeline and development tooling, and bootstrap dependency injection and application entry point. -## Tasks +## Stories -### 0.1 Repository Bootstrap -- [0.1.1 - Initialize Go Module](./0.1.1-initialize-go-module.md) -- [0.1.2 - Create Directory Structure](./0.1.2-create-directory-structure.md) -- [0.1.3 - Add Gitignore](./0.1.3-add-gitignore.md) -- [0.1.4 - Create Initial README](./0.1.4-create-initial-readme.md) +### 0.1 Project Initialization and Repository Structure +- [Story: 0.1 - Project Initialization](./0.1-project-initialization.md) +- **Goal:** Establish a properly structured Go project with all necessary directories, configuration files, and documentation. +- **Deliverables:** Go module initialization, complete directory structure, .gitignore, comprehensive README.md -### 0.2 Configuration System -- [0.2.1 - Install Configuration Dependencies](./0.2.1-install-config-dependencies.md) -- [0.2.2 - Create Config Interface](./0.2.2-create-config-interface.md) -- [0.2.3 - Implement Config Loader](./0.2.3-implement-config-loader.md) -- [0.2.4 - Create Configuration Files](./0.2.4-create-configuration-files.md) +### 0.2 Configuration Management System +- [Story: 0.2 - Configuration Management System](./0.2-configuration-management-system.md) +- **Goal:** Implement a flexible configuration system that loads settings from YAML files, environment variables, and supports type-safe access. +- **Deliverables:** ConfigProvider interface, Viper implementation, configuration files, DI integration -### 0.3 Logging Foundation -- [0.3.1 - Install Logging Dependencies](./0.3.1-install-logging-dependencies.md) -- [0.3.2 - Create Logger Interface](./0.3.2-create-logger-interface.md) - Create `pkg/logger/logger.go` interface -- [0.3.3 - Implement Zap Logger](./0.3.3-implement-zap-logger.md) - Implement `internal/logger/zap_logger.go` -- [0.3.4 - Add Request ID Middleware](./0.3.4-add-request-id-middleware.md) - Create Gin middleware for request IDs +### 0.3 Structured Logging System +- [Story: 0.3 - Structured Logging System](./0.3-structured-logging-system.md) +- **Goal:** Implement a production-ready logging system with structured JSON output, request correlation, and configurable log levels. +- **Deliverables:** Logger interface, Zap implementation, request ID middleware, context-aware logging -### 0.4 Basic CI/CD Pipeline -- [0.4.1 - Create GitHub Actions Workflow](./0.4.1-create-github-actions-workflow.md) -- [0.4.2 - Create Makefile](./0.4.2-create-makefile.md) +### 0.4 CI/CD Pipeline and Development Tooling +- [Story: 0.4 - CI/CD Pipeline and Development Tooling](./0.4-cicd-pipeline.md) +- **Goal:** Establish automated testing, linting, and build processes with a developer-friendly Makefile. +- **Deliverables:** GitHub Actions workflow, comprehensive Makefile, build automation -### 0.5 Dependency Injection Setup -- [0.5.1 - Install FX Dependency](./0.5.1-install-fx-dependency.md) -- [0.5.2 - Create DI Container](./0.5.2-create-di-container.md) -- [0.5.3 - Create Main Entry Point](./0.5.3-create-main-entry-point.md) +### 0.5 Dependency Injection and Application Bootstrap +- [Story: 0.5 - Dependency Injection and Application Bootstrap](./0.5-di-and-bootstrap.md) +- **Goal:** Set up dependency injection container using Uber FX and create the application entry point that initializes the platform. +- **Deliverables:** DI container, FX providers, application entry point, lifecycle management ## Deliverables Checklist - [ ] Repository structure in place @@ -44,4 +42,5 @@ Initialize repository structure, set up Go modules and basic tooling, create con - `go test ./...` runs (even if tests are empty) - CI pipeline passes on empty commit - Config loads from `config/default.yaml` - +- Logger can be injected and used +- Application starts and shuts down gracefully diff --git a/docs/content/stories/phase1/1.1-enhanced-di-container.md b/docs/content/stories/phase1/1.1-enhanced-di-container.md new file mode 100644 index 0000000..664128a --- /dev/null +++ b/docs/content/stories/phase1/1.1-enhanced-di-container.md @@ -0,0 +1,95 @@ +# Story 1.1: Enhanced Dependency Injection Container + +## Metadata +- **Story ID**: 1.1 +- **Title**: Enhanced Dependency Injection Container +- **Phase**: 1 - Core Kernel & Infrastructure +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 3-4 hours +- **Dependencies**: 0.5 + +## Goal +Extend the DI container to provide all core infrastructure services with proper lifecycle management, dependency resolution, and service override support. + +## Description +This story extends the basic DI container to support all core services including database, health checks, metrics, and error bus. The container must handle service initialization order, lifecycle management, and provide a clean way to override services for testing. + +## Deliverables + +### 1. Extended DI Container (`internal/di/container.go`) +- Registration of all core services +- Lifecycle management via FX +- Service override support for testing +- Dependency resolution +- Error handling during initialization + +### 2. Provider Functions (`internal/di/providers.go`) +Complete provider functions for all core services: +- `ProvideConfig() fx.Option` - Configuration provider +- `ProvideLogger() fx.Option` - Logger provider +- `ProvideDatabase() fx.Option` - Ent database client provider +- `ProvideHealthCheckers() fx.Option` - Health check registry provider +- `ProvideMetrics() fx.Option` - Prometheus metrics registry provider +- `ProvideErrorBus() fx.Option` - Error bus provider + +### 3. Core Module (`internal/di/core_module.go`) +- Export `CoreModule() fx.Option` that provides all core services +- Easy composition with future modules +- Single import point for core services + +## Implementation Steps + +1. **Extend Container** + - Update `internal/di/container.go` + - Add support for all core services + - Implement lifecycle hooks + +2. **Create Provider Functions** + - Create `internal/di/providers.go` + - Implement all provider functions + - Handle dependencies correctly + +3. **Create Core Module** + - Create `internal/di/core_module.go` + - Export CoreModule function + - Document usage + +4. **Test Integration** + - Verify all services are provided + - Test service overrides + - Test lifecycle hooks + +## Acceptance Criteria +- [ ] All core services are provided via DI container +- [ ] Services are initialized in correct dependency order +- [ ] Lifecycle hooks work for all services +- [ ] Services can be overridden for testing +- [ ] DI container compiles without errors +- [ ] CoreModule can be imported and used +- [ ] Error handling works during initialization + +## Related ADRs +- [ADR-0003: Dependency Injection Framework](../../adr/0003-dependency-injection-framework.md) + +## Implementation Notes +- Use FX's dependency injection features +- Ensure proper initialization order +- Support service overrides via FX options +- Handle errors gracefully during startup +- Document provider functions + +## Testing +```bash +# Test DI container +go test ./internal/di/... + +# Test service injection +go run cmd/platform/main.go +``` + +## Files to Create/Modify +- `internal/di/container.go` - Extended container +- `internal/di/providers.go` - Provider functions +- `internal/di/core_module.go` - Core module export + diff --git a/docs/content/stories/phase1/1.1.1-extend-internaldicontainergo.md b/docs/content/stories/phase1/1.1.1-extend-internaldicontainergo.md deleted file mode 100644 index 49498f9..0000000 --- a/docs/content/stories/phase1/1.1.1-extend-internaldicontainergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.1.1: Extend `internal/di/container.go`: - -## Metadata -- **Task ID**: 1.1.1 -- **Title**: Extend `internal/di/container.go`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Extend `internal/di/container.go`: - -## Requirements -- Extend `internal/di/container.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.1.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.1.2-create-internaldiprovidersgo.md b/docs/content/stories/phase1/1.1.2-create-internaldiprovidersgo.md deleted file mode 100644 index 1d1b55e..0000000 --- a/docs/content/stories/phase1/1.1.2-create-internaldiprovidersgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.1.2: Create `internal/di/providers.go`: - -## Metadata -- **Task ID**: 1.1.2 -- **Title**: Create `internal/di/providers.go`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/di/providers.go`: - -## Requirements -- Create `internal/di/providers.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.1.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.1.3-add-internaldicore_modulego.md b/docs/content/stories/phase1/1.1.3-add-internaldicore_modulego.md deleted file mode 100644 index e03e12f..0000000 --- a/docs/content/stories/phase1/1.1.3-add-internaldicore_modulego.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.1.3: Add `internal/di/core_module.go`: - -## Metadata -- **Task ID**: 1.1.3 -- **Title**: Add `internal/di/core_module.go`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add `internal/di/core_module.go`: - -## Requirements -- Add `internal/di/core_module.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.1.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.2-database-layer.md b/docs/content/stories/phase1/1.2-database-layer.md new file mode 100644 index 0000000..be87a3f --- /dev/null +++ b/docs/content/stories/phase1/1.2-database-layer.md @@ -0,0 +1,144 @@ +# Story 1.2: Database Layer with Ent ORM + +## Metadata +- **Story ID**: 1.2 +- **Title**: Database Layer with Ent ORM +- **Phase**: 1 - Core Kernel & Infrastructure +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 6-8 hours +- **Dependencies**: 1.1 + +## Goal +Set up a complete database layer using Ent ORM with core domain entities, migrations, and connection management. + +## Description +This story implements the complete database layer using Ent ORM. It includes defining core domain entities (User, Role, Permission, AuditLog), setting up migrations, configuring connection pooling, and creating a database client that integrates with the DI container. + +## Deliverables + +### 1. Ent Schema Initialization +- Initialize Ent schema in `internal/ent/` +- Set up code generation + +### 2. Core Domain Entities (`internal/ent/schema/`) +Define core entities: +- **User** (`user.go`): ID, email, password_hash, verified, created_at, updated_at +- **Role** (`role.go`): ID, name, description, created_at +- **Permission** (`permission.go`): ID, name (format: "module.resource.action") +- **AuditLog** (`audit_log.go`): ID, actor_id, action, target_id, metadata (JSON), timestamp +- **Relationships**: + - `role_permissions.go` - Many-to-many between Role and Permission + - `user_roles.go` - Many-to-many between User and Role + +### 3. Generated Ent Code +- Run `go generate ./internal/ent` +- Verify generated code compiles +- Type-safe database operations + +### 4. Database Client (`internal/infra/database/client.go`) +- `NewEntClient(dsn string) (*ent.Client, error)` function +- Connection pooling configuration: + - Max connections + - Max idle connections + - Connection lifetime + - Idle timeout +- Migration runner wrapper +- Database health check integration +- Graceful connection closing + +### 5. Database Configuration +- Add database config to `config/default.yaml`: + - Connection string (DSN) + - Connection pool settings + - Migration settings + - Driver configuration + +### 6. DI Integration +- Provider function for database client +- Register in DI container +- Lifecycle management (close on shutdown) + +## Implementation Steps + +1. **Install Ent** + ```bash + go get entgo.io/ent/cmd/ent + ``` + +2. **Initialize Ent Schema** + ```bash + go run entgo.io/ent/cmd/ent init User Role Permission AuditLog + ``` + +3. **Define Core Entities** + - Create schema files for each entity + - Define fields and relationships + - Add indexes where needed + +4. **Generate Ent Code** + ```bash + go generate ./internal/ent + ``` + +5. **Create Database Client** + - Create `internal/infra/database/client.go` + - Implement connection management + - Add migration runner + - Add health check + +6. **Add Configuration** + - Update `config/default.yaml` + - Add database configuration section + +7. **Integrate with DI** + - Create provider function + - Register in container + - Test connection + +## Acceptance Criteria +- [ ] Ent schema compiles and generates code successfully +- [ ] Database client connects to PostgreSQL +- [ ] Core entities can be created and queried +- [ ] Migrations run successfully on startup +- [ ] Connection pooling is configured correctly +- [ ] Database health check works +- [ ] All entities have proper indexes and relationships +- [ ] Database client is injectable via DI +- [ ] Connections are closed gracefully on shutdown + +## Related ADRs +- [ADR-0013: Database ORM](../../adr/0013-database-orm.md) + +## Implementation Notes +- Use Ent for type-safe database operations +- Configure connection pooling appropriately +- Run migrations on application startup +- Add proper indexes for performance +- Handle database connection errors gracefully +- Support for database migrations in future phases + +## Testing +```bash +# Test Ent schema generation +go generate ./internal/ent +go build ./internal/ent + +# Test database connection +go test ./internal/infra/database/... + +# Test migrations +go run cmd/platform/main.go +``` + +## Files to Create/Modify +- `internal/ent/schema/user.go` - User entity +- `internal/ent/schema/role.go` - Role entity +- `internal/ent/schema/permission.go` - Permission entity +- `internal/ent/schema/audit_log.go` - AuditLog entity +- `internal/ent/schema/role_permissions.go` - Relationship +- `internal/ent/schema/user_roles.go` - Relationship +- `internal/infra/database/client.go` - Database client +- `internal/di/providers.go` - Add database provider +- `config/default.yaml` - Add database config + diff --git a/docs/content/stories/phase1/1.2.1-install-entgoioentcmdent.md b/docs/content/stories/phase1/1.2.1-install-entgoioentcmdent.md deleted file mode 100644 index 6eb67b1..0000000 --- a/docs/content/stories/phase1/1.2.1-install-entgoioentcmdent.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.2.1: Install `entgo.io/ent/cmd/ent` - -## Metadata -- **Task ID**: 1.2.1 -- **Title**: Install `entgo.io/ent/cmd/ent` -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `entgo.io/ent/cmd/ent` - -## Requirements -- Install `entgo.io/ent/cmd/ent` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.2.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.2.2-initialize-ent-schema.md b/docs/content/stories/phase1/1.2.2-initialize-ent-schema.md deleted file mode 100644 index 831473d..0000000 --- a/docs/content/stories/phase1/1.2.2-initialize-ent-schema.md +++ /dev/null @@ -1,46 +0,0 @@ -# Task 1.2.2: Initialize Ent schema: - -## Metadata -- **Task ID**: 1.2.2 -- **Title**: Initialize Ent schema: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Initialize Ent schema: - -## Requirements -- Initialize Ent schema: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.2.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -go run entgo.io/ent/cmd/ent init User Role Permission AuditLog -``` diff --git a/docs/content/stories/phase1/1.2.3-define-core-entities-in-internalentschema.md b/docs/content/stories/phase1/1.2.3-define-core-entities-in-internalentschema.md deleted file mode 100644 index 7b22e11..0000000 --- a/docs/content/stories/phase1/1.2.3-define-core-entities-in-internalentschema.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.2.3: Define core entities in `internal/ent/schema/`: - -## Metadata -- **Task ID**: 1.2.3 -- **Title**: Define core entities in `internal/ent/schema/`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Define core entities in `internal/ent/schema/`: - -## Requirements -- Define core entities in `internal/ent/schema/`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.2.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.2.4-generate-ent-code-go-generate-internalent.md b/docs/content/stories/phase1/1.2.4-generate-ent-code-go-generate-internalent.md deleted file mode 100644 index 8cf4b88..0000000 --- a/docs/content/stories/phase1/1.2.4-generate-ent-code-go-generate-internalent.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.2.4: Generate Ent code: `go generate ./internal/ent` - -## Metadata -- **Task ID**: 1.2.4 -- **Title**: Generate Ent code: `go generate ./internal/ent` -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Generate Ent code: `go generate ./internal/ent` - -## Requirements -- Generate Ent code: `go generate ./internal/ent` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.2.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.2.5-create-internalinfradatabaseclientgo.md b/docs/content/stories/phase1/1.2.5-create-internalinfradatabaseclientgo.md deleted file mode 100644 index eb448ba..0000000 --- a/docs/content/stories/phase1/1.2.5-create-internalinfradatabaseclientgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.2.5: Create `internal/infra/database/client.go`: - -## Metadata -- **Task ID**: 1.2.5 -- **Title**: Create `internal/infra/database/client.go`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/infra/database/client.go`: - -## Requirements -- Create `internal/infra/database/client.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.2.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.2.6-add-database-config-to-configdefaultyaml.md b/docs/content/stories/phase1/1.2.6-add-database-config-to-configdefaultyaml.md deleted file mode 100644 index e1e188c..0000000 --- a/docs/content/stories/phase1/1.2.6-add-database-config-to-configdefaultyaml.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.2.6: Add database config to `config/default.yaml` - -## Metadata -- **Task ID**: 1.2.6 -- **Title**: Add database config to `config/default.yaml` -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add database config to `config/default.yaml` - -## Requirements -- Add database config to `config/default.yaml` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.2.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.3-health-metrics-system.md b/docs/content/stories/phase1/1.3-health-metrics-system.md new file mode 100644 index 0000000..6e6328f --- /dev/null +++ b/docs/content/stories/phase1/1.3-health-metrics-system.md @@ -0,0 +1,126 @@ +# Story 1.3: Health Monitoring and Metrics System + +## Metadata +- **Story ID**: 1.3 +- **Title**: Health Monitoring and Metrics System +- **Phase**: 1 - Core Kernel & Infrastructure +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 5-6 hours +- **Dependencies**: 1.1, 1.2 + +## Goal +Implement comprehensive health checks and Prometheus metrics for monitoring platform health and performance. + +## Description +This story creates a complete health monitoring system with liveness and readiness probes, and a comprehensive Prometheus metrics system for tracking HTTP requests, database queries, and errors. + +## Deliverables + +### 1. Health Check System +- **HealthChecker Interface** (`pkg/health/health.go`): + - `HealthChecker` interface with `Check(ctx context.Context) error` method + - Health status types +- **Health Registry** (`internal/health/registry.go`): + - Thread-safe registry of health checkers + - Register multiple health checkers + - Aggregate health status + - `GET /healthz` endpoint (liveness probe) + - `GET /ready` endpoint (readiness probe with database check) + - Individual component health checks + +### 2. Prometheus Metrics System +- **Metrics Registry** (`internal/metrics/metrics.go`): + - Prometheus registry setup + - HTTP request duration histogram + - HTTP request counter (by method, path, status code) + - Database query duration histogram (via Ent interceptor) + - Error counter (by type) + - Custom metrics support +- **Metrics Endpoint**: + - `GET /metrics` endpoint (Prometheus format) + - Proper content type headers + +### 3. Database Health Check +- Database connectivity check +- Connection pool status +- Query execution test + +### 4. Integration +- Integration with HTTP server +- Integration with DI container +- Middleware for automatic metrics collection + +## Implementation Steps + +1. **Install Dependencies** + ```bash + go get github.com/prometheus/client_golang/prometheus + ``` + +2. **Create Health Check Interface** + - Create `pkg/health/health.go` + - Define HealthChecker interface + +3. **Implement Health Registry** + - Create `internal/health/registry.go` + - Implement registry and endpoints + +4. **Create Metrics System** + - Create `internal/metrics/metrics.go` + - Define all metrics + - Create registry + +5. **Add Database Health Check** + - Implement database health checker + - Register with health registry + +6. **Integrate with HTTP Server** + - Add health endpoints + - Add metrics endpoint + - Add metrics middleware + +7. **Integrate with DI** + - Create provider functions + - Register in container + +## Acceptance Criteria +- [ ] `/healthz` returns 200 when service is alive +- [ ] `/ready` checks database connectivity and returns appropriate status +- [ ] `/metrics` exposes Prometheus metrics in correct format +- [ ] All HTTP requests are measured +- [ ] Database queries are instrumented +- [ ] Metrics are registered in DI container +- [ ] Health checks can be extended by modules +- [ ] Metrics follow Prometheus naming conventions + +## Related ADRs +- [ADR-0014: Health Check Implementation](../../adr/0014-health-check-implementation.md) + +## Implementation Notes +- Use Prometheus client library +- Follow Prometheus naming conventions +- Health checks should be fast (< 1 second) +- Metrics should have appropriate labels +- Consider adding custom business metrics in future + +## Testing +```bash +# Test health endpoints +curl http://localhost:8080/healthz +curl http://localhost:8080/ready + +# Test metrics endpoint +curl http://localhost:8080/metrics + +# Test metrics collection +go test ./internal/metrics/... +``` + +## Files to Create/Modify +- `pkg/health/health.go` - Health checker interface +- `internal/health/registry.go` - Health registry +- `internal/metrics/metrics.go` - Metrics system +- `internal/server/server.go` - Add endpoints +- `internal/di/providers.go` - Add providers + diff --git a/docs/content/stories/phase1/1.3.1-install-githubcomprometheusclient_golangprometheus.md b/docs/content/stories/phase1/1.3.1-install-githubcomprometheusclient_golangprometheus.md deleted file mode 100644 index a5185b6..0000000 --- a/docs/content/stories/phase1/1.3.1-install-githubcomprometheusclient_golangprometheus.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.3.1: Install `github.com/prometheus/client_golang/prometheus` - -## Metadata -- **Task ID**: 1.3.1 -- **Title**: Install `github.com/prometheus/client_golang/prometheus` -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/prometheus/client_golang/prometheus` - -## Requirements -- Install `github.com/prometheus/client_golang/prometheus` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.3.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.3.2-install-githubcomheptiolabshealthcheck-optional-or.md b/docs/content/stories/phase1/1.3.2-install-githubcomheptiolabshealthcheck-optional-or.md deleted file mode 100644 index 42e121b..0000000 --- a/docs/content/stories/phase1/1.3.2-install-githubcomheptiolabshealthcheck-optional-or.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.3.2: Install `github.com/heptiolabs/healthcheck` (optional, or custom) - -## Metadata -- **Task ID**: 1.3.2 -- **Title**: Install `github.com/heptiolabs/healthcheck` (optional, or custom) -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/heptiolabs/healthcheck` (optional, or custom) - -## Requirements -- Install `github.com/heptiolabs/healthcheck` (optional, or custom) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.3.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.3.3-create-pkghealthhealthgo-interface.md b/docs/content/stories/phase1/1.3.3-create-pkghealthhealthgo-interface.md deleted file mode 100644 index a891967..0000000 --- a/docs/content/stories/phase1/1.3.3-create-pkghealthhealthgo-interface.md +++ /dev/null @@ -1,48 +0,0 @@ -# Task 1.3.3: Create `pkg/health/health.go` interface: - -## Metadata -- **Task ID**: 1.3.3 -- **Title**: Create `pkg/health/health.go` interface: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/health/health.go` interface: - -## Requirements -- Create `pkg/health/health.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.3.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type HealthChecker interface { - Check(ctx context.Context) error - } -``` diff --git a/docs/content/stories/phase1/1.3.4-implement-internalhealthregistrygo.md b/docs/content/stories/phase1/1.3.4-implement-internalhealthregistrygo.md deleted file mode 100644 index d1a4812..0000000 --- a/docs/content/stories/phase1/1.3.4-implement-internalhealthregistrygo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.3.4: Implement `internal/health/registry.go`: - -## Metadata -- **Task ID**: 1.3.4 -- **Title**: Implement `internal/health/registry.go`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/health/registry.go`: - -## Requirements -- Implement `internal/health/registry.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.3.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.3.5-create-internalmetricsmetricsgo.md b/docs/content/stories/phase1/1.3.5-create-internalmetricsmetricsgo.md deleted file mode 100644 index 0c167f1..0000000 --- a/docs/content/stories/phase1/1.3.5-create-internalmetricsmetricsgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.3.5: Create `internal/metrics/metrics.go`: - -## Metadata -- **Task ID**: 1.3.5 -- **Title**: Create `internal/metrics/metrics.go`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/metrics/metrics.go`: - -## Requirements -- Create `internal/metrics/metrics.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.3.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.3.6-add-metrics-endpoint-prometheus-format.md b/docs/content/stories/phase1/1.3.6-add-metrics-endpoint-prometheus-format.md deleted file mode 100644 index a8c65fb..0000000 --- a/docs/content/stories/phase1/1.3.6-add-metrics-endpoint-prometheus-format.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.3.6: Add `/metrics` endpoint (Prometheus format) - -## Metadata -- **Task ID**: 1.3.6 -- **Title**: Add `/metrics` endpoint (Prometheus format) -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add `/metrics` endpoint (Prometheus format) - -## Requirements -- Add `/metrics` endpoint (Prometheus format) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.3.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.3.7-register-endpoints-in-main-http-router.md b/docs/content/stories/phase1/1.3.7-register-endpoints-in-main-http-router.md deleted file mode 100644 index afd0055..0000000 --- a/docs/content/stories/phase1/1.3.7-register-endpoints-in-main-http-router.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.3.7: Register endpoints in main HTTP router - -## Metadata -- **Task ID**: 1.3.7 -- **Title**: Register endpoints in main HTTP router -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Register endpoints in main HTTP router - -## Requirements -- Register endpoints in main HTTP router - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.3.7 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.4-error-handling.md b/docs/content/stories/phase1/1.4-error-handling.md new file mode 100644 index 0000000..19f1490 --- /dev/null +++ b/docs/content/stories/phase1/1.4-error-handling.md @@ -0,0 +1,103 @@ +# Story 1.4: Error Handling and Error Bus + +## Metadata +- **Story ID**: 1.4 +- **Title**: Error Handling and Error Bus +- **Phase**: 1 - Core Kernel & Infrastructure +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 4-5 hours +- **Dependencies**: 1.1, 1.3 + +## Goal +Implement centralized error handling with an error bus that captures, logs, and optionally reports all application errors. + +## Description +This story creates a complete error handling system with an error bus that captures all errors, logs them with context, and provides a foundation for future error reporting integrations (like Sentry). + +## Deliverables + +### 1. Error Bus Interface (`pkg/errorbus/errorbus.go`) +- `ErrorPublisher` interface with `Publish(err error)` method +- Error context support +- Error categorization + +### 2. Channel-Based Error Bus (`internal/errorbus/channel_bus.go`) +- Buffered channel for error publishing +- Background goroutine consumes errors +- Logs all errors with context (request ID, user ID, etc.) +- Error aggregation +- Optional: Sentry integration placeholder (Phase 6) + +### 3. Panic Recovery Middleware +- Recovers from panics in HTTP handlers +- Publishes panics to error bus +- Returns appropriate HTTP error responses (500) +- Preserves error context + +### 4. Integration +- Integration with DI container +- Integration with HTTP middleware stack +- Integration with logger + +## Implementation Steps + +1. **Create Error Bus Interface** + - Create `pkg/errorbus/errorbus.go` + - Define ErrorPublisher interface + +2. **Implement Channel-Based Error Bus** + - Create `internal/errorbus/channel_bus.go` + - Implement buffered channel + - Implement background consumer + - Add error logging + +3. **Create Panic Recovery Middleware** + - Create middleware for Gin + - Recover from panics + - Publish to error bus + - Return error responses + +4. **Integrate with DI** + - Create provider function + - Register in container + +5. **Integrate with HTTP Server** + - Add panic recovery middleware + - Test error handling + +## Acceptance Criteria +- [ ] Errors are captured and logged via error bus +- [ ] Panics are recovered and logged +- [ ] HTTP handlers return proper error responses +- [ ] Error bus is injectable via DI +- [ ] Error context (request ID, user ID) is preserved +- [ ] Background error consumer works correctly +- [ ] Error bus doesn't block request handling + +## Related ADRs +- [ADR-0015: Error Bus Implementation](../../adr/0015-error-bus-implementation.md) +- [ADR-0026: Error Reporting Service](../../adr/0026-error-reporting-service.md) + +## Implementation Notes +- Use buffered channels to prevent blocking +- Background goroutine should handle errors asynchronously +- Preserve error context (stack traces, request IDs) +- Consider error rate limiting in future +- Placeholder for Sentry integration in Phase 6 + +## Testing +```bash +# Test error bus +go test ./internal/errorbus/... + +# Test panic recovery +# Trigger panic in handler and verify recovery +``` + +## Files to Create/Modify +- `pkg/errorbus/errorbus.go` - Error bus interface +- `internal/errorbus/channel_bus.go` - Error bus implementation +- `internal/server/middleware.go` - Panic recovery middleware +- `internal/di/providers.go` - Add error bus provider + diff --git a/docs/content/stories/phase1/1.4.1-create-pkgerrorbuserrorbusgo-interface.md b/docs/content/stories/phase1/1.4.1-create-pkgerrorbuserrorbusgo-interface.md deleted file mode 100644 index fcaee40..0000000 --- a/docs/content/stories/phase1/1.4.1-create-pkgerrorbuserrorbusgo-interface.md +++ /dev/null @@ -1,48 +0,0 @@ -# Task 1.4.1: Create `pkg/errorbus/errorbus.go` interface: - -## Metadata -- **Task ID**: 1.4.1 -- **Title**: Create `pkg/errorbus/errorbus.go` interface: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/errorbus/errorbus.go` interface: - -## Requirements -- Create `pkg/errorbus/errorbus.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.4.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type ErrorPublisher interface { - Publish(err error) - } -``` diff --git a/docs/content/stories/phase1/1.4.2-implement-internalerrorbuschannel_busgo.md b/docs/content/stories/phase1/1.4.2-implement-internalerrorbuschannel_busgo.md deleted file mode 100644 index b5f0e47..0000000 --- a/docs/content/stories/phase1/1.4.2-implement-internalerrorbuschannel_busgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.4.2: Implement `internal/errorbus/channel_bus.go`: - -## Metadata -- **Task ID**: 1.4.2 -- **Title**: Implement `internal/errorbus/channel_bus.go`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/errorbus/channel_bus.go`: - -## Requirements -- Implement `internal/errorbus/channel_bus.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.4.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.4.3-add-panic-recovery-middleware-that-publishes-to-er.md b/docs/content/stories/phase1/1.4.3-add-panic-recovery-middleware-that-publishes-to-er.md deleted file mode 100644 index 9edce33..0000000 --- a/docs/content/stories/phase1/1.4.3-add-panic-recovery-middleware-that-publishes-to-er.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.4.3: Add panic recovery middleware that publishes to error bus - -## Metadata -- **Task ID**: 1.4.3 -- **Title**: Add panic recovery middleware that publishes to error bus -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add panic recovery middleware that publishes to error bus - -## Requirements -- Add panic recovery middleware that publishes to error bus - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.4.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.4.4-register-error-bus-in-di-container.md b/docs/content/stories/phase1/1.4.4-register-error-bus-in-di-container.md deleted file mode 100644 index 560ff6b..0000000 --- a/docs/content/stories/phase1/1.4.4-register-error-bus-in-di-container.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.4.4: Register error bus in DI container - -## Metadata -- **Task ID**: 1.4.4 -- **Title**: Register error bus in DI container -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Register error bus in DI container - -## Requirements -- Register error bus in DI container - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.4.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.5-http-server.md b/docs/content/stories/phase1/1.5-http-server.md new file mode 100644 index 0000000..d3fd0bf --- /dev/null +++ b/docs/content/stories/phase1/1.5-http-server.md @@ -0,0 +1,122 @@ +# Story 1.5: HTTP Server Foundation with Middleware Stack + +## Metadata +- **Story ID**: 1.5 +- **Title**: HTTP Server Foundation with Middleware Stack +- **Phase**: 1 - Core Kernel & Infrastructure +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 6-8 hours +- **Dependencies**: 1.1, 1.3, 1.4 + +## Goal +Create a production-ready HTTP server with comprehensive middleware for security, observability, and error handling. + +## Description +This story implements a complete HTTP server using Gin with a comprehensive middleware stack including request ID generation, structured logging, panic recovery, metrics collection, CORS, and graceful shutdown. + +## Deliverables + +### 1. HTTP Server (`internal/server/server.go`) +- Gin router initialization +- Server configuration (port, host, timeouts) +- Graceful shutdown handling + +### 2. Comprehensive Middleware Stack +- **Request ID Generator**: Unique ID per request +- **Structured Logging**: Log all requests with context +- **Panic Recovery**: Recover panics → error bus +- **Prometheus Metrics**: Collect request metrics +- **CORS Support**: Configurable CORS headers +- **Request Timeout**: Handle request timeouts +- **Response Compression**: Gzip compression for responses + +### 3. Core Route Registration +- `GET /healthz` - Liveness probe +- `GET /ready` - Readiness probe +- `GET /metrics` - Prometheus metrics + +### 4. FX Lifecycle Integration +- HTTP server starts on `OnStart` hook +- Graceful shutdown on `OnStop` hook (drains connections) +- Port configuration from config system + +### 5. Integration +- Integration with main application entry point +- Integration with all middleware systems + +## Implementation Steps + +1. **Install Dependencies** + ```bash + go get github.com/gin-gonic/gin + ``` + +2. **Create HTTP Server** + - Create `internal/server/server.go` + - Initialize Gin router + - Configure server settings + +3. **Implement Middleware** + - Request ID middleware + - Logging middleware + - Panic recovery middleware + - Metrics middleware + - CORS middleware + - Timeout middleware + - Compression middleware + +4. **Register Core Routes** + - Health endpoints + - Metrics endpoint + +5. **Integrate with FX** + - Add lifecycle hooks + - Handle graceful shutdown + +6. **Test Server** + - Verify server starts + - Test all endpoints + - Test graceful shutdown + +## Acceptance Criteria +- [ ] HTTP server starts successfully +- [ ] All middleware executes in correct order +- [ ] Request IDs are generated and logged +- [ ] Metrics are collected for all requests +- [ ] Panics are recovered and handled +- [ ] Graceful shutdown works correctly +- [ ] Server is configurable via config system +- [ ] CORS is configurable per environment +- [ ] All core endpoints work correctly + +## Related ADRs +- [ADR-0006: HTTP Framework](../../adr/0006-http-framework.md) + +## Implementation Notes +- Use Gin for HTTP routing +- Middleware order is important +- Support graceful shutdown with connection draining +- CORS should be configurable per environment +- Consider adding rate limiting in future (Phase 6) + +## Testing +```bash +# Test server startup +go run cmd/platform/main.go + +# Test endpoints +curl http://localhost:8080/healthz +curl http://localhost:8080/ready +curl http://localhost:8080/metrics + +# Test graceful shutdown +# Send SIGTERM and verify graceful shutdown +``` + +## Files to Create/Modify +- `internal/server/server.go` - HTTP server +- `internal/server/middleware.go` - Middleware functions +- `internal/di/providers.go` - Add server provider +- `config/default.yaml` - Add server configuration + diff --git a/docs/content/stories/phase1/1.5.1-install-githubcomgin-gonicgin.md b/docs/content/stories/phase1/1.5.1-install-githubcomgin-gonicgin.md deleted file mode 100644 index 389c589..0000000 --- a/docs/content/stories/phase1/1.5.1-install-githubcomgin-gonicgin.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.5.1: Install `github.com/gin-gonic/gin` - -## Metadata -- **Task ID**: 1.5.1 -- **Title**: Install `github.com/gin-gonic/gin` -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/gin-gonic/gin` - -## Requirements -- Install `github.com/gin-gonic/gin` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.5.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.5.2-create-internalserverservergo.md b/docs/content/stories/phase1/1.5.2-create-internalserverservergo.md deleted file mode 100644 index d959908..0000000 --- a/docs/content/stories/phase1/1.5.2-create-internalserverservergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.5.2: Create `internal/server/server.go`: - -## Metadata -- **Task ID**: 1.5.2 -- **Title**: Create `internal/server/server.go`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/server/server.go`: - -## Requirements -- Create `internal/server/server.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.5.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.5.3-wire-http-server-into-fx-lifecycle.md b/docs/content/stories/phase1/1.5.3-wire-http-server-into-fx-lifecycle.md deleted file mode 100644 index 35c3183..0000000 --- a/docs/content/stories/phase1/1.5.3-wire-http-server-into-fx-lifecycle.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.5.3: Wire HTTP server into fx lifecycle: - -## Metadata -- **Task ID**: 1.5.3 -- **Title**: Wire HTTP server into fx lifecycle: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Wire HTTP server into fx lifecycle: - -## Requirements -- Wire HTTP server into fx lifecycle: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.5.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.5.4-update-cmdplatformmaingo-to-use-fx-lifecycle.md b/docs/content/stories/phase1/1.5.4-update-cmdplatformmaingo-to-use-fx-lifecycle.md deleted file mode 100644 index b2d5634..0000000 --- a/docs/content/stories/phase1/1.5.4-update-cmdplatformmaingo-to-use-fx-lifecycle.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.5.4: Update `cmd/platform/main.go` to use fx lifecycle - -## Metadata -- **Task ID**: 1.5.4 -- **Title**: Update `cmd/platform/main.go` to use fx lifecycle -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Update `cmd/platform/main.go` to use fx lifecycle - -## Requirements -- Update `cmd/platform/main.go` to use fx lifecycle - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.5.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.6-opentelemetry.md b/docs/content/stories/phase1/1.6-opentelemetry.md new file mode 100644 index 0000000..396c5c1 --- /dev/null +++ b/docs/content/stories/phase1/1.6-opentelemetry.md @@ -0,0 +1,117 @@ +# Story 1.6: OpenTelemetry Distributed Tracing + +## Metadata +- **Story ID**: 1.6 +- **Title**: OpenTelemetry Distributed Tracing +- **Phase**: 1 - Core Kernel & Infrastructure +- **Status**: Pending +- **Priority**: Medium +- **Estimated Time**: 5-6 hours +- **Dependencies**: 1.1, 1.5 + +## Goal +Integrate OpenTelemetry for distributed tracing across the platform to enable observability in production. + +## Description +This story implements OpenTelemetry tracing for HTTP requests and database queries, enabling distributed tracing across the platform. Traces will be exported to stdout in development and OTLP collector in production. + +## Deliverables + +### 1. OpenTelemetry Setup (`internal/observability/tracer.go`) +- TracerProvider initialization +- Export to stdout (development mode) +- Export to OTLP collector (production mode) +- Trace context propagation +- Resource attributes (service name, version, etc.) + +### 2. HTTP Instrumentation Middleware +- Automatic span creation for HTTP requests +- Trace context propagation via headers +- Span attributes (method, path, status code, duration) +- Error recording in spans + +### 3. Database Instrumentation +- Ent interceptor for database queries +- Query spans with timing and parameters +- Database operation attributes + +### 4. Integration with Logger +- Include trace ID in logs +- Correlate logs with traces +- Span context in structured logs + +### 5. Configuration +- Tracing configuration in config files +- Enable/disable tracing +- Export endpoint configuration + +## Implementation Steps + +1. **Install Dependencies** + ```bash + go get go.opentelemetry.io/otel + go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp + go get go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp + ``` + +2. **Create Tracer Setup** + - Create `internal/observability/tracer.go` + - Initialize TracerProvider + - Set up exporters + +3. **Add HTTP Instrumentation** + - Create HTTP middleware + - Instrument Gin router + - Add trace context propagation + +4. **Add Database Instrumentation** + - Create Ent interceptor + - Instrument database queries + - Add query attributes + +5. **Integrate with Logger** + - Extract trace ID from context + - Add trace ID to logs + +6. **Add Configuration** + - Add tracing config + - Configure export endpoints + +## Acceptance Criteria +- [ ] HTTP requests create OpenTelemetry spans +- [ ] Database queries are traced +- [ ] Trace context propagates across service boundaries +- [ ] Trace IDs are included in logs +- [ ] Traces export correctly to configured backend +- [ ] Tracing works in both development and production modes +- [ ] Tracing has minimal performance impact +- [ ] Spans have appropriate attributes + +## Related ADRs +- [ADR-0016: OpenTelemetry Observability](../../adr/0016-opentelemetry-observability.md) + +## Implementation Notes +- Use OpenTelemetry Go SDK +- Support both stdout and OTLP exporters +- Trace context should propagate via HTTP headers +- Consider sampling for high-volume production +- Minimize performance impact + +## Testing +```bash +# Test tracing +go run cmd/platform/main.go + +# Make requests and verify traces +curl http://localhost:8080/healthz + +# Check trace export (stdout or OTLP) +``` + +## Files to Create/Modify +- `internal/observability/tracer.go` - Tracer setup +- `internal/server/middleware.go` - Add tracing middleware +- `internal/infra/database/client.go` - Add tracing interceptor +- `internal/logger/zap_logger.go` - Add trace ID to logs +- `config/default.yaml` - Add tracing configuration + diff --git a/docs/content/stories/phase1/1.6.1-install-opentelemetry-packages.md b/docs/content/stories/phase1/1.6.1-install-opentelemetry-packages.md deleted file mode 100644 index 7212d79..0000000 --- a/docs/content/stories/phase1/1.6.1-install-opentelemetry-packages.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.6.1: Install OpenTelemetry packages: - -## Metadata -- **Task ID**: 1.6.1 -- **Title**: Install OpenTelemetry packages: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install OpenTelemetry packages: - -## Requirements -- Install OpenTelemetry packages: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.6.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.6.2-create-internalobservabilitytracergo.md b/docs/content/stories/phase1/1.6.2-create-internalobservabilitytracergo.md deleted file mode 100644 index d215973..0000000 --- a/docs/content/stories/phase1/1.6.2-create-internalobservabilitytracergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.6.2: Create `internal/observability/tracer.go`: - -## Metadata -- **Task ID**: 1.6.2 -- **Title**: Create `internal/observability/tracer.go`: -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/observability/tracer.go`: - -## Requirements -- Create `internal/observability/tracer.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.6.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.6.3-add-http-instrumentation-middleware.md b/docs/content/stories/phase1/1.6.3-add-http-instrumentation-middleware.md deleted file mode 100644 index 43b9284..0000000 --- a/docs/content/stories/phase1/1.6.3-add-http-instrumentation-middleware.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.6.3: Add HTTP instrumentation middleware - -## Metadata -- **Task ID**: 1.6.3 -- **Title**: Add HTTP instrumentation middleware -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add HTTP instrumentation middleware - -## Requirements -- Add HTTP instrumentation middleware - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.6.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.6.4-add-trace-context-propagation-to-requests.md b/docs/content/stories/phase1/1.6.4-add-trace-context-propagation-to-requests.md deleted file mode 100644 index ef3abca..0000000 --- a/docs/content/stories/phase1/1.6.4-add-trace-context-propagation-to-requests.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 1.6.4: Add trace context propagation to requests - -## Metadata -- **Task ID**: 1.6.4 -- **Title**: Add trace context propagation to requests -- **Phase**: 1 - Core Kernel & Infrastructure -- **Section**: 1.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add trace context propagation to requests - -## Requirements -- Add trace context propagation to requests - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 1.6.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase1/1.7-service-abstraction-layer.md b/docs/content/stories/phase1/1.7-service-abstraction-layer.md new file mode 100644 index 0000000..4adb6aa --- /dev/null +++ b/docs/content/stories/phase1/1.7-service-abstraction-layer.md @@ -0,0 +1,114 @@ +# Story 1.7: Service Client Interfaces + +## Metadata +- **Story ID**: 1.7 +- **Title**: Service Client Interfaces +- **Phase**: 1 - Core Kernel & Infrastructure +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 4-6 hours +- **Dependencies**: 1.1, 1.2, 2.1, 2.2 + +## Goal +Create service client interfaces for all core services to enable microservices communication. All inter-service communication will go through these interfaces. + +## Description +This story implements the foundation for microservices architecture by creating service client interfaces for all core services. These interfaces will be implemented as gRPC clients (primary) or HTTP clients (fallback), ensuring all services communicate via network calls. + +## Deliverables + +### 1. Service Client Interfaces (`pkg/services/`) +Define service client interfaces for all core services: +- `IdentityServiceClient` - User and identity operations +- `AuthServiceClient` - Authentication operations +- `AuthzServiceClient` - Authorization operations +- `PermissionServiceClient` - Permission resolution +- `AuditServiceClient` - Audit logging +- `CacheServiceClient` - Cache operations (if needed) +- `EventBusClient` - Event publishing (already abstracted) + +### 2. Service Client Factory (`internal/services/factory.go`) +Factory pattern for creating service clients: +- Create gRPC clients (primary) +- Create HTTP clients (fallback) +- Support service registry integration +- Handle client lifecycle and connection pooling + +### 3. Configuration +- Service client configuration in `config/default.yaml`: + ```yaml + services: + default_protocol: grpc # grpc, http + registry: + type: consul # consul, kubernetes, etcd + consul: + address: localhost:8500 + ``` + +### 5. DI Integration +- Provider functions for service clients +- Register in DI container +- Support service client injection + +## Implementation Steps + +1. **Define Service Client Interfaces** + - Create `pkg/services/identity.go` + - Create `pkg/services/auth.go` + - Create `pkg/services/authz.go` + - Define all interface methods + - Design for network calls (context, timeouts, errors) + +2. **Create Service Factory** + - Create `internal/services/factory.go` + - Implement gRPC client creation + - Implement HTTP client creation (fallback) + - Support service registry integration + +3. **Add Configuration** + - Add service configuration + - Support protocol selection (gRPC/HTTP) + - Service registry configuration + +4. **Update Core Services** + - Services expose gRPC servers + - Services use service clients for inter-service calls + - No direct in-process calls between services + +## Acceptance Criteria +- [ ] Service client interfaces are defined for all core services +- [ ] Service factory creates gRPC clients +- [ ] Service factory creates HTTP clients (fallback) +- [ ] Service clients are injectable via DI +- [ ] Configuration supports protocol selection +- [ ] Service clients are testable and mockable +- [ ] All inter-service communication goes through service clients + +## Related ADRs +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) +- [ADR-0030: Service Communication Strategy](../../adr/0030-service-communication-strategy.md) + +## Implementation Notes +- Interfaces should match existing service methods +- Use context for all operations +- Support cancellation and timeouts +- Design for network calls (retries, circuit breakers) +- gRPC will be implemented in Phase 5, but interfaces are defined here + +## Testing +```bash +# Test service clients +go test ./internal/services/... + +# Test service factory +go test ./internal/services/factory_test.go +``` + +## Files to Create/Modify +- `pkg/services/identity.go` - Identity service client interface +- `pkg/services/auth.go` - Auth service client interface +- `pkg/services/authz.go` - Authz service client interface +- `internal/services/factory.go` - Service client factory +- `internal/di/providers.go` - Add service client providers +- `config/default.yaml` - Add service configuration + diff --git a/docs/content/stories/phase1/README.md b/docs/content/stories/phase1/README.md index 64b8a47..2e5634e 100644 --- a/docs/content/stories/phase1/README.md +++ b/docs/content/stories/phase1/README.md @@ -1,64 +1,58 @@ # Phase 1: Core Kernel & Infrastructure ## Overview -Implement dependency injection container, set up database (Ent ORM), create health and metrics endpoints, implement error bus, and add basic HTTP server with middleware. +Extend DI container to support all core services, implement database layer with Ent ORM, build health monitoring and metrics system, create error handling and error bus, establish HTTP server with comprehensive middleware stack, and integrate OpenTelemetry for distributed tracing. -## Tasks +## Stories -### 1.1 Dependency Injection Container -- [1.1.1 - Extend DI Container](./1.1.1-extend-internaldicontainergo.md) -- [1.1.2 - Create DI Providers](./1.1.2-create-internaldiprovidersgo.md) -- [1.1.3 - Add Core Module](./1.1.3-add-internaldicore_modulego.md) +### 1.1 Enhanced Dependency Injection Container +- [Story: 1.1 - Enhanced DI Container](./1.1-enhanced-di-container.md) +- **Goal:** Extend the DI container to provide all core infrastructure services with proper lifecycle management. +- **Deliverables:** Extended DI container, provider functions for all services, core module export -### 1.2 Database Setup (Ent) -- [1.2.1 - Install Ent](./1.2.1-install-entgoioentcmdent.md) -- [1.2.2 - Initialize Ent Schema](./1.2.2-initialize-ent-schema.md) -- [1.2.3 - Define Core Entities](./1.2.3-define-core-entities-in-internalentschema.md) -- [1.2.4 - Generate Ent Code](./1.2.4-generate-ent-code-go-generate-internalent.md) -- [1.2.5 - Create Database Client](./1.2.5-create-internalinfradatabaseclientgo.md) -- [1.2.6 - Add Database Config](./1.2.6-add-database-config-to-configdefaultyaml.md) +### 1.2 Database Layer with Ent ORM +- [Story: 1.2 - Database Layer](./1.2-database-layer.md) +- **Goal:** Set up a complete database layer using Ent ORM with core domain entities, migrations, and connection management. +- **Deliverables:** Ent schema, core entities, database client, migrations, connection pooling -### 1.3 Health & Metrics -- [1.3.1 - Install Prometheus](./1.3.1-install-githubcomprometheusclient_golangprometheus.md) -- [1.3.2 - Install Health Check](./1.3.2-install-githubcomheptiolabshealthcheck-optional-or.md) -- [1.3.3 - Create Health Interface](./1.3.3-create-pkghealthhealthgo-interface.md) -- [1.3.4 - Implement Health Registry](./1.3.4-implement-internalhealthregistrygo.md) -- [1.3.5 - Create Metrics](./1.3.5-create-internalmetricsmetricsgo.md) -- [1.3.6 - Add Metrics Endpoint](./1.3.6-add-metrics-endpoint-prometheus-format.md) -- [1.3.7 - Register Endpoints](./1.3.7-register-endpoints-in-main-http-router.md) +### 1.3 Health Monitoring and Metrics System +- [Story: 1.3 - Health & Metrics](./1.3-health-metrics-system.md) +- **Goal:** Implement comprehensive health checks and Prometheus metrics for monitoring platform health and performance. +- **Deliverables:** Health check system, Prometheus metrics, health endpoints, metrics endpoint -### 1.4 Error Bus -- [1.4.1 - Create Error Bus Interface](./1.4.1-create-pkgerrorbuserrorbusgo-interface.md) -- [1.4.2 - Implement Channel Bus](./1.4.2-implement-internalerrorbuschannel_busgo.md) -- [1.4.3 - Add Panic Recovery Middleware](./1.4.3-add-panic-recovery-middleware-that-publishes-to-er.md) -- [1.4.4 - Register Error Bus](./1.4.4-register-error-bus-in-di-container.md) +### 1.4 Error Handling and Error Bus +- [Story: 1.4 - Error Handling](./1.4-error-handling.md) +- **Goal:** Implement centralized error handling with an error bus that captures, logs, and optionally reports all application errors. +- **Deliverables:** Error bus interface, channel-based implementation, panic recovery middleware -### 1.5 HTTP Server Foundation -- [1.5.1 - Install Gin](./1.5.1-install-githubcomgin-gonicgin.md) -- [1.5.2 - Create Server](./1.5.2-create-internalserverservergo.md) -- [1.5.3 - Wire HTTP Server](./1.5.3-wire-http-server-into-fx-lifecycle.md) -- [1.5.4 - Update Main Entry Point](./1.5.4-update-cmdplatformmaingo-to-use-fx-lifecycle.md) +### 1.5 HTTP Server Foundation with Middleware Stack +- [Story: 1.5 - HTTP Server](./1.5-http-server.md) +- **Goal:** Create a production-ready HTTP server with comprehensive middleware for security, observability, and error handling. +- **Deliverables:** HTTP server, comprehensive middleware stack, core routes, FX lifecycle integration -### 1.6 Observability (OpenTelemetry) -- [1.6.1 - Install OpenTelemetry](./1.6.1-install-opentelemetry-packages.md) -- [1.6.2 - Create Tracer](./1.6.2-create-internalobservabilitytracergo.md) -- [1.6.3 - Add HTTP Instrumentation](./1.6.3-add-http-instrumentation-middleware.md) -- [1.6.4 - Add Trace Context Propagation](./1.6.4-add-trace-context-propagation-to-requests.md) +### 1.6 OpenTelemetry Distributed Tracing +- [Story: 1.6 - OpenTelemetry](./1.6-opentelemetry.md) +- **Goal:** Integrate OpenTelemetry for distributed tracing across the platform to enable observability in production. +- **Deliverables:** OpenTelemetry setup, HTTP instrumentation, database instrumentation, trace-log correlation + +### 1.7 Service Client Interfaces +- [Story: 1.7 - Service Client Interfaces](./1.7-service-abstraction-layer.md) +- **Goal:** Create service client interfaces for all core services to enable microservices communication. +- **Deliverables:** Service client interfaces, service factory, configuration ## Deliverables Checklist -- [ ] DI container with all core services registered -- [ ] Database schema defined with Ent -- [ ] Health check endpoints working -- [ ] Metrics endpoint exposed -- [ ] Error bus implemented and integrated +- [ ] DI container with all core services +- [ ] Database client with Ent schema +- [ ] Health and metrics endpoints functional +- [ ] Error bus captures and logs errors - [ ] HTTP server with middleware stack -- [ ] OpenTelemetry tracing integrated +- [ ] Basic observability with OpenTelemetry +- [ ] Service client interfaces for microservices ## Acceptance Criteria - `GET /healthz` returns 200 -- `GET /ready` checks database connectivity -- `GET /metrics` returns Prometheus metrics -- HTTP requests are logged with structured logging -- Panic recovery middleware catches and reports errors -- OpenTelemetry traces are generated for HTTP requests - +- `GET /ready` checks DB connectivity +- `GET /metrics` exposes Prometheus metrics +- Panic recovery logs errors via error bus +- Database migrations run on startup +- HTTP requests are traced with OpenTelemetry diff --git a/docs/content/stories/phase2/2.1-jwt-authentication.md b/docs/content/stories/phase2/2.1-jwt-authentication.md new file mode 100644 index 0000000..254c9c6 --- /dev/null +++ b/docs/content/stories/phase2/2.1-jwt-authentication.md @@ -0,0 +1,139 @@ +# Story 2.1: JWT Authentication System + +## Metadata +- **Story ID**: 2.1 +- **Title**: JWT Authentication System +- **Phase**: 2 - Authentication & Authorization +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 6-8 hours +- **Dependencies**: 1.2, 1.5 + +## Goal +Implement a complete JWT-based authentication system with access tokens, refresh tokens, and secure token management. + +## Description +This story implements the complete JWT authentication system including token generation, verification, authentication middleware, and login/refresh endpoints. The system supports short-lived access tokens and long-lived refresh tokens for secure authentication. + +## Deliverables + +### 1. Authentication Interfaces (`pkg/auth/auth.go`) +- `Authenticator` interface for token generation and verification +- `TokenClaims` struct with user ID, roles, tenant ID, expiration +- Token validation utilities + +### 2. JWT Implementation (`internal/auth/jwt_auth.go`) +- Generate short-lived access tokens (15 minutes default) +- Generate long-lived refresh tokens (7 days default) +- Token signature verification using HMAC or RSA +- Token expiration validation +- Claims extraction and validation + +### 3. Authentication Middleware (`internal/auth/middleware.go`) +- Extract JWT from `Authorization: Bearer ` header +- Verify token validity (signature and expiration) +- Inject authenticated user into request context +- Helper function: `auth.FromContext(ctx) *User` +- Handle authentication errors appropriately + +### 4. Authentication Endpoints +- `POST /api/v1/auth/login` - Authenticate user and return tokens + - Validate email and password + - Return access + refresh tokens + - Log login attempts +- `POST /api/v1/auth/refresh` - Refresh access token using refresh token + - Validate refresh token + - Issue new access token + - Optionally rotate refresh token + +### 5. gRPC Server (Microservices) +- Expose gRPC server for authentication service +- gRPC service definition in `api/proto/auth.proto` +- gRPC server implementation in `internal/auth/grpc/server.go` +- Service registration in service registry + +### 6. Integration +- Integration with DI container +- Use `IdentityServiceClient` for user operations (if Identity service is separate) +- Integration with HTTP server +- Integration with user repository +- Integration with audit logging + +## Implementation Steps + +1. **Install Dependencies** + ```bash + go get github.com/golang-jwt/jwt/v5 + ``` + +2. **Create Authentication Interfaces** + - Create `pkg/auth/auth.go` + - Define Authenticator interface + - Define TokenClaims struct + +3. **Implement JWT Authentication** + - Create `internal/auth/jwt_auth.go` + - Implement token generation + - Implement token verification + - Handle token expiration + +4. **Create Authentication Middleware** + - Create `internal/auth/middleware.go` + - Implement token extraction + - Implement token verification + - Inject user into context + +5. **Create Authentication Endpoints** + - Create login handler + - Create refresh handler + - Add routes to HTTP server + +6. **Integrate with DI** + - Create provider function + - Register in container + +## Acceptance Criteria +- [ ] Users can login and receive access and refresh tokens +- [ ] Access tokens expire after configured duration +- [ ] Refresh tokens can be used to obtain new access tokens +- [ ] Invalid tokens are rejected with appropriate errors +- [ ] Authenticated user is available in request context +- [ ] Login attempts are logged (success and failure) +- [ ] Token secrets are configurable +- [ ] Token claims include user ID, roles, and tenant ID + +## Related ADRs +- [ADR-0017: JWT Token Strategy](../../adr/0017-jwt-token-strategy.md) +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) +- [ADR-0030: Service Communication Strategy](../../adr/0030-service-communication-strategy.md) + +## Implementation Notes +- Use JWT v5 library +- Support both HMAC and RSA signing +- Token secrets should be configurable +- Consider token blacklisting for logout (future enhancement) +- Refresh tokens should be stored securely (database or cache) + +## Testing +```bash +# Test authentication +go test ./internal/auth/... + +# Test login endpoint +curl -X POST http://localhost:8080/api/v1/auth/login \ + -H "Content-Type: application/json" \ + -d '{"email":"user@example.com","password":"password"}' + +# Test refresh endpoint +curl -X POST http://localhost:8080/api/v1/auth/refresh \ + -H "Authorization: Bearer " +``` + +## Files to Create/Modify +- `pkg/auth/auth.go` - Authentication interfaces +- `internal/auth/jwt_auth.go` - JWT implementation +- `internal/auth/middleware.go` - Authentication middleware +- `internal/auth/handler.go` - Authentication handlers +- `internal/di/providers.go` - Add auth provider +- `config/default.yaml` - Add JWT configuration + diff --git a/docs/content/stories/phase2/2.1.1-install-githubcomgolang-jwtjwtv5.md b/docs/content/stories/phase2/2.1.1-install-githubcomgolang-jwtjwtv5.md deleted file mode 100644 index dd056bd..0000000 --- a/docs/content/stories/phase2/2.1.1-install-githubcomgolang-jwtjwtv5.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.1.1: Install `github.com/golang-jwt/jwt/v5` - -## Metadata -- **Task ID**: 2.1.1 -- **Title**: Install `github.com/golang-jwt/jwt/v5` -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/golang-jwt/jwt/v5` - -## Requirements -- Install `github.com/golang-jwt/jwt/v5` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.1.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.1.2-create-pkgauthauthgo-interfaces.md b/docs/content/stories/phase2/2.1.2-create-pkgauthauthgo-interfaces.md deleted file mode 100644 index d73c12f..0000000 --- a/docs/content/stories/phase2/2.1.2-create-pkgauthauthgo-interfaces.md +++ /dev/null @@ -1,56 +0,0 @@ -# Task 2.1.2: Create `pkg/auth/auth.go` interfaces: - -## Metadata -- **Task ID**: 2.1.2 -- **Title**: Create `pkg/auth/auth.go` interfaces: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/auth/auth.go` interfaces: - -## Requirements -- Create `pkg/auth/auth.go` interfaces: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.1.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Authenticator interface { - GenerateToken(userID string, roles []string, tenantID string) (string, error) - VerifyToken(token string) (*TokenClaims, error) - } - - type TokenClaims struct { - UserID string - Roles []string - TenantID string - ExpiresAt time.Time - } -``` diff --git a/docs/content/stories/phase2/2.1.3-implement-internalauthjwt_authgo.md b/docs/content/stories/phase2/2.1.3-implement-internalauthjwt_authgo.md deleted file mode 100644 index 4d4f688..0000000 --- a/docs/content/stories/phase2/2.1.3-implement-internalauthjwt_authgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.1.3: Implement `internal/auth/jwt_auth.go`: - -## Metadata -- **Task ID**: 2.1.3 -- **Title**: Implement `internal/auth/jwt_auth.go`: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/auth/jwt_auth.go`: - -## Requirements -- Implement `internal/auth/jwt_auth.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.1.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.1.4-create-internalauthmiddlewarego.md b/docs/content/stories/phase2/2.1.4-create-internalauthmiddlewarego.md deleted file mode 100644 index 01f32c2..0000000 --- a/docs/content/stories/phase2/2.1.4-create-internalauthmiddlewarego.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.1.4: Create `internal/auth/middleware.go`: - -## Metadata -- **Task ID**: 2.1.4 -- **Title**: Create `internal/auth/middleware.go`: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/auth/middleware.go`: - -## Requirements -- Create `internal/auth/middleware.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.1.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.1.5-add-login-endpoint-post-apiv1authlogin.md b/docs/content/stories/phase2/2.1.5-add-login-endpoint-post-apiv1authlogin.md deleted file mode 100644 index 8007e82..0000000 --- a/docs/content/stories/phase2/2.1.5-add-login-endpoint-post-apiv1authlogin.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.1.5: Add login endpoint: `POST /api/v1/auth/login` - -## Metadata -- **Task ID**: 2.1.5 -- **Title**: Add login endpoint: `POST /api/v1/auth/login` -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add login endpoint: `POST /api/v1/auth/login` - -## Requirements -- Add login endpoint: `POST /api/v1/auth/login` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.1.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.1.6-add-refresh-endpoint-post-apiv1authrefresh.md b/docs/content/stories/phase2/2.1.6-add-refresh-endpoint-post-apiv1authrefresh.md deleted file mode 100644 index 673eb3a..0000000 --- a/docs/content/stories/phase2/2.1.6-add-refresh-endpoint-post-apiv1authrefresh.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.1.6: Add refresh endpoint: `POST /api/v1/auth/refresh` - -## Metadata -- **Task ID**: 2.1.6 -- **Title**: Add refresh endpoint: `POST /api/v1/auth/refresh` -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add refresh endpoint: `POST /api/v1/auth/refresh` - -## Requirements -- Add refresh endpoint: `POST /api/v1/auth/refresh` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.1.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.2-identity-management.md b/docs/content/stories/phase2/2.2-identity-management.md new file mode 100644 index 0000000..d9704bd --- /dev/null +++ b/docs/content/stories/phase2/2.2-identity-management.md @@ -0,0 +1,82 @@ +# Story 2.2: Identity Management System + +## Metadata +- **Story ID**: 2.2 +- **Title**: Identity Management System +- **Phase**: 2 - Authentication & Authorization +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 8-10 hours +- **Dependencies**: 1.2, 2.1 + +## Goal +Build a complete user identity management system with registration, email verification, password management, and user CRUD operations. + +## Description +This story implements the complete user identity management system including user registration, email verification, password reset, password change, and user profile management. All operations are secured and audited. + +## Deliverables + +### 1. Identity Interfaces (`pkg/identity/identity.go`) +- `UserRepository` interface for user data access +- `UserService` interface for user business logic +- User domain models + +### 2. User Repository (`internal/identity/user_repo.go`) +- CRUD operations using Ent +- Password hashing (bcrypt or argon2) +- Email uniqueness validation +- User lookup by ID and email +- User search and pagination + +### 3. User Service (`internal/identity/user_service.go`) +- User registration with email verification token generation +- Email verification flow +- Password reset flow (token-based, time-limited) +- Password change with old password verification +- User profile updates +- User deletion (soft delete option) + +### 4. User Management API Endpoints +- `POST /api/v1/users` - Register new user +- `GET /api/v1/users/:id` - Get user profile (authorized) +- `PUT /api/v1/users/:id` - Update user profile (authorized) +- `DELETE /api/v1/users/:id` - Delete user (admin only) +- `POST /api/v1/users/verify-email` - Verify email with token +- `POST /api/v1/users/reset-password` - Request password reset +- `POST /api/v1/users/change-password` - Change password + +### 5. gRPC Server (Microservices) +- Expose gRPC server for identity service +- gRPC service definition in `api/proto/identity.proto` +- gRPC server implementation in `internal/identity/grpc/server.go` +- Service registration in service registry + +### 6. Integration +- Integration with email notification system (Phase 5 placeholder) +- Integration with audit logging +- Integration with authentication system +- Identity service is an independent service that can be deployed separately + +## Acceptance Criteria +- [ ] Users can register with email and password +- [ ] Passwords are securely hashed +- [ ] Email verification tokens are generated and validated +- [ ] Password reset flow works end-to-end +- [ ] Users can update their profiles +- [ ] User operations require proper authentication +- [ ] All user actions are audited +- [ ] Email uniqueness is enforced + +## Related ADRs +- [ADR-0018: Password Hashing](../../adr/0018-password-hashing.md) +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) +- [ADR-0030: Service Communication Strategy](../../adr/0030-service-communication-strategy.md) + +## Files to Create/Modify +- `pkg/identity/identity.go` - Identity interfaces +- `internal/identity/user_repo.go` - User repository +- `internal/identity/user_service.go` - User service +- `internal/identity/handler.go` - User handlers +- `internal/di/providers.go` - Add identity providers + diff --git a/docs/content/stories/phase2/2.2.1-create-pkgidentityidentitygo-interfaces.md b/docs/content/stories/phase2/2.2.1-create-pkgidentityidentitygo-interfaces.md deleted file mode 100644 index 7203166..0000000 --- a/docs/content/stories/phase2/2.2.1-create-pkgidentityidentitygo-interfaces.md +++ /dev/null @@ -1,59 +0,0 @@ -# Task 2.2.1: Create `pkg/identity/identity.go` interfaces: - -## Metadata -- **Task ID**: 2.2.1 -- **Title**: Create `pkg/identity/identity.go` interfaces: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/identity/identity.go` interfaces: - -## Requirements -- Create `pkg/identity/identity.go` interfaces: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.2.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type UserRepository interface { - FindByID(ctx context.Context, id string) (*User, error) - FindByEmail(ctx context.Context, email string) (*User, error) - Create(ctx context.Context, u *User) error - Update(ctx context.Context, u *User) error - Delete(ctx context.Context, id string) error - } - - type UserService interface { - Register(ctx context.Context, email, password string) (*User, error) - VerifyEmail(ctx context.Context, token string) error - ResetPassword(ctx context.Context, email string) error - ChangePassword(ctx context.Context, userID, oldPassword, newPassword string) error - } -``` diff --git a/docs/content/stories/phase2/2.2.2-implement-internalidentityuser_repogo-using-ent.md b/docs/content/stories/phase2/2.2.2-implement-internalidentityuser_repogo-using-ent.md deleted file mode 100644 index 60c9581..0000000 --- a/docs/content/stories/phase2/2.2.2-implement-internalidentityuser_repogo-using-ent.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.2.2: Implement `internal/identity/user_repo.go` using Ent: - -## Metadata -- **Task ID**: 2.2.2 -- **Title**: Implement `internal/identity/user_repo.go` using Ent: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/identity/user_repo.go` using Ent: - -## Requirements -- Implement `internal/identity/user_repo.go` using Ent: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.2.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.2.3-implement-internalidentityuser_servicego.md b/docs/content/stories/phase2/2.2.3-implement-internalidentityuser_servicego.md deleted file mode 100644 index 5019ca7..0000000 --- a/docs/content/stories/phase2/2.2.3-implement-internalidentityuser_servicego.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.2.3: Implement `internal/identity/user_service.go`: - -## Metadata -- **Task ID**: 2.2.3 -- **Title**: Implement `internal/identity/user_service.go`: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/identity/user_service.go`: - -## Requirements -- Implement `internal/identity/user_service.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.2.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.2.4-add-endpoints.md b/docs/content/stories/phase2/2.2.4-add-endpoints.md deleted file mode 100644 index 9d5a0a4..0000000 --- a/docs/content/stories/phase2/2.2.4-add-endpoints.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.2.4: Add endpoints: - -## Metadata -- **Task ID**: 2.2.4 -- **Title**: Add endpoints: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add endpoints: - -## Requirements -- Add endpoints: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.2.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.3-rbac-system.md b/docs/content/stories/phase2/2.3-rbac-system.md new file mode 100644 index 0000000..23ee868 --- /dev/null +++ b/docs/content/stories/phase2/2.3-rbac-system.md @@ -0,0 +1,70 @@ +# Story 2.3: Role-Based Access Control (RBAC) System + +## Metadata +- **Story ID**: 2.3 +- **Title**: Role-Based Access Control (RBAC) System +- **Phase**: 2 - Authentication & Authorization +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 6-8 hours +- **Dependencies**: 1.2, 2.1 + +## Goal +Implement a complete RBAC system with permissions, role management, and authorization middleware. + +## Description +This story implements the complete RBAC system including permission definitions, permission resolution, authorization checking, and middleware for protecting routes. + +## Deliverables + +### 1. Permission System (`pkg/perm/perm.go`) +- `Permission` type (string format: "module.resource.action") +- Core permission constants (system, user, role permissions) +- Permission validation utilities + +### 2. Permission Resolver (`pkg/perm/resolver.go` & `internal/perm/in_memory_resolver.go`) +- `PermissionResolver` interface +- Implementation that loads user roles and permissions from database +- Permission checking with caching +- Permission inheritance via roles + +### 3. Authorization System (`pkg/auth/authz.go` & `internal/auth/rbac_authorizer.go`) +- `Authorizer` interface +- RBAC authorizer implementation +- Extract user from context +- Check permissions +- Return authorization errors + +### 4. Authorization Middleware +- `RequirePermission(perm Permission) gin.HandlerFunc` decorator +- Integration with route registration +- Proper error responses for unauthorized access + +### 5. gRPC Server (Microservices) +- Expose gRPC server for authorization service +- gRPC service definition in `api/proto/authz.proto` +- gRPC server implementation in `internal/auth/grpc/authz_server.go` +- Service registration in service registry +- Uses `IdentityServiceClient` for user operations + +## Acceptance Criteria +- [ ] Permissions are defined and can be checked +- [ ] Users inherit permissions through roles +- [ ] Authorization middleware protects routes +- [ ] Unauthorized requests return 403 errors +- [ ] Permission checks are cached for performance +- [ ] Permission system is extensible by modules + +## Related ADRs +- [ADR-0019: Permission DSL Format](../../adr/0019-permission-dsl-format.md) +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) +- [ADR-0030: Service Communication Strategy](../../adr/0030-service-communication-strategy.md) + +## Files to Create/Modify +- `pkg/perm/perm.go` - Permission types +- `pkg/perm/resolver.go` - Permission resolver interface +- `internal/perm/in_memory_resolver.go` - Permission resolver implementation +- `pkg/auth/authz.go` - Authorization interface +- `internal/auth/rbac_authorizer.go` - RBAC authorizer +- `internal/auth/middleware.go` - Add authorization middleware + diff --git a/docs/content/stories/phase2/2.3.1-create-pkgpermpermgo.md b/docs/content/stories/phase2/2.3.1-create-pkgpermpermgo.md deleted file mode 100644 index c384067..0000000 --- a/docs/content/stories/phase2/2.3.1-create-pkgpermpermgo.md +++ /dev/null @@ -1,59 +0,0 @@ -# Task 2.3.1: Create `pkg/perm/perm.go`: - -## Metadata -- **Task ID**: 2.3.1 -- **Title**: Create `pkg/perm/perm.go`: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/perm/perm.go`: - -## Requirements -- Create `pkg/perm/perm.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.3.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Permission string - - // Core permissions - var ( - SystemHealthCheck Permission = "system.health.check" - UserCreate Permission = "user.create" - UserRead Permission = "user.read" - UserUpdate Permission = "user.update" - UserDelete Permission = "user.delete" - RoleCreate Permission = "role.create" - RoleRead Permission = "role.read" - RoleUpdate Permission = "role.update" - RoleDelete Permission = "role.delete" - ) -``` diff --git a/docs/content/stories/phase2/2.3.2-create-pkgpermresolvergo-interface.md b/docs/content/stories/phase2/2.3.2-create-pkgpermresolvergo-interface.md deleted file mode 100644 index 13e7d25..0000000 --- a/docs/content/stories/phase2/2.3.2-create-pkgpermresolvergo-interface.md +++ /dev/null @@ -1,49 +0,0 @@ -# Task 2.3.2: Create `pkg/perm/resolver.go` interface: - -## Metadata -- **Task ID**: 2.3.2 -- **Title**: Create `pkg/perm/resolver.go` interface: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/perm/resolver.go` interface: - -## Requirements -- Create `pkg/perm/resolver.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.3.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type PermissionResolver interface { - HasPermission(ctx context.Context, userID string, perm Permission) (bool, error) - GetUserPermissions(ctx context.Context, userID string) ([]Permission, error) - } -``` diff --git a/docs/content/stories/phase2/2.3.3-implement-internalpermin_memory_resolvergo.md b/docs/content/stories/phase2/2.3.3-implement-internalpermin_memory_resolvergo.md deleted file mode 100644 index e9e9477..0000000 --- a/docs/content/stories/phase2/2.3.3-implement-internalpermin_memory_resolvergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.3.3: Implement `internal/perm/in_memory_resolver.go`: - -## Metadata -- **Task ID**: 2.3.3 -- **Title**: Implement `internal/perm/in_memory_resolver.go`: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/perm/in_memory_resolver.go`: - -## Requirements -- Implement `internal/perm/in_memory_resolver.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.3.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.3.4-create-pkgauthauthzgo-interface.md b/docs/content/stories/phase2/2.3.4-create-pkgauthauthzgo-interface.md deleted file mode 100644 index 6bf7ad1..0000000 --- a/docs/content/stories/phase2/2.3.4-create-pkgauthauthzgo-interface.md +++ /dev/null @@ -1,48 +0,0 @@ -# Task 2.3.4: Create `pkg/auth/authz.go` interface: - -## Metadata -- **Task ID**: 2.3.4 -- **Title**: Create `pkg/auth/authz.go` interface: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/auth/authz.go` interface: - -## Requirements -- Create `pkg/auth/authz.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.3.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Authorizer interface { - Authorize(ctx context.Context, perm Permission) error - } -``` diff --git a/docs/content/stories/phase2/2.3.5-implement-internalauthrbac_authorizergo.md b/docs/content/stories/phase2/2.3.5-implement-internalauthrbac_authorizergo.md deleted file mode 100644 index d002632..0000000 --- a/docs/content/stories/phase2/2.3.5-implement-internalauthrbac_authorizergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.3.5: Implement `internal/auth/rbac_authorizer.go`: - -## Metadata -- **Task ID**: 2.3.5 -- **Title**: Implement `internal/auth/rbac_authorizer.go`: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/auth/rbac_authorizer.go`: - -## Requirements -- Implement `internal/auth/rbac_authorizer.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.3.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.3.6-create-authorization-middleware.md b/docs/content/stories/phase2/2.3.6-create-authorization-middleware.md deleted file mode 100644 index b3fece4..0000000 --- a/docs/content/stories/phase2/2.3.6-create-authorization-middleware.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.3.6: Create authorization middleware: - -## Metadata -- **Task ID**: 2.3.6 -- **Title**: Create authorization middleware: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create authorization middleware: - -## Requirements -- Create authorization middleware: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.3.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.4-role-management.md b/docs/content/stories/phase2/2.4-role-management.md new file mode 100644 index 0000000..541bfca --- /dev/null +++ b/docs/content/stories/phase2/2.4-role-management.md @@ -0,0 +1,64 @@ +# Story 2.4: Role Management API + +## Metadata +- **Story ID**: 2.4 +- **Title**: Role Management API +- **Phase**: 2 - Authentication & Authorization +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 5-6 hours +- **Dependencies**: 1.2, 2.3 + +## Goal +Provide complete API for managing roles, assigning permissions to roles, and assigning roles to users. + +## Description +This story implements the complete role management API allowing administrators to create, update, and delete roles, assign permissions to roles, and assign roles to users. + +## Deliverables + +### 1. Role Repository (`internal/identity/role_repo.go`) +- CRUD operations for roles +- Assign permissions to roles (many-to-many) +- Assign roles to users (many-to-many) +- List roles with permissions +- List users with roles + +### 2. Role Management API Endpoints +- `POST /api/v1/roles` - Create new role +- `GET /api/v1/roles` - List all roles (with pagination) +- `GET /api/v1/roles/:id` - Get role details with permissions +- `PUT /api/v1/roles/:id` - Update role +- `DELETE /api/v1/roles/:id` - Delete role +- `POST /api/v1/roles/:id/permissions` - Assign permissions to role +- `DELETE /api/v1/roles/:id/permissions/:permId` - Remove permission from role +- `POST /api/v1/users/:id/roles` - Assign roles to user +- `DELETE /api/v1/users/:id/roles/:roleId` - Remove role from user + +### 3. Authorization and Validation +- All endpoints protected (admin only) +- Input validation +- Error handling + +### 4. gRPC Server (Microservices) +- Expose role management via existing Authz service gRPC server +- Role management methods in `api/proto/authz.proto` +- Service registration in service registry + +## Acceptance Criteria +- [ ] Admin users can create and manage roles +- [ ] Permissions can be assigned to roles +- [ ] Roles can be assigned to users +- [ ] Role changes affect user permissions immediately +- [ ] All role operations are audited +- [ ] API endpoints are protected with proper permissions + +## Related ADRs +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) +- [ADR-0030: Service Communication Strategy](../../adr/0030-service-communication-strategy.md) + +## Files to Create/Modify +- `internal/identity/role_repo.go` - Role repository +- `internal/identity/role_handler.go` - Role handlers +- `internal/server/routes.go` - Add role routes + diff --git a/docs/content/stories/phase2/2.4.1-create-internalidentityrole_repogo.md b/docs/content/stories/phase2/2.4.1-create-internalidentityrole_repogo.md deleted file mode 100644 index d2a8aa9..0000000 --- a/docs/content/stories/phase2/2.4.1-create-internalidentityrole_repogo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.4.1: Create `internal/identity/role_repo.go`: - -## Metadata -- **Task ID**: 2.4.1 -- **Title**: Create `internal/identity/role_repo.go`: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/identity/role_repo.go`: - -## Requirements -- Create `internal/identity/role_repo.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.4.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.4.2-add-endpoints.md b/docs/content/stories/phase2/2.4.2-add-endpoints.md deleted file mode 100644 index ab7c3f2..0000000 --- a/docs/content/stories/phase2/2.4.2-add-endpoints.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.4.2: Add endpoints: - -## Metadata -- **Task ID**: 2.4.2 -- **Title**: Add endpoints: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add endpoints: - -## Requirements -- Add endpoints: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.4.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.5-audit-logging.md b/docs/content/stories/phase2/2.5-audit-logging.md new file mode 100644 index 0000000..72dd587 --- /dev/null +++ b/docs/content/stories/phase2/2.5-audit-logging.md @@ -0,0 +1,74 @@ +# Story 2.5: Audit Logging System + +## Metadata +- **Story ID**: 2.5 +- **Title**: Audit Logging System +- **Phase**: 2 - Authentication & Authorization +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 5-6 hours +- **Dependencies**: 1.2, 2.1 + +## Goal +Implement comprehensive audit logging that records all security-sensitive actions for compliance and security monitoring. + +## Description +This story implements a complete audit logging system that records all authenticated actions with full context including actor, action, target, and metadata. + +## Deliverables + +### 1. Audit Interface (`pkg/audit/audit.go`) +- `Auditor` interface with `Record(ctx, action)` method +- `AuditAction` struct with actor, action, target, metadata + +### 2. Audit Implementation (`internal/audit/ent_auditor.go`) +- Write audit logs to `audit_log` table +- Capture actor from request context +- Include request metadata (ID, IP, user agent, timestamp) +- Store action details and target information +- Support JSON metadata for flexible logging + +### 3. Audit Middleware +- Intercept all authenticated requests +- Record action (HTTP method + path) +- Extract user and request context +- Store audit log entry + +### 4. gRPC Server (Microservices) +- Expose gRPC server for audit service +- gRPC service definition in `api/proto/audit.proto` +- gRPC server implementation in `internal/audit/grpc/server.go` +- Service registration in service registry + +### 5. Integration +- Integration with authentication endpoints +- Log login attempts (success and failure) +- Log password changes +- Log role assignments and removals +- Log permission changes +- Log user registration + +### 5. Audit Log Query API +- `GET /api/v1/audit-logs` - Query audit logs with filters (admin only) +- Support filtering by actor, action, date range +- Pagination support + +## Acceptance Criteria +- [ ] All authenticated actions are logged +- [ ] Audit logs include complete context (actor, action, target, metadata) +- [ ] Audit logs are immutable (no updates/deletes) +- [ ] Audit logs can be queried and filtered +- [ ] Audit logging has minimal performance impact +- [ ] Audit logs are stored securely + +## Related ADRs +- [ADR-0020: Audit Logging Storage](../../adr/0020-audit-logging-storage.md) +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) +- [ADR-0030: Service Communication Strategy](../../adr/0030-service-communication-strategy.md) + +## Files to Create/Modify +- `pkg/audit/audit.go` - Audit interface +- `internal/audit/ent_auditor.go` - Audit implementation +- `internal/audit/middleware.go` - Audit middleware +- `internal/audit/handler.go` - Audit query handler + diff --git a/docs/content/stories/phase2/2.5.1-create-pkgauditauditgo-interface.md b/docs/content/stories/phase2/2.5.1-create-pkgauditauditgo-interface.md deleted file mode 100644 index 201bf9d..0000000 --- a/docs/content/stories/phase2/2.5.1-create-pkgauditauditgo-interface.md +++ /dev/null @@ -1,55 +0,0 @@ -# Task 2.5.1: Create `pkg/audit/audit.go` interface: - -## Metadata -- **Task ID**: 2.5.1 -- **Title**: Create `pkg/audit/audit.go` interface: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/audit/audit.go` interface: - -## Requirements -- Create `pkg/audit/audit.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.5.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Auditor interface { - Record(ctx context.Context, act AuditAction) error - } - - type AuditAction struct { - ActorID string - Action string - TargetID string - Metadata map[string]any - } -``` diff --git a/docs/content/stories/phase2/2.5.2-implement-internalauditent_auditorgo.md b/docs/content/stories/phase2/2.5.2-implement-internalauditent_auditorgo.md deleted file mode 100644 index 7dbfc47..0000000 --- a/docs/content/stories/phase2/2.5.2-implement-internalauditent_auditorgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.5.2: Implement `internal/audit/ent_auditor.go`: - -## Metadata -- **Task ID**: 2.5.2 -- **Title**: Implement `internal/audit/ent_auditor.go`: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/audit/ent_auditor.go`: - -## Requirements -- Implement `internal/audit/ent_auditor.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.5.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.5.3-add-audit-middleware.md b/docs/content/stories/phase2/2.5.3-add-audit-middleware.md deleted file mode 100644 index 63b7541..0000000 --- a/docs/content/stories/phase2/2.5.3-add-audit-middleware.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.5.3: Add audit middleware: - -## Metadata -- **Task ID**: 2.5.3 -- **Title**: Add audit middleware: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add audit middleware: - -## Requirements -- Add audit middleware: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.5.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.5.4-integrate-with-auth-endpoints.md b/docs/content/stories/phase2/2.5.4-integrate-with-auth-endpoints.md deleted file mode 100644 index f9b0850..0000000 --- a/docs/content/stories/phase2/2.5.4-integrate-with-auth-endpoints.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.5.4: Integrate with auth endpoints: - -## Metadata -- **Task ID**: 2.5.4 -- **Title**: Integrate with auth endpoints: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Integrate with auth endpoints: - -## Requirements -- Integrate with auth endpoints: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.5.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/2.6-database-seeding.md b/docs/content/stories/phase2/2.6-database-seeding.md new file mode 100644 index 0000000..9609e9e --- /dev/null +++ b/docs/content/stories/phase2/2.6-database-seeding.md @@ -0,0 +1,57 @@ +# Story 2.6: Database Seeding and Initialization + +## Metadata +- **Story ID**: 2.6 +- **Title**: Database Seeding and Initialization +- **Phase**: 2 - Authentication & Authorization +- **Status**: Pending +- **Priority**: Medium +- **Estimated Time**: 3-4 hours +- **Dependencies**: 1.2, 2.3, 2.4 + +## Goal +Provide database seeding functionality to create initial admin user, default roles, and core permissions. + +## Description +This story implements a seeding system that creates the initial admin user, default roles (admin, user, guest), and assigns core permissions to enable the platform to be used immediately after setup. + +## Deliverables + +### 1. Seed Script (`internal/seed/seed.go`) +- Create default admin user (if doesn't exist) +- Create default roles (admin, user, guest) +- Assign core permissions to roles +- Set up initial role hierarchy +- Idempotent operations (safe to run multiple times) + +### 2. Seed Command (`cmd/seed/main.go`) +- Command-line interface for seeding +- Configuration via environment variables +- Dry-run mode +- Verbose logging + +### 3. Integration +- Optional: Auto-seed on first startup in development +- Manual seeding in production +- Integration with application startup + +## Acceptance Criteria +- [ ] Seed script creates admin user successfully +- [ ] Default roles are created with proper permissions +- [ ] Seeding is idempotent (can run multiple times safely) +- [ ] Seed script can be run via CLI +- [ ] Admin user can login and manage system + +## Related ADRs +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) + +## Implementation Notes +- Seeding is typically done once per environment +- Can be run as a separate service or as part of deployment +- Uses service clients if accessing services (e.g., IdentityServiceClient for user creation) + +## Files to Create/Modify +- `internal/seed/seed.go` - Seed functions +- `cmd/seed/main.go` - Seed command +- `Makefile` - Add seed command + diff --git a/docs/content/stories/phase2/2.6.1-create-internalseedseedgo.md b/docs/content/stories/phase2/2.6.1-create-internalseedseedgo.md deleted file mode 100644 index aedaf74..0000000 --- a/docs/content/stories/phase2/2.6.1-create-internalseedseedgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 2.6.1: Create `internal/seed/seed.go`: - -## Metadata -- **Task ID**: 2.6.1 -- **Title**: Create `internal/seed/seed.go`: -- **Phase**: 2 - Authentication & Authorization -- **Section**: 2.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/seed/seed.go`: - -## Requirements -- Create `internal/seed/seed.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 2.6.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase2/README.md b/docs/content/stories/phase2/README.md index 4feb3f2..d0aa656 100644 --- a/docs/content/stories/phase2/README.md +++ b/docs/content/stories/phase2/README.md @@ -1,58 +1,52 @@ # Phase 2: Authentication & Authorization ## Overview -Implement JWT authentication, create identity management (User CRUD), build role and permission system, add authorization middleware, and implement audit logging. +Implement complete JWT-based authentication system, build comprehensive identity management with user lifecycle, create role-based access control (RBAC) system, implement authorization middleware and permission checks, add comprehensive audit logging for security compliance, and provide database seeding for initial setup. All core services (Auth, Identity, Authz, Audit) are independent microservices that expose gRPC servers and register with the service registry. -## Tasks +## Stories -### 2.1 Authentication (JWT) -- [2.1.1 - Install JWT Library](./2.1.1-install-githubcomgolang-jwtjwtv5.md) -- [2.1.2 - Create Auth Interfaces](./2.1.2-create-pkgauthauthgo-interfaces.md) -- [2.1.3 - Implement JWT Auth](./2.1.3-implement-internalauthjwt_authgo.md) -- [2.1.4 - Create Auth Middleware](./2.1.4-create-internalauthmiddlewarego.md) -- [2.1.5 - Add Login Endpoint](./2.1.5-add-login-endpoint-post-apiv1authlogin.md) -- [2.1.6 - Add Refresh Endpoint](./2.1.6-add-refresh-endpoint-post-apiv1authrefresh.md) +### 2.1 JWT Authentication System +- [Story: 2.1 - JWT Authentication](./2.1-jwt-authentication.md) +- **Goal:** Implement a complete JWT-based authentication system with access tokens, refresh tokens, and secure token management. +- **Deliverables:** Authentication interfaces, JWT implementation, authentication middleware, login/refresh endpoints -### 2.2 Identity Management -- [2.2.1 - Create Identity Interfaces](./2.2.1-create-pkgidentityidentitygo-interfaces.md) -- [2.2.2 - Implement User Repository](./2.2.2-implement-internalidentityuser_repogo-using-ent.md) -- [2.2.3 - Implement User Service](./2.2.3-implement-internalidentityuser_servicego.md) -- [2.2.4 - Add Endpoints](./2.2.4-add-endpoints.md) +### 2.2 Identity Management System +- [Story: 2.2 - Identity Management](./2.2-identity-management.md) +- **Goal:** Build a complete user identity management system with registration, email verification, password management, and user CRUD operations. +- **Deliverables:** Identity interfaces, user repository, user service, user management API endpoints -### 2.3 Roles & Permissions -- [2.3.1 - Create Permission Types](./2.3.1-create-pkgpermpermgo.md) -- [2.3.2 - Create Permission Resolver Interface](./2.3.2-create-pkgpermresolvergo-interface.md) -- [2.3.3 - Implement In-Memory Resolver](./2.3.3-implement-internalpermin_memory_resolvergo.md) -- [2.3.4 - Create Authorization Interface](./2.3.4-create-pkgauthauthzgo-interface.md) -- [2.3.5 - Implement RBAC Authorizer](./2.3.5-implement-internalauthrbac_authorizergo.md) -- [2.3.6 - Create Authorization Middleware](./2.3.6-create-authorization-middleware.md) +### 2.3 Role-Based Access Control (RBAC) System +- [Story: 2.3 - RBAC System](./2.3-rbac-system.md) +- **Goal:** Implement a complete RBAC system with permissions, role management, and authorization middleware. +- **Deliverables:** Permission system, permission resolver, authorization system, authorization middleware -### 2.4 Role Management -- [2.4.1 - Create Role Repository](./2.4.1-create-internalidentityrole_repogo.md) -- [2.4.2 - Add Endpoints](./2.4.2-add-endpoints.md) +### 2.4 Role Management API +- [Story: 2.4 - Role Management](./2.4-role-management.md) +- **Goal:** Provide complete API for managing roles, assigning permissions to roles, and assigning roles to users. +- **Deliverables:** Role repository, role management API endpoints, authorization and validation -### 2.5 Audit Logging -- [2.5.1 - Create Audit Interface](./2.5.1-create-pkgauditauditgo-interface.md) -- [2.5.2 - Implement Ent Auditor](./2.5.2-implement-internalauditent_auditorgo.md) -- [2.5.3 - Add Audit Middleware](./2.5.3-add-audit-middleware.md) -- [2.5.4 - Integrate with Auth Endpoints](./2.5.4-integrate-with-auth-endpoints.md) +### 2.5 Audit Logging System +- [Story: 2.5 - Audit Logging](./2.5-audit-logging.md) +- **Goal:** Implement comprehensive audit logging that records all security-sensitive actions for compliance and security monitoring. +- **Deliverables:** Audit interface, audit implementation, audit middleware, audit log query API -### 2.6 Database Seeding -- [2.6.1 - Create Seed Script](./2.6.1-create-internalseedseedgo.md) +### 2.6 Database Seeding and Initialization +- [Story: 2.6 - Database Seeding](./2.6-database-seeding.md) +- **Goal:** Provide database seeding functionality to create initial admin user, default roles, and core permissions. +- **Deliverables:** Seed script, seed command, integration with application startup ## Deliverables Checklist -- [ ] JWT authentication working (access + refresh tokens) -- [ ] User registration and management endpoints -- [ ] Role and permission system implemented -- [ ] Authorization middleware protecting endpoints -- [ ] Audit logging captures all auth actions -- [ ] Database seeding for initial admin user +- [ ] JWT authentication with access/refresh tokens +- [ ] User CRUD with email verification +- [ ] Role and permission management +- [ ] Authorization middleware +- [ ] Audit logging for all actions +- [ ] Seed script for initial data ## Acceptance Criteria -- `POST /api/v1/auth/login` returns JWT tokens -- `POST /api/v1/auth/refresh` issues new access token -- Protected endpoints require valid JWT -- Authorization middleware checks permissions -- All auth actions are logged to audit table -- Admin user can be created via seed script - +- User can register and login +- JWT tokens are validated on protected routes +- Users without permission get 403 +- All actions are logged in audit table +- Admin can create roles and assign permissions +- Integration test: user without permission cannot access protected resource diff --git a/docs/content/stories/phase3/3.1-module-system-interface.md b/docs/content/stories/phase3/3.1-module-system-interface.md new file mode 100644 index 0000000..18a14f4 --- /dev/null +++ b/docs/content/stories/phase3/3.1-module-system-interface.md @@ -0,0 +1,85 @@ +# Story 3.1: Module System Interface and Registry + +## Metadata +- **Story ID**: 3.1 +- **Title**: Module System Interface and Registry +- **Phase**: 3 - Module Framework +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 5-6 hours +- **Dependencies**: 1.1, 2.3 + +## Goal +Design and implement the complete module system interface with registration, dependency resolution, and lifecycle management. + +## Description +This story creates the foundation of the module system by defining the module interface, manifest structure, and registry. The system must support module registration, dependency validation, and lifecycle hooks. + +## Deliverables + +### 1. Module Interface (`pkg/module/module.go`) +- `IModule` interface with: + - `Name() string` - Module name + - `Version() string` - Module version + - `Dependencies() []string` - Module dependencies + - `Init() fx.Option` - FX options for module initialization + - `Migrations() []func(*ent.Client) error` - Database migrations + - Optional lifecycle hooks: `OnStart(ctx context.Context) error` + - Optional lifecycle hooks: `OnStop(ctx context.Context) error` + +### 2. Module Manifest (`pkg/module/manifest.go`) +- `Manifest` struct with: + - Name, Version, Dependencies + - Permissions list + - Routes definition +- `module.yaml` schema definition +- Manifest parsing and validation + +### 3. Module Registry (`internal/registry/registry.go`) +- Thread-safe module map +- `Register(m IModule)` function +- `All() []IModule` function +- `Get(name string) (IModule, error)` function +- Dependency validation (check dependencies are satisfied) +- Duplicate name detection +- Version compatibility checking +- Dependency cycle detection + +## Implementation Steps + +1. **Create Module Interface** + - Create `pkg/module/module.go` + - Define IModule interface + - Add lifecycle hooks + +2. **Create Module Manifest** + - Create `pkg/module/manifest.go` + - Define Manifest struct + - Define module.yaml schema + +3. **Create Module Registry** + - Create `internal/registry/registry.go` + - Implement thread-safe registry + - Add validation logic + +4. **Test Registration** + - Test module registration + - Test dependency validation + - Test duplicate detection + +## Acceptance Criteria +- [ ] Modules can register via `registry.Register()` +- [ ] Registry validates dependencies +- [ ] Registry prevents duplicate registrations +- [ ] Module interface is extensible +- [ ] Dependency cycles are detected +- [ ] Version compatibility is checked + +## Related ADRs +- [ADR-0021: Module Loading Strategy](../../adr/0021-module-loading-strategy.md) + +## Files to Create/Modify +- `pkg/module/module.go` - Module interface +- `pkg/module/manifest.go` - Module manifest +- `internal/registry/registry.go` - Module registry + diff --git a/docs/content/stories/phase3/3.1.1-create-pkgmodulemodulego.md b/docs/content/stories/phase3/3.1.1-create-pkgmodulemodulego.md deleted file mode 100644 index e3862a7..0000000 --- a/docs/content/stories/phase3/3.1.1-create-pkgmodulemodulego.md +++ /dev/null @@ -1,52 +0,0 @@ -# Task 3.1.1: Create `pkg/module/module.go`: - -## Metadata -- **Task ID**: 3.1.1 -- **Title**: Create `pkg/module/module.go`: -- **Phase**: 3 - Module Framework -- **Section**: 3.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/module/module.go`: - -## Requirements -- Create `pkg/module/module.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.1.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type IModule interface { - Name() string - Version() string - Dependencies() []string - Init() fx.Option - Migrations() []func(*ent.Client) error - } -``` diff --git a/docs/content/stories/phase3/3.1.2-create-pkgmodulemanifestgo.md b/docs/content/stories/phase3/3.1.2-create-pkgmodulemanifestgo.md deleted file mode 100644 index 1d011b6..0000000 --- a/docs/content/stories/phase3/3.1.2-create-pkgmodulemanifestgo.md +++ /dev/null @@ -1,52 +0,0 @@ -# Task 3.1.2: Create `pkg/module/manifest.go`: - -## Metadata -- **Task ID**: 3.1.2 -- **Title**: Create `pkg/module/manifest.go`: -- **Phase**: 3 - Module Framework -- **Section**: 3.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/module/manifest.go`: - -## Requirements -- Create `pkg/module/manifest.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.1.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Manifest struct { - Name string - Version string - Dependencies []string - Permissions []string - Routes []Route - } -``` diff --git a/docs/content/stories/phase3/3.1.3-define-moduleyaml-schema-used-for-code-generation.md b/docs/content/stories/phase3/3.1.3-define-moduleyaml-schema-used-for-code-generation.md deleted file mode 100644 index a56ba4b..0000000 --- a/docs/content/stories/phase3/3.1.3-define-moduleyaml-schema-used-for-code-generation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.1.3: Define `module.yaml` schema (used for code generation) - -## Metadata -- **Task ID**: 3.1.3 -- **Title**: Define `module.yaml` schema (used for code generation) -- **Phase**: 3 - Module Framework -- **Section**: 3.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Define `module.yaml` schema (used for code generation) - -## Requirements -- Define `module.yaml` schema (used for code generation) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.1.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.2-permission-code-generation.md b/docs/content/stories/phase3/3.2-permission-code-generation.md new file mode 100644 index 0000000..c8fdd2f --- /dev/null +++ b/docs/content/stories/phase3/3.2-permission-code-generation.md @@ -0,0 +1,65 @@ +# Story 3.2: Permission Code Generation System + +## Metadata +- **Story ID**: 3.2 +- **Title**: Permission Code Generation System +- **Phase**: 3 - Module Framework +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 4-5 hours +- **Dependencies**: 3.1 + +## Goal +Create automated permission code generation from module manifests to ensure type-safe permission constants. + +## Description +This story implements a code generation system that scans module manifests and generates type-safe permission constants, ensuring permissions are defined in one place and used consistently throughout the codebase. + +## Deliverables + +### 1. Permission Generation Script (`scripts/generate-permissions.go`) +- Scan all `modules/*/module.yaml` files +- Extract permissions from manifests +- Generate `pkg/perm/generated.go` with Permission constants +- Support for multiple modules +- Error handling and validation +- Format generated code + +### 2. Go Generate Integration +- `//go:generate` directive in `pkg/perm/perm.go` +- Automatic generation on build +- Integration with build process + +### 3. Makefile Integration +- `make generate` command +- Run permission generation +- Verify generated code + +## Implementation Steps + +1. **Create Generation Script** + - Create `scripts/generate-permissions.go` + - Implement YAML parsing + - Implement code generation + +2. **Add Go Generate Directive** + - Add directive to `pkg/perm/perm.go` + - Test generation + +3. **Update Makefile** + - Add `make generate` command + - Integrate with build process + +## Acceptance Criteria +- [ ] Permission constants are generated from `module.yaml` +- [ ] Generated code is type-safe +- [ ] Code generation runs automatically +- [ ] Permissions follow naming convention +- [ ] Multiple modules are supported +- [ ] Generated code is properly formatted + +## Files to Create/Modify +- `scripts/generate-permissions.go` - Generation script +- `pkg/perm/perm.go` - Add go:generate directive +- `Makefile` - Add generate command + diff --git a/docs/content/stories/phase3/3.2.1-create-internalregistryregistrygo.md b/docs/content/stories/phase3/3.2.1-create-internalregistryregistrygo.md deleted file mode 100644 index e847a2c..0000000 --- a/docs/content/stories/phase3/3.2.1-create-internalregistryregistrygo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.2.1: Create `internal/registry/registry.go`: - -## Metadata -- **Task ID**: 3.2.1 -- **Title**: Create `internal/registry/registry.go`: -- **Phase**: 3 - Module Framework -- **Section**: 3.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/registry/registry.go`: - -## Requirements -- Create `internal/registry/registry.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.2.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.2.2-add-registration-validation.md b/docs/content/stories/phase3/3.2.2-add-registration-validation.md deleted file mode 100644 index da58b03..0000000 --- a/docs/content/stories/phase3/3.2.2-add-registration-validation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.2.2: Add registration validation: - -## Metadata -- **Task ID**: 3.2.2 -- **Title**: Add registration validation: -- **Phase**: 3 - Module Framework -- **Section**: 3.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add registration validation: - -## Requirements -- Add registration validation: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.2.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.3-module-loader.md b/docs/content/stories/phase3/3.3-module-loader.md new file mode 100644 index 0000000..f78dc8f --- /dev/null +++ b/docs/content/stories/phase3/3.3-module-loader.md @@ -0,0 +1,83 @@ +# Story 3.3: Module Loader and Initialization + +## Metadata +- **Story ID**: 3.3 +- **Title**: Module Loader and Initialization +- **Phase**: 3 - Module Framework +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 6-8 hours +- **Dependencies**: 3.1, 1.2 + +## Goal +Implement module loading (static and dynamic) with dependency resolution and automatic initialization. + +## Description +This story implements the complete module loading system that discovers modules, resolves dependencies, initializes them in the correct order, and runs their migrations. It supports both static registration (preferred) and dynamic plugin loading. + +## Deliverables + +### 1. Module Loader (`internal/pluginloader/loader.go`) +- Support static registration (preferred method) +- Optional: Go plugin loading (`.so` files) +- Module discovery from `modules/*/module.yaml` +- Loader interface for extensibility + +### 2. Static Loader (`internal/pluginloader/static_loader.go`) +- Import modules via side-effect imports +- Collect all registered modules +- Module discovery and registration + +### 3. Optional Plugin Loader (`internal/pluginloader/plugin_loader.go`) +- Scan `./plugins/*.so` files +- Load via `plugin.Open()` +- Extract and validate module symbols +- Version compatibility checking + +### 4. Module Initializer (`internal/module/initializer.go`) +- Collect all registered modules +- Resolve dependency order (topological sort) +- Initialize each module's `Init()` fx.Option +- Merge all options into main fx container +- Run migrations in dependency order +- Handle errors gracefully + +### 5. FX Lifecycle Integration +- Call `OnStart()` during app startup +- Call `OnStop()` during graceful shutdown +- Proper error handling + +## Implementation Steps + +1. **Create Module Loader** + - Create `internal/pluginloader/loader.go` + - Define loader interface + +2. **Implement Static Loader** + - Create `internal/pluginloader/static_loader.go` + - Implement static module loading + +3. **Implement Module Initializer** + - Create `internal/module/initializer.go` + - Implement dependency resolution + - Implement initialization + +4. **Integrate with FX** + - Add lifecycle hooks + - Test initialization + +## Acceptance Criteria +- [ ] Modules load in correct dependency order +- [ ] Module migrations run automatically +- [ ] Module initialization integrates with FX +- [ ] Lifecycle hooks work correctly +- [ ] Dependency resolution handles cycles +- [ ] Errors are handled gracefully + +## Files to Create/Modify +- `internal/pluginloader/loader.go` - Loader interface +- `internal/pluginloader/static_loader.go` - Static loader +- `internal/pluginloader/plugin_loader.go` - Plugin loader (optional) +- `internal/module/initializer.go` - Module initializer +- `internal/di/container.go` - Integrate module initialization + diff --git a/docs/content/stories/phase3/3.3.1-create-scriptsgenerate-permissionsgo.md b/docs/content/stories/phase3/3.3.1-create-scriptsgenerate-permissionsgo.md deleted file mode 100644 index 23eb123..0000000 --- a/docs/content/stories/phase3/3.3.1-create-scriptsgenerate-permissionsgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.3.1: Create `scripts/generate-permissions.go`: - -## Metadata -- **Task ID**: 3.3.1 -- **Title**: Create `scripts/generate-permissions.go`: -- **Phase**: 3 - Module Framework -- **Section**: 3.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `scripts/generate-permissions.go`: - -## Requirements -- Create `scripts/generate-permissions.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.3.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.3.2-add-gogenerate-directive-to-pkgpermpermgo.md b/docs/content/stories/phase3/3.3.2-add-gogenerate-directive-to-pkgpermpermgo.md deleted file mode 100644 index 70ec12a..0000000 --- a/docs/content/stories/phase3/3.3.2-add-gogenerate-directive-to-pkgpermpermgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.3.2: Add `//go:generate` directive to `pkg/perm/perm.go` - -## Metadata -- **Task ID**: 3.3.2 -- **Title**: Add `//go:generate` directive to `pkg/perm/perm.go` -- **Phase**: 3 - Module Framework -- **Section**: 3.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add `//go:generate` directive to `pkg/perm/perm.go` - -## Requirements -- Add `//go:generate` directive to `pkg/perm/perm.go` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.3.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.3.3-update-makefile-with-make-generate-command.md b/docs/content/stories/phase3/3.3.3-update-makefile-with-make-generate-command.md deleted file mode 100644 index 77de86e..0000000 --- a/docs/content/stories/phase3/3.3.3-update-makefile-with-make-generate-command.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.3.3: Update `Makefile` with `make generate` command - -## Metadata -- **Task ID**: 3.3.3 -- **Title**: Update `Makefile` with `make generate` command -- **Phase**: 3 - Module Framework -- **Section**: 3.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Update `Makefile` with `make generate` command - -## Requirements -- Update `Makefile` with `make generate` command - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.3.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.4-module-cli.md b/docs/content/stories/phase3/3.4-module-cli.md new file mode 100644 index 0000000..5ab4670 --- /dev/null +++ b/docs/content/stories/phase3/3.4-module-cli.md @@ -0,0 +1,62 @@ +# Story 3.4: Module Management CLI Tool + +## Metadata +- **Story ID**: 3.4 +- **Title**: Module Management CLI Tool +- **Phase**: 3 - Module Framework +- **Status**: Pending +- **Priority**: Medium +- **Estimated Time**: 4-5 hours +- **Dependencies**: 3.1, 3.3 + +## Goal +Provide CLI tooling for managing modules, validating dependencies, and testing module loading. + +## Description +This story creates a CLI tool that allows developers and operators to manage modules, validate dependencies, test module loading, and inspect module information. + +## Deliverables + +### 1. CLI Tool (`cmd/platformctl/main.go`) +- `platformctl modules list` - List all loaded modules with versions +- `platformctl modules validate` - Validate module dependencies +- `platformctl modules test ` - Test module loading +- `platformctl modules info ` - Show module details +- `platformctl modules dependencies ` - Show module dependencies +- Command-line argument parsing +- Error handling and user-friendly output + +### 2. Makefile Integration +- `make install-cli` - Install CLI tool +- `make cli` - Build CLI tool +- `make cli-test` - Test CLI tool + +## Implementation Steps + +1. **Create CLI Tool** + - Create `cmd/platformctl/main.go` + - Use cobra for CLI framework + - Implement commands + +2. **Implement Commands** + - List command + - Validate command + - Test command + - Info command + +3. **Add to Makefile** + - Add build commands + - Add install commands + +## Acceptance Criteria +- [ ] CLI tool lists all modules +- [ ] Dependency validation works +- [ ] Module testing works +- [ ] CLI is installable and usable +- [ ] Commands provide helpful output +- [ ] Error messages are clear + +## Files to Create/Modify +- `cmd/platformctl/main.go` - CLI tool +- `Makefile` - Add CLI commands + diff --git a/docs/content/stories/phase3/3.4.1-create-internalpluginloaderloadergo.md b/docs/content/stories/phase3/3.4.1-create-internalpluginloaderloadergo.md deleted file mode 100644 index 8226f77..0000000 --- a/docs/content/stories/phase3/3.4.1-create-internalpluginloaderloadergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.4.1: Create `internal/pluginloader/loader.go`: - -## Metadata -- **Task ID**: 3.4.1 -- **Title**: Create `internal/pluginloader/loader.go`: -- **Phase**: 3 - Module Framework -- **Section**: 3.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/pluginloader/loader.go`: - -## Requirements -- Create `internal/pluginloader/loader.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.4.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.4.2-implement-internalpluginloaderstatic_loadergo.md b/docs/content/stories/phase3/3.4.2-implement-internalpluginloaderstatic_loadergo.md deleted file mode 100644 index fbdd6ca..0000000 --- a/docs/content/stories/phase3/3.4.2-implement-internalpluginloaderstatic_loadergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.4.2: Implement `internal/pluginloader/static_loader.go`: - -## Metadata -- **Task ID**: 3.4.2 -- **Title**: Implement `internal/pluginloader/static_loader.go`: -- **Phase**: 3 - Module Framework -- **Section**: 3.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/pluginloader/static_loader.go`: - -## Requirements -- Implement `internal/pluginloader/static_loader.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.4.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.4.3-implement-internalpluginloaderplugin_loadergo-opti.md b/docs/content/stories/phase3/3.4.3-implement-internalpluginloaderplugin_loadergo-opti.md deleted file mode 100644 index 9fa5b64..0000000 --- a/docs/content/stories/phase3/3.4.3-implement-internalpluginloaderplugin_loadergo-opti.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.4.3: Implement `internal/pluginloader/plugin_loader.go` (optional): - -## Metadata -- **Task ID**: 3.4.3 -- **Title**: Implement `internal/pluginloader/plugin_loader.go` (optional): -- **Phase**: 3 - Module Framework -- **Section**: 3.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/pluginloader/plugin_loader.go` (optional): - -## Requirements -- Implement `internal/pluginloader/plugin_loader.go` (optional): - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.4.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.5-service-registry.md b/docs/content/stories/phase3/3.5-service-registry.md new file mode 100644 index 0000000..fc23a6f --- /dev/null +++ b/docs/content/stories/phase3/3.5-service-registry.md @@ -0,0 +1,138 @@ +# Story 3.5: Service Registry and Discovery + +## Metadata +- **Story ID**: 3.5 +- **Title**: Service Registry and Discovery +- **Phase**: 3 - Module Framework +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 5-6 hours +- **Dependencies**: 1.7, 3.1 + +## Goal +Implement a service registry that enables service discovery for microservices, allowing services to locate and communicate with each other. + +## Description +This story creates a service registry system supporting Consul and Kubernetes service discovery. The registry enables service discovery, health checking, and automatic service registration. + +## Deliverables + +### 1. Service Registry Interface (`pkg/services/registry.go`) +- `ServiceRegistry` interface with: + - `Register(service ServiceInfo) error` - Register a service + - `Deregister(serviceID string) error` - Deregister a service + - `Discover(serviceName string) ([]ServiceInfo, error)` - Discover services + - `GetService(serviceName string) (ServiceInfo, error)` - Get specific service + - `ListServices() ([]ServiceInfo, error)` - List all services + - `HealthCheck(serviceID string) error` - Check service health + +### 2. Service Info Structure +- `ServiceInfo` struct with: + - ID, Name, Version + - Address (host:port) + - Protocol (local, grpc, http) + - Health status + - Metadata + +### 3. Consul Registry (`internal/services/registry/consul.go`) +- Consul integration (primary for production) +- Service registration and discovery +- Health checking +- Automatic service registration + +### 4. Kubernetes Service Discovery (`internal/services/registry/kubernetes.go`) +- Kubernetes service discovery +- Service health checking +- Automatic service registration via K8s services + +### 5. Service Registration +- Auto-register services on startup +- Health check endpoints +- Graceful deregistration on shutdown + +### 6. Configuration +- Registry configuration in `config/default.yaml`: + ```yaml + service_registry: + type: consul # consul, kubernetes, etcd + consul: + address: localhost:8500 + kubernetes: + namespace: default + etcd: + endpoints: + - localhost:2379 + ``` + +### 7. Integration +- Integrate with service factory +- Auto-register core services +- Support module service registration + +## Implementation Steps + +1. **Create Service Registry Interface** + - Create `pkg/services/registry.go` + - Define ServiceRegistry interface + - Define ServiceInfo struct + +2. **Implement Consul Registry** + - Create `internal/services/registry/consul.go` + - Implement Consul integration + - Add health checking + +3. **Implement Kubernetes Registry** + - Create `internal/services/registry/kubernetes.go` + - Implement K8s service discovery + - Add health checking + +4. **Add Service Registration** + - Auto-register services on startup + - Add health check endpoints + - Handle graceful shutdown + +5. **Add Configuration** + - Add registry configuration + - Support multiple registry types + +6. **Integrate with Service Factory** + - Use registry for service discovery + - Resolve services via registry + +## Acceptance Criteria +- [ ] Service registry interface is defined +- [ ] Consul registry works correctly +- [ ] Kubernetes registry works correctly +- [ ] Services are auto-registered on startup +- [ ] Service discovery works +- [ ] Health checking works +- [ ] Registry is configurable +- [ ] Graceful deregistration works + +## Related ADRs +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) +- [ADR-0030: Service Communication Strategy](../../adr/0030-service-communication-strategy.md) + +## Implementation Notes +- Consul is the primary registry for production +- Kubernetes service discovery for K8s deployments +- Health checks should be lightweight +- Support service versioning + +## Testing +```bash +# Test service registry +go test ./internal/services/registry/... + +# Test service discovery +go test ./internal/services/registry/... -run TestDiscovery +``` + +## Files to Create/Modify +- `pkg/services/registry.go` - Service registry interface +- `internal/services/registry/consul.go` - Consul registry +- `internal/services/registry/kubernetes.go` - Kubernetes registry +- `internal/services/factory.go` - Integrate with registry +- `internal/di/providers.go` - Add registry provider +- `config/default.yaml` - Add registry configuration + diff --git a/docs/content/stories/phase3/3.5.1-create-internalmoduleinitializergo.md b/docs/content/stories/phase3/3.5.1-create-internalmoduleinitializergo.md deleted file mode 100644 index 72fda56..0000000 --- a/docs/content/stories/phase3/3.5.1-create-internalmoduleinitializergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.5.1: Create `internal/module/initializer.go`: - -## Metadata -- **Task ID**: 3.5.1 -- **Title**: Create `internal/module/initializer.go`: -- **Phase**: 3 - Module Framework -- **Section**: 3.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/module/initializer.go`: - -## Requirements -- Create `internal/module/initializer.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.5.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.5.2-run-migrations.md b/docs/content/stories/phase3/3.5.2-run-migrations.md deleted file mode 100644 index cf7a57c..0000000 --- a/docs/content/stories/phase3/3.5.2-run-migrations.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.5.2: Run migrations: - -## Metadata -- **Task ID**: 3.5.2 -- **Title**: Run migrations: -- **Phase**: 3 - Module Framework -- **Section**: 3.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Run migrations: - -## Requirements -- Run migrations: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.5.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.6.1-extend-pkgmodulemodulego.md b/docs/content/stories/phase3/3.6.1-extend-pkgmodulemodulego.md deleted file mode 100644 index ac1c5cf..0000000 --- a/docs/content/stories/phase3/3.6.1-extend-pkgmodulemodulego.md +++ /dev/null @@ -1,50 +0,0 @@ -# Task 3.6.1: Extend `pkg/module/module.go`: - -## Metadata -- **Task ID**: 3.6.1 -- **Title**: Extend `pkg/module/module.go`: -- **Phase**: 3 - Module Framework -- **Section**: 3.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Extend `pkg/module/module.go`: - -## Requirements -- Extend `pkg/module/module.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.6.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type IModule interface { - // ... existing methods - OnStart(ctx context.Context) error // Optional - OnStop(ctx context.Context) error // Optional - } -``` diff --git a/docs/content/stories/phase3/3.6.2-integrate-with-fxlifecycle.md b/docs/content/stories/phase3/3.6.2-integrate-with-fxlifecycle.md deleted file mode 100644 index 195ef56..0000000 --- a/docs/content/stories/phase3/3.6.2-integrate-with-fxlifecycle.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.6.2: Integrate with fx.Lifecycle: - -## Metadata -- **Task ID**: 3.6.2 -- **Title**: Integrate with fx.Lifecycle: -- **Phase**: 3 - Module Framework -- **Section**: 3.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Integrate with fx.Lifecycle: - -## Requirements -- Integrate with fx.Lifecycle: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.6.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.7.1-create-cmdplatformctlmaingo.md b/docs/content/stories/phase3/3.7.1-create-cmdplatformctlmaingo.md deleted file mode 100644 index d22f317..0000000 --- a/docs/content/stories/phase3/3.7.1-create-cmdplatformctlmaingo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.7.1: Create `cmd/platformctl/main.go`: - -## Metadata -- **Task ID**: 3.7.1 -- **Title**: Create `cmd/platformctl/main.go`: -- **Phase**: 3 - Module Framework -- **Section**: 3.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `cmd/platformctl/main.go`: - -## Requirements -- Create `cmd/platformctl/main.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.7.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/3.7.2-add-to-makefile-make-install-cli.md b/docs/content/stories/phase3/3.7.2-add-to-makefile-make-install-cli.md deleted file mode 100644 index cd55ee9..0000000 --- a/docs/content/stories/phase3/3.7.2-add-to-makefile-make-install-cli.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 3.7.2: Add to `Makefile`: `make install-cli` - -## Metadata -- **Task ID**: 3.7.2 -- **Title**: Add to `Makefile`: `make install-cli` -- **Phase**: 3 - Module Framework -- **Section**: 3.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add to `Makefile`: `make install-cli` - -## Requirements -- Add to `Makefile`: `make install-cli` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 3.7.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase3/README.md b/docs/content/stories/phase3/README.md index 81d8078..16b7150 100644 --- a/docs/content/stories/phase3/README.md +++ b/docs/content/stories/phase3/README.md @@ -1,54 +1,48 @@ # Phase 3: Module Framework ## Overview -Define module interface and registration system, implement static module registry, create permission code generation tool, build module loader (support both static and plugin modes), and add module discovery and initialization. +Design and implement complete module system interface, build module registry with dependency resolution, create permission code generation from module manifests, implement module loader supporting static and dynamic loading, add module lifecycle management and initialization, and provide CLI tooling for module management. -## Tasks +## Stories -### 3.1 Module Interface -- [3.1.1 - Create Module Interface](./3.1.1-create-pkgmodulemodulego.md) -- [3.1.2 - Create Module Manifest](./3.1.2-create-pkgmodulemanifestgo.md) -- [3.1.3 - Define Module YAML Schema](./3.1.3-define-moduleyaml-schema-used-for-code-generation.md) +### 3.1 Module System Interface and Registry +- [Story: 3.1 - Module System Interface](./3.1-module-system-interface.md) +- **Goal:** Design and implement the complete module system interface with registration, dependency resolution, and lifecycle management. +- **Deliverables:** Module interface, module manifest, module registry -### 3.2 Static Module Registry -- [3.2.1 - Create Registry](./3.2.1-create-internalregistryregistrygo.md) -- [3.2.2 - Add Registration Validation](./3.2.2-add-registration-validation.md) +### 3.2 Permission Code Generation System +- [Story: 3.2 - Permission Code Generation](./3.2-permission-code-generation.md) +- **Goal:** Create automated permission code generation from module manifests to ensure type-safe permission constants. +- **Deliverables:** Permission generation script, Go generate integration, Makefile integration -### 3.3 Permission Code Generation -- [3.3.1 - Create Generate Script](./3.3.1-create-scriptsgenerate-permissionsgo.md) -- [3.3.2 - Add Go Generate Directive](./3.3.2-add-gogenerate-directive-to-pkgpermpermgo.md) -- [3.3.3 - Update Makefile](./3.3.3-update-makefile-with-make-generate-command.md) +### 3.3 Module Loader and Initialization +- [Story: 3.3 - Module Loader](./3.3-module-loader.md) +- **Goal:** Implement module loading (static and dynamic) with dependency resolution and automatic initialization. +- **Deliverables:** Module loader, static loader, plugin loader, module initializer, FX lifecycle integration -### 3.4 Module Loader -- [3.4.1 - Create Loader Interface](./3.4.1-create-internalpluginloaderloadergo.md) -- [3.4.2 - Implement Static Loader](./3.4.2-implement-internalpluginloaderstatic_loadergo.md) -- [3.4.3 - Implement Plugin Loader](./3.4.3-implement-internalpluginloaderplugin_loadergo-opti.md) +### 3.4 Module Management CLI Tool +- [Story: 3.4 - Module CLI](./3.4-module-cli.md) +- **Goal:** Provide CLI tooling for managing modules, validating dependencies, and testing module loading. +- **Deliverables:** CLI tool, Makefile integration -### 3.5 Module Initialization -- [3.5.1 - Create Initializer](./3.5.1-create-internalmoduleinitializergo.md) -- [3.5.2 - Run Migrations](./3.5.2-run-migrations.md) - -### 3.6 Module Lifecycle -- [3.6.1 - Extend Module Interface](./3.6.1-extend-pkgmodulemodulego.md) -- [3.6.2 - Integrate with FX Lifecycle](./3.6.2-integrate-with-fxlifecycle.md) - -### 3.7 Platform CLI -- [3.7.1 - Create CLI Tool](./3.7.1-create-cmdplatformctlmaingo.md) -- [3.7.2 - Add to Makefile](./3.7.2-add-to-makefile-make-install-cli.md) +### 3.5 Service Registry and Discovery +- [Story: 3.5 - Service Registry](./3.5-service-registry.md) +- **Goal:** Implement a service registry that enables service discovery for microservices. +- **Deliverables:** Service registry interface, Consul registry, Kubernetes registry, service registration ## Deliverables Checklist -- [ ] Module interface defined -- [ ] Static module registry implemented -- [ ] Permission code generation working -- [ ] Module loader supports static and plugin modes -- [ ] Modules can be discovered and initialized -- [ ] Module migrations run on startup -- [ ] Platform CLI tool for module management +- [ ] Module interface and registration system +- [ ] Static module registry working +- [ ] Permission code generation tool +- [ ] Module loader with dependency resolution +- [ ] Module initialization in main app +- [ ] CLI tool for module management +- [ ] Service registry for discovery ## Acceptance Criteria -- Modules can be registered statically -- Permission constants are generated from module manifests -- Modules are initialized with correct dependency order -- Module migrations run automatically -- CLI tool can list and manage modules - +- Modules can register via `registry.Register()` +- Permission constants are generated from `module.yaml` +- Modules load in correct dependency order +- Module migrations run on startup +- `platformctl modules list` shows all modules +- Integration test: load multiple modules and verify initialization diff --git a/docs/content/stories/phase4/4.1-blog-module.md b/docs/content/stories/phase4/4.1-blog-module.md new file mode 100644 index 0000000..91c2563 --- /dev/null +++ b/docs/content/stories/phase4/4.1-blog-module.md @@ -0,0 +1,169 @@ +# Story 4.1: Complete Blog Module + +## Metadata +- **Story ID**: 4.1 +- **Title**: Complete Blog Module +- **Phase**: 4 - Sample Feature Module (Blog) +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 10-12 hours +- **Dependencies**: 3.1, 3.2, 3.3, 2.3 + +## Goal +Create a complete sample blog module to demonstrate the framework, showing how to add routes, permissions, database entities, and services. This serves as a reference implementation for future developers. + +## Description +This story implements a complete blog module with blog posts, CRUD operations, proper authorization, and integration with the core platform. The module demonstrates all aspects of module development including domain models, repositories, services, API handlers, and module registration. + +## Deliverables + +### 1. Blog Module Structure +- Create `modules/blog/` directory with proper structure: + ``` + modules/blog/ + ├── go.mod + ├── module.yaml + ├── internal/ + │ ├── api/ + │ │ └── handler.go + │ ├── domain/ + │ │ ├── post.go + │ │ └── post_repo.go + │ ├── service/ + │ │ └── post_service.go + │ └── ent/ + │ └── schema/ + │ └── post.go + └── pkg/ + └── module.go + ``` +- Initialize `go.mod` for blog module + +### 2. Module Manifest (`modules/blog/module.yaml`) +- Define module metadata (name, version, dependencies) +- Define permissions (blog.post.create, read, update, delete) +- Define routes with permission requirements + +### 3. Blog Domain Model +- `Post` domain entity in `modules/blog/internal/domain/post.go` +- Ent schema in `modules/blog/internal/ent/schema/post.go`: + - Fields: title, content, author_id (FK to user) + - Indexes: author_id, created_at + - Timestamps: created_at, updated_at +- Generate Ent code for blog module + +### 4. Blog Repository +- `PostRepository` interface in `modules/blog/internal/domain/post_repo.go` +- Implementation using Ent client (shared from core) +- CRUD operations: Create, FindByID, FindByAuthor, Update, Delete +- Pagination support + +### 5. Blog Service +- `PostService` in `modules/blog/internal/service/post_service.go` +- Business logic for creating/updating posts +- Validation (title length, content requirements) +- Authorization checks (author can only update own posts) +- Uses service clients for inter-service communication: + - `IdentityServiceClient` - to get user information + - `AuthzServiceClient` - for authorization checks + - `AuditServiceClient` - for audit logging + +### 6. Blog API Handlers +- API handlers in `modules/blog/internal/api/handler.go`: + - `POST /api/v1/blog/posts` - Create post + - `GET /api/v1/blog/posts/:id` - Get post + - `GET /api/v1/blog/posts` - List posts (with pagination) + - `PUT /api/v1/blog/posts/:id` - Update post + - `DELETE /api/v1/blog/posts/:id` - Delete post +- Use authorization middleware for all endpoints +- Register handlers in module's `Init()` + +### 7. Blog Module Implementation +- Module implementation in `modules/blog/pkg/module.go`: + - Implement IModule interface + - Define Init() fx.Option + - Define Migrations() + - Register module in init() + +### 8. Integration +- Update main `go.mod` to include blog module +- Import blog module in `cmd/platform/main.go` +- Run permission generation: `make generate` +- Verify blog permissions are generated + +### 9. Tests +- Integration test in `modules/blog/internal/api/handler_test.go`: + - Test creating post with valid permission + - Test creating post without permission (403) + - Test updating own post vs other's post + - Test pagination +- Unit tests for service and repository + +## Implementation Steps + +1. **Create Module Structure** + - Create directory structure + - Initialize go.mod + +2. **Create Module Manifest** + - Create module.yaml + - Define permissions and routes + +3. **Create Domain Model** + - Create Post entity + - Create Ent schema + - Generate Ent code + +4. **Create Repository** + - Create repository interface + - Implement using Ent + +5. **Create Service** + - Create service with business logic + - Add validation and authorization + +6. **Create API Handlers** + - Create handlers + - Add authorization middleware + - Register routes + +7. **Create Module Implementation** + - Implement IModule interface + - Register module + +8. **Integrate with Platform** + - Import module in main + - Generate permissions + - Test integration + +9. **Add Tests** + - Create integration tests + - Create unit tests + +## Acceptance Criteria +- [ ] Blog module loads on platform startup +- [ ] `POST /api/v1/blog/posts` requires `blog.post.create` permission +- [ ] User can create, read, update, delete posts +- [ ] Authorization enforced (users can only edit own posts) +- [ ] Integration test: full CRUD flow works +- [ ] Audit logs record all blog actions +- [ ] Permissions are generated correctly +- [ ] Module migrations run on startup + +## Related ADRs +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) +- [ADR-0030: Service Communication Strategy](../../adr/0030-service-communication-strategy.md) +- See module framework ADRs + +## Files to Create/Modify +- `modules/blog/module.yaml` - Module manifest +- `modules/blog/go.mod` - Module dependencies +- `modules/blog/internal/domain/post.go` - Domain model +- `modules/blog/internal/ent/schema/post.go` - Ent schema +- `modules/blog/internal/domain/post_repo.go` - Repository +- `modules/blog/internal/service/post_service.go` - Service +- `modules/blog/internal/api/handler.go` - API handlers +- `modules/blog/pkg/module.go` - Module implementation +- `go.mod` - Add blog module +- `cmd/platform/main.go` - Import blog module + diff --git a/docs/content/stories/phase4/4.1.1-create-modulesblog-directory.md b/docs/content/stories/phase4/4.1.1-create-modulesblog-directory.md deleted file mode 100644 index 14985e1..0000000 --- a/docs/content/stories/phase4/4.1.1-create-modulesblog-directory.md +++ /dev/null @@ -1,58 +0,0 @@ -# Task 4.1.1: Create `modules/blog/` directory: - -## Metadata -- **Task ID**: 4.1.1 -- **Title**: Create `modules/blog/` directory: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `modules/blog/` directory: - -## Requirements -- Create `modules/blog/` directory: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.1.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -modules/blog/ - ├── go.mod - ├── module.yaml - ├── internal/ - │ ├── api/ - │ │ └── handler.go - │ ├── domain/ - │ │ ├── post.go - │ │ └── post_repo.go - │ └── service/ - │ └── post_service.go - └── pkg/ - └── module.go -``` diff --git a/docs/content/stories/phase4/4.1.2-initialize-gomod.md b/docs/content/stories/phase4/4.1.2-initialize-gomod.md deleted file mode 100644 index 439f646..0000000 --- a/docs/content/stories/phase4/4.1.2-initialize-gomod.md +++ /dev/null @@ -1,47 +0,0 @@ -# Task 4.1.2: Initialize `go.mod`: - -## Metadata -- **Task ID**: 4.1.2 -- **Title**: Initialize `go.mod`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Initialize `go.mod`: - -## Requirements -- Initialize `go.mod`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.1.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -cd modules/blog - go mod init github.com/yourorg/blog -``` diff --git a/docs/content/stories/phase4/4.2.1-create-modulesblogmoduleyaml.md b/docs/content/stories/phase4/4.2.1-create-modulesblogmoduleyaml.md deleted file mode 100644 index 25b3480..0000000 --- a/docs/content/stories/phase4/4.2.1-create-modulesblogmoduleyaml.md +++ /dev/null @@ -1,70 +0,0 @@ -# Task 4.2.1: Create `modules/blog/module.yaml`: - -## Metadata -- **Task ID**: 4.2.1 -- **Title**: Create `modules/blog/module.yaml`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `modules/blog/module.yaml`: - -## Requirements -- Create `modules/blog/module.yaml`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.2.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -name: blog - version: 0.1.0 - dependencies: - - core >= 1.0.0 - permissions: - - blog.post.create - - blog.post.read - - blog.post.update - - blog.post.delete - routes: - - method: POST - path: /api/v1/blog/posts - permission: blog.post.create - - method: GET - path: /api/v1/blog/posts/:id - permission: blog.post.read - - method: PUT - path: /api/v1/blog/posts/:id - permission: blog.post.update - - method: DELETE - path: /api/v1/blog/posts/:id - permission: blog.post.delete - - method: GET - path: /api/v1/blog/posts - permission: blog.post.read -``` diff --git a/docs/content/stories/phase4/4.3.1-create-modulesbloginternaldomainpostgo.md b/docs/content/stories/phase4/4.3.1-create-modulesbloginternaldomainpostgo.md deleted file mode 100644 index 36f7995..0000000 --- a/docs/content/stories/phase4/4.3.1-create-modulesbloginternaldomainpostgo.md +++ /dev/null @@ -1,53 +0,0 @@ -# Task 4.3.1: Create `modules/blog/internal/domain/post.go`: - -## Metadata -- **Task ID**: 4.3.1 -- **Title**: Create `modules/blog/internal/domain/post.go`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `modules/blog/internal/domain/post.go`: - -## Requirements -- Create `modules/blog/internal/domain/post.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.3.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Post struct { - ID string - Title string - Content string - AuthorID string - CreatedAt time.Time - UpdatedAt time.Time - } -``` diff --git a/docs/content/stories/phase4/4.3.2-create-ent-schema-modulesbloginternalentschemapost.md b/docs/content/stories/phase4/4.3.2-create-ent-schema-modulesbloginternalentschemapost.md deleted file mode 100644 index 8902403..0000000 --- a/docs/content/stories/phase4/4.3.2-create-ent-schema-modulesbloginternalentschemapost.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.3.2: Create Ent schema `modules/blog/internal/ent/schema/post.go`: - -## Metadata -- **Task ID**: 4.3.2 -- **Title**: Create Ent schema `modules/blog/internal/ent/schema/post.go`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create Ent schema `modules/blog/internal/ent/schema/post.go`: - -## Requirements -- Create Ent schema `modules/blog/internal/ent/schema/post.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.3.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/4.3.3-generate-ent-code-for-blog-module.md b/docs/content/stories/phase4/4.3.3-generate-ent-code-for-blog-module.md deleted file mode 100644 index 3c53e95..0000000 --- a/docs/content/stories/phase4/4.3.3-generate-ent-code-for-blog-module.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.3.3: Generate Ent code for blog module - -## Metadata -- **Task ID**: 4.3.3 -- **Title**: Generate Ent code for blog module -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Generate Ent code for blog module - -## Requirements -- Generate Ent code for blog module - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.3.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/4.4.1-create-modulesbloginternaldomainpost_repogo.md b/docs/content/stories/phase4/4.4.1-create-modulesbloginternaldomainpost_repogo.md deleted file mode 100644 index f79c43b..0000000 --- a/docs/content/stories/phase4/4.4.1-create-modulesbloginternaldomainpost_repogo.md +++ /dev/null @@ -1,52 +0,0 @@ -# Task 4.4.1: Create `modules/blog/internal/domain/post_repo.go`: - -## Metadata -- **Task ID**: 4.4.1 -- **Title**: Create `modules/blog/internal/domain/post_repo.go`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `modules/blog/internal/domain/post_repo.go`: - -## Requirements -- Create `modules/blog/internal/domain/post_repo.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.4.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type PostRepository interface { - Create(ctx context.Context, p *Post) (*Post, error) - FindByID(ctx context.Context, id string) (*Post, error) - FindByAuthor(ctx context.Context, authorID string) ([]*Post, error) - Update(ctx context.Context, p *Post) error - Delete(ctx context.Context, id string) error - } -``` diff --git a/docs/content/stories/phase4/4.4.2-implement-using-ent-client-shared-from-core.md b/docs/content/stories/phase4/4.4.2-implement-using-ent-client-shared-from-core.md deleted file mode 100644 index 4f99820..0000000 --- a/docs/content/stories/phase4/4.4.2-implement-using-ent-client-shared-from-core.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.4.2: Implement using Ent client (shared from core) - -## Metadata -- **Task ID**: 4.4.2 -- **Title**: Implement using Ent client (shared from core) -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement using Ent client (shared from core) - -## Requirements -- Implement using Ent client (shared from core) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.4.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/4.5.1-create-modulesbloginternalservicepost_servicego.md b/docs/content/stories/phase4/4.5.1-create-modulesbloginternalservicepost_servicego.md deleted file mode 100644 index 0deb26b..0000000 --- a/docs/content/stories/phase4/4.5.1-create-modulesbloginternalservicepost_servicego.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.5.1: Create `modules/blog/internal/service/post_service.go`: - -## Metadata -- **Task ID**: 4.5.1 -- **Title**: Create `modules/blog/internal/service/post_service.go`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `modules/blog/internal/service/post_service.go`: - -## Requirements -- Create `modules/blog/internal/service/post_service.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.5.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/4.6.1-create-modulesbloginternalapihandlergo.md b/docs/content/stories/phase4/4.6.1-create-modulesbloginternalapihandlergo.md deleted file mode 100644 index f567bc1..0000000 --- a/docs/content/stories/phase4/4.6.1-create-modulesbloginternalapihandlergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.6.1: Create `modules/blog/internal/api/handler.go`: - -## Metadata -- **Task ID**: 4.6.1 -- **Title**: Create `modules/blog/internal/api/handler.go`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `modules/blog/internal/api/handler.go`: - -## Requirements -- Create `modules/blog/internal/api/handler.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.6.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/4.6.2-use-authorization-middleware.md b/docs/content/stories/phase4/4.6.2-use-authorization-middleware.md deleted file mode 100644 index f057583..0000000 --- a/docs/content/stories/phase4/4.6.2-use-authorization-middleware.md +++ /dev/null @@ -1,46 +0,0 @@ -# Task 4.6.2: Use authorization middleware: - -## Metadata -- **Task ID**: 4.6.2 -- **Title**: Use authorization middleware: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Use authorization middleware: - -## Requirements -- Use authorization middleware: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.6.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -grp.Use(auth.RequirePermission(perm.BlogPostCreate)) -``` diff --git a/docs/content/stories/phase4/4.6.3-register-handlers-in-modules-init.md b/docs/content/stories/phase4/4.6.3-register-handlers-in-modules-init.md deleted file mode 100644 index ed12fac..0000000 --- a/docs/content/stories/phase4/4.6.3-register-handlers-in-modules-init.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.6.3: Register handlers in module's `Init()` - -## Metadata -- **Task ID**: 4.6.3 -- **Title**: Register handlers in module's `Init()` -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Register handlers in module's `Init()` - -## Requirements -- Register handlers in module's `Init()` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.6.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/4.7.1-create-modulesblogpkgmodulego.md b/docs/content/stories/phase4/4.7.1-create-modulesblogpkgmodulego.md deleted file mode 100644 index 5b421ff..0000000 --- a/docs/content/stories/phase4/4.7.1-create-modulesblogpkgmodulego.md +++ /dev/null @@ -1,70 +0,0 @@ -# Task 4.7.1: Create `modules/blog/pkg/module.go`: - -## Metadata -- **Task ID**: 4.7.1 -- **Title**: Create `modules/blog/pkg/module.go`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `modules/blog/pkg/module.go`: - -## Requirements -- Create `modules/blog/pkg/module.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.7.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type BlogModule struct{} - - func (b BlogModule) Name() string { return "blog" } - func (b BlogModule) Version() string { return "0.1.0" } - func (b BlogModule) Dependencies() []string { return nil } - func (b BlogModule) Init() fx.Option { - return fx.Options( - fx.Provide(NewPostRepo), - fx.Provide(NewPostService), - fx.Invoke(RegisterHandlers), - ) - } - func (b BlogModule) Migrations() []func(*ent.Client) error { - return []func(*ent.Client) error{ - func(c *ent.Client) error { - return c.Schema.Create(context.Background()) - }, - } - } - - var Module BlogModule - - func init() { - registry.Register(Module) - } -``` diff --git a/docs/content/stories/phase4/4.8.1-update-main-gomod-to-include-blog-module.md b/docs/content/stories/phase4/4.8.1-update-main-gomod-to-include-blog-module.md deleted file mode 100644 index 5e08327..0000000 --- a/docs/content/stories/phase4/4.8.1-update-main-gomod-to-include-blog-module.md +++ /dev/null @@ -1,46 +0,0 @@ -# Task 4.8.1: Update main `go.mod` to include blog module: - -## Metadata -- **Task ID**: 4.8.1 -- **Title**: Update main `go.mod` to include blog module: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Update main `go.mod` to include blog module: - -## Requirements -- Update main `go.mod` to include blog module: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.8.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -replace github.com/yourorg/blog => ./modules/blog -``` diff --git a/docs/content/stories/phase4/4.8.2-import-blog-module-in-cmdplatformmaingo.md b/docs/content/stories/phase4/4.8.2-import-blog-module-in-cmdplatformmaingo.md deleted file mode 100644 index 2b58e6e..0000000 --- a/docs/content/stories/phase4/4.8.2-import-blog-module-in-cmdplatformmaingo.md +++ /dev/null @@ -1,46 +0,0 @@ -# Task 4.8.2: Import blog module in `cmd/platform/main.go`: - -## Metadata -- **Task ID**: 4.8.2 -- **Title**: Import blog module in `cmd/platform/main.go`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Import blog module in `cmd/platform/main.go`: - -## Requirements -- Import blog module in `cmd/platform/main.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.8.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -import _ "github.com/yourorg/blog/pkg" -``` diff --git a/docs/content/stories/phase4/4.8.3-run-permission-generation-make-generate.md b/docs/content/stories/phase4/4.8.3-run-permission-generation-make-generate.md deleted file mode 100644 index 0925438..0000000 --- a/docs/content/stories/phase4/4.8.3-run-permission-generation-make-generate.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.8.3: Run permission generation: `make generate` - -## Metadata -- **Task ID**: 4.8.3 -- **Title**: Run permission generation: `make generate` -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Run permission generation: `make generate` - -## Requirements -- Run permission generation: `make generate` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.8.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/4.8.4-verify-blog-permissions-are-generated.md b/docs/content/stories/phase4/4.8.4-verify-blog-permissions-are-generated.md deleted file mode 100644 index 7c484e4..0000000 --- a/docs/content/stories/phase4/4.8.4-verify-blog-permissions-are-generated.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.8.4: Verify blog permissions are generated - -## Metadata -- **Task ID**: 4.8.4 -- **Title**: Verify blog permissions are generated -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Verify blog permissions are generated - -## Requirements -- Verify blog permissions are generated - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.8.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/4.9.1-create-integration-test-modulesbloginternalapihand.md b/docs/content/stories/phase4/4.9.1-create-integration-test-modulesbloginternalapihand.md deleted file mode 100644 index e138142..0000000 --- a/docs/content/stories/phase4/4.9.1-create-integration-test-modulesbloginternalapihand.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.9.1: Create integration test `modules/blog/internal/api/handler_test.go`: - -## Metadata -- **Task ID**: 4.9.1 -- **Title**: Create integration test `modules/blog/internal/api/handler_test.go`: -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.9 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create integration test `modules/blog/internal/api/handler_test.go`: - -## Requirements -- Create integration test `modules/blog/internal/api/handler_test.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.9.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/4.9.2-add-unit-tests-for-service-and-repository.md b/docs/content/stories/phase4/4.9.2-add-unit-tests-for-service-and-repository.md deleted file mode 100644 index 5a0dd7b..0000000 --- a/docs/content/stories/phase4/4.9.2-add-unit-tests-for-service-and-repository.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 4.9.2: Add unit tests for service and repository - -## Metadata -- **Task ID**: 4.9.2 -- **Title**: Add unit tests for service and repository -- **Phase**: 4 - Sample Feature Module (Blog) -- **Section**: 4.9 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add unit tests for service and repository - -## Requirements -- Add unit tests for service and repository - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 4.9.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase4/README.md b/docs/content/stories/phase4/README.md index 8f49186..900dff8 100644 --- a/docs/content/stories/phase4/README.md +++ b/docs/content/stories/phase4/README.md @@ -1,31 +1,14 @@ # Phase 4: Sample Feature Module (Blog) ## Overview -Create a sample blog module to demonstrate the module framework. This module will implement blog posts with CRUD operations, showing how to build a feature module that integrates with the core platform. +Create a complete sample module (Blog) to demonstrate the framework, showing how to add routes, permissions, database entities, and services. The Blog module is an independent service that uses service clients to communicate with core services. Provide reference implementation for future developers. -## Tasks +## Stories -### 4.1 Module Setup -- [4.1.1 - Create Blog Module Directory](./4.1.1-create-modulesblog-directory.md) -- [4.1.2 - Initialize Go Module](./4.1.2-initialize-gomod.md) - -### 4.2 Module Configuration -- [4.2.1 - Create Module Manifest](./4.2.1-create-modulesblogmoduleyaml.md) - -### 4.3 Domain Layer -- [4.3.1 - Create Post Domain Model](./4.3.1-create-modulesbloginternaldomainpostgo.md) -- [4.3.2 - Create Ent Schema](./4.3.2-create-modulesbloginternalentschemapost.md) -- [4.3.3 - Generate Ent Code](./4.3.3-generate-ent-code-for-blog-module.md) - -### 4.4 Repository Layer -- [4.4.1 - Create Post Repository Interface](./4.4.1-create-modulesbloginternaldomainpost_repogo.md) -- [4.4.2 - Implement Repository](./4.4.2-implement-using-ent-client-shared-from-core.md) - -### 4.5 Service Layer -- [4.5.1 - Create Post Service](./4.5.1-create-modulesbloginternalservicepost_servicego.md) - -### 4.6 API Layer -- [4.6.1 - Create API Handler](./4.6.1-create-modulesbloginternalapihandlergo.md) +### 4.1 Complete Blog Module +- [Story: 4.1 - Blog Module](./4.1-blog-module.md) +- **Goal:** Create a complete sample blog module to demonstrate the framework. +- **Deliverables:** Complete blog module with CRUD operations, permissions, database entities, services, API handlers, and integration tests ## Deliverables Checklist - [ ] Blog module directory structure created @@ -36,6 +19,7 @@ Create a sample blog module to demonstrate the module framework. This module wil - [ ] Service layer implements business logic - [ ] API endpoints for blog posts working - [ ] Module integrated with core platform +- [ ] Integration tests passing ## Acceptance Criteria - Blog module can be registered with core platform @@ -44,4 +28,4 @@ Create a sample blog module to demonstrate the module framework. This module wil - API endpoints require proper authentication - Module migrations run on startup - Blog posts are associated with users - +- Authorization enforced (users can only edit own posts) diff --git a/docs/content/stories/phase5/5.1-cache-system.md b/docs/content/stories/phase5/5.1-cache-system.md new file mode 100644 index 0000000..cc2f4a9 --- /dev/null +++ b/docs/content/stories/phase5/5.1-cache-system.md @@ -0,0 +1,64 @@ +# Story 5.1: Cache System (Redis) + +## Metadata +- **Story ID**: 5.1 +- **Title**: Cache System (Redis) +- **Phase**: 5 - Infrastructure Adapters +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 4-5 hours +- **Dependencies**: 1.1 + +## Goal +Implement a complete Redis-based caching system with a clean interface that can be swapped for other cache implementations. + +## Description +This story implements a Redis cache adapter with a clean interface, allowing modules to cache data efficiently. The cache system supports TTL, key-based operations, and optional cache middleware for HTTP responses. + +## Deliverables + +### 1. Cache Interface (`pkg/infra/cache/cache.go`) +- `Cache` interface with: + - `Get(ctx context.Context, key string) ([]byte, error)` + - `Set(ctx context.Context, key string, value []byte, ttl time.Duration) error` + - `Delete(ctx context.Context, key string) error` + - `Exists(ctx context.Context, key string) (bool, error)` + - `Clear(ctx context.Context) error` + +### 2. Redis Implementation (`internal/infra/cache/redis_cache.go`) +- Redis client setup +- Connection pooling +- All interface methods implemented +- Error handling +- Connection health checks + +### 3. Configuration +- Redis config in `config/default.yaml`: + - Connection URL + - Pool settings + - Default TTL + +### 4. DI Integration +- Provider function for Cache +- Register in DI container + +### 5. Optional Cache Middleware +- HTTP response caching middleware +- Configurable cache keys +- TTL per route + +## Acceptance Criteria +- [ ] Cache interface is defined +- [ ] Redis implementation works correctly +- [ ] Cache operations (get, set, delete) work +- [ ] TTL is respected +- [ ] Cache is injectable via DI +- [ ] Configuration is loaded from config +- [ ] Optional middleware works + +## Files to Create/Modify +- `pkg/infra/cache/cache.go` - Cache interface +- `internal/infra/cache/redis_cache.go` - Redis implementation +- `internal/di/providers.go` - Add cache provider +- `config/default.yaml` - Add Redis config + diff --git a/docs/content/stories/phase5/5.1.1-install-githubcomredisgo-redisv9.md b/docs/content/stories/phase5/5.1.1-install-githubcomredisgo-redisv9.md deleted file mode 100644 index 73da69b..0000000 --- a/docs/content/stories/phase5/5.1.1-install-githubcomredisgo-redisv9.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.1.1: Install `github.com/redis/go-redis/v9` - -## Metadata -- **Task ID**: 5.1.1 -- **Title**: Install `github.com/redis/go-redis/v9` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/redis/go-redis/v9` - -## Requirements -- Install `github.com/redis/go-redis/v9` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.1.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.1.2-create-pkginfracachecachego-interface.md b/docs/content/stories/phase5/5.1.2-create-pkginfracachecachego-interface.md deleted file mode 100644 index 6e8138c..0000000 --- a/docs/content/stories/phase5/5.1.2-create-pkginfracachecachego-interface.md +++ /dev/null @@ -1,50 +0,0 @@ -# Task 5.1.2: Create `pkg/infra/cache/cache.go` interface: - -## Metadata -- **Task ID**: 5.1.2 -- **Title**: Create `pkg/infra/cache/cache.go` interface: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/infra/cache/cache.go` interface: - -## Requirements -- Create `pkg/infra/cache/cache.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.1.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Cache interface { - Get(ctx context.Context, key string) ([]byte, error) - Set(ctx context.Context, key string, value []byte, ttl time.Duration) error - Delete(ctx context.Context, key string) error - } -``` diff --git a/docs/content/stories/phase5/5.1.3-implement-internalinfracacheredis_cachego.md b/docs/content/stories/phase5/5.1.3-implement-internalinfracacheredis_cachego.md deleted file mode 100644 index 8dde842..0000000 --- a/docs/content/stories/phase5/5.1.3-implement-internalinfracacheredis_cachego.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.1.3: Implement `internal/infra/cache/redis_cache.go` - -## Metadata -- **Task ID**: 5.1.3 -- **Title**: Implement `internal/infra/cache/redis_cache.go` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/infra/cache/redis_cache.go` - -## Requirements -- Implement `internal/infra/cache/redis_cache.go` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.1.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.1.4-add-redis-config-to-configdefaultyaml.md b/docs/content/stories/phase5/5.1.4-add-redis-config-to-configdefaultyaml.md deleted file mode 100644 index c6adba1..0000000 --- a/docs/content/stories/phase5/5.1.4-add-redis-config-to-configdefaultyaml.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.1.4: Add Redis config to `config/default.yaml` - -## Metadata -- **Task ID**: 5.1.4 -- **Title**: Add Redis config to `config/default.yaml` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add Redis config to `config/default.yaml` - -## Requirements -- Add Redis config to `config/default.yaml` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.1.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.1.5-register-in-di-container.md b/docs/content/stories/phase5/5.1.5-register-in-di-container.md deleted file mode 100644 index eafc8bb..0000000 --- a/docs/content/stories/phase5/5.1.5-register-in-di-container.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.1.5: Register in DI container - -## Metadata -- **Task ID**: 5.1.5 -- **Title**: Register in DI container -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Register in DI container - -## Requirements -- Register in DI container - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.1.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.1.6-add-cache-middleware-for-selected-routes-optional.md b/docs/content/stories/phase5/5.1.6-add-cache-middleware-for-selected-routes-optional.md deleted file mode 100644 index 0646351..0000000 --- a/docs/content/stories/phase5/5.1.6-add-cache-middleware-for-selected-routes-optional.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.1.6: Add cache middleware for selected routes (optional) - -## Metadata -- **Task ID**: 5.1.6 -- **Title**: Add cache middleware for selected routes (optional) -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add cache middleware for selected routes (optional) - -## Requirements -- Add cache middleware for selected routes (optional) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.1.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.2-event-bus.md b/docs/content/stories/phase5/5.2-event-bus.md new file mode 100644 index 0000000..8bbfe96 --- /dev/null +++ b/docs/content/stories/phase5/5.2-event-bus.md @@ -0,0 +1,69 @@ +# Story 5.2: Event Bus System + +## Metadata +- **Story ID**: 5.2 +- **Title**: Event Bus System +- **Phase**: 5 - Infrastructure Adapters +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 6-8 hours +- **Dependencies**: 1.1 + +## Goal +Implement a complete event bus system supporting both in-process (for development/testing) and Kafka (for production) with publish/subscribe capabilities. + +## Description +This story implements an event bus that allows modules to publish and subscribe to events. It supports both in-process channels for development and Kafka for production, with a clean interface that makes the implementation swappable. + +## Deliverables + +### 1. Event Bus Interface (`pkg/eventbus/eventbus.go`) +- `EventBus` interface with: + - `Publish(ctx context.Context, topic string, event Event) error` + - `Subscribe(topic string, handler EventHandler) error` + - `Unsubscribe(topic string) error` +- `Event` and `EventHandler` types + +### 2. In-Process Bus (`internal/infra/bus/inprocess_bus.go`) +- Channel-based in-process bus +- Used for testing and development +- Thread-safe implementation + +### 3. Kafka Bus (`internal/infra/bus/kafka_bus.go`) +- Kafka producer for publishing +- Consumer groups for subscribing +- Error handling and retries +- Connection management + +### 4. Core Events +- Define core platform events: + - `platform.user.created` + - `platform.user.updated` + - `platform.role.assigned` + - `platform.permission.granted` + +### 5. Configuration +- Kafka config in `config/default.yaml` +- Bus selection (in-process vs Kafka) + +### 6. DI Integration +- Provider function for EventBus +- Register in DI container +- Switchable via config + +## Acceptance Criteria +- [ ] Event bus interface is defined +- [ ] In-process bus works for development +- [ ] Kafka bus works for production +- [ ] Events can be published and subscribed +- [ ] Bus is swappable via config +- [ ] Error handling works correctly +- [ ] Core events are defined + +## Files to Create/Modify +- `pkg/eventbus/eventbus.go` - Event bus interface +- `internal/infra/bus/inprocess_bus.go` - In-process implementation +- `internal/infra/bus/kafka_bus.go` - Kafka implementation +- `internal/di/providers.go` - Add event bus provider +- `config/default.yaml` - Add Kafka config + diff --git a/docs/content/stories/phase5/5.2.1-create-pkgeventbuseventbusgo-interface.md b/docs/content/stories/phase5/5.2.1-create-pkgeventbuseventbusgo-interface.md deleted file mode 100644 index d6785c6..0000000 --- a/docs/content/stories/phase5/5.2.1-create-pkgeventbuseventbusgo-interface.md +++ /dev/null @@ -1,49 +0,0 @@ -# Task 5.2.1: Create `pkg/eventbus/eventbus.go` interface: - -## Metadata -- **Task ID**: 5.2.1 -- **Title**: Create `pkg/eventbus/eventbus.go` interface: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/eventbus/eventbus.go` interface: - -## Requirements -- Create `pkg/eventbus/eventbus.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.2.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type EventBus interface { - Publish(ctx context.Context, topic string, event Event) error - Subscribe(topic string, handler EventHandler) error - } -``` diff --git a/docs/content/stories/phase5/5.2.2-implement-internalinfrabusinprocess_busgo.md b/docs/content/stories/phase5/5.2.2-implement-internalinfrabusinprocess_busgo.md deleted file mode 100644 index a6f2c79..0000000 --- a/docs/content/stories/phase5/5.2.2-implement-internalinfrabusinprocess_busgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.2.2: Implement `internal/infra/bus/inprocess_bus.go`: - -## Metadata -- **Task ID**: 5.2.2 -- **Title**: Implement `internal/infra/bus/inprocess_bus.go`: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/infra/bus/inprocess_bus.go`: - -## Requirements -- Implement `internal/infra/bus/inprocess_bus.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.2.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.2.3-implement-internalinfrabuskafka_busgo.md b/docs/content/stories/phase5/5.2.3-implement-internalinfrabuskafka_busgo.md deleted file mode 100644 index 225e244..0000000 --- a/docs/content/stories/phase5/5.2.3-implement-internalinfrabuskafka_busgo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.2.3: Implement `internal/infra/bus/kafka_bus.go`: - -## Metadata -- **Task ID**: 5.2.3 -- **Title**: Implement `internal/infra/bus/kafka_bus.go`: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/infra/bus/kafka_bus.go`: - -## Requirements -- Implement `internal/infra/bus/kafka_bus.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.2.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.2.4-add-kafka-config-to-configdefaultyaml.md b/docs/content/stories/phase5/5.2.4-add-kafka-config-to-configdefaultyaml.md deleted file mode 100644 index fc5ed10..0000000 --- a/docs/content/stories/phase5/5.2.4-add-kafka-config-to-configdefaultyaml.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.2.4: Add Kafka config to `config/default.yaml` - -## Metadata -- **Task ID**: 5.2.4 -- **Title**: Add Kafka config to `config/default.yaml` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add Kafka config to `config/default.yaml` - -## Requirements -- Add Kafka config to `config/default.yaml` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.2.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.2.5-register-bus-in-di-container-switchable-via-config.md b/docs/content/stories/phase5/5.2.5-register-bus-in-di-container-switchable-via-config.md deleted file mode 100644 index 7c57ea5..0000000 --- a/docs/content/stories/phase5/5.2.5-register-bus-in-di-container-switchable-via-config.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.2.5: Register bus in DI container (switchable via config) - -## Metadata -- **Task ID**: 5.2.5 -- **Title**: Register bus in DI container (switchable via config) -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Register bus in DI container (switchable via config) - -## Requirements -- Register bus in DI container (switchable via config) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.2.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.2.6-add-core-events.md b/docs/content/stories/phase5/5.2.6-add-core-events.md deleted file mode 100644 index 7a3998a..0000000 --- a/docs/content/stories/phase5/5.2.6-add-core-events.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.2.6: Add core events: - -## Metadata -- **Task ID**: 5.2.6 -- **Title**: Add core events: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add core events: - -## Requirements -- Add core events: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.2.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.3-blob-storage.md b/docs/content/stories/phase5/5.3-blob-storage.md new file mode 100644 index 0000000..c1d8b77 --- /dev/null +++ b/docs/content/stories/phase5/5.3-blob-storage.md @@ -0,0 +1,65 @@ +# Story 5.3: Blob Storage System + +## Metadata +- **Story ID**: 5.3 +- **Title**: Blob Storage System +- **Phase**: 5 - Infrastructure Adapters +- **Status**: Pending +- **Priority**: Medium +- **Estimated Time**: 5-6 hours +- **Dependencies**: 1.1, 1.5 + +## Goal +Implement a complete blob storage system using S3 with a clean interface for file upload, download, and management. + +## Description +This story implements S3-based blob storage with support for file uploads, downloads, signed URLs, and file deletion. It includes an API endpoint for file uploads. + +## Deliverables + +### 1. Blob Storage Interface (`pkg/infra/blob/blob.go`) +- `BlobStore` interface with: + - `Upload(ctx context.Context, key string, data []byte) error` + - `Download(ctx context.Context, key string) ([]byte, error)` + - `Delete(ctx context.Context, key string) error` + - `GetSignedURL(ctx context.Context, key string, ttl time.Duration) (string, error)` + - `Exists(ctx context.Context, key string) (bool, error)` + +### 2. S3 Implementation (`internal/infra/blob/s3_store.go`) +- AWS S3 client setup +- All interface methods implemented +- Error handling +- Content type detection + +### 3. File Upload API +- `POST /api/v1/files/upload` - Upload file +- File validation +- Size limits +- Content type validation + +### 4. Configuration +- S3 config in `config/default.yaml`: + - Bucket name + - Region + - Credentials (or use IAM role) + +### 5. DI Integration +- Provider function for BlobStore +- Register in DI container + +## Acceptance Criteria +- [ ] Blob storage interface is defined +- [ ] S3 implementation works correctly +- [ ] Files can be uploaded and downloaded +- [ ] Signed URLs are generated correctly +- [ ] File upload API works +- [ ] Configuration is loaded from config +- [ ] Blob store is injectable via DI + +## Files to Create/Modify +- `pkg/infra/blob/blob.go` - Blob storage interface +- `internal/infra/blob/s3_store.go` - S3 implementation +- `internal/infra/blob/handler.go` - File upload handler +- `internal/di/providers.go` - Add blob store provider +- `config/default.yaml` - Add S3 config + diff --git a/docs/content/stories/phase5/5.3.1-install-githubcomawsaws-sdk-go-v2services3.md b/docs/content/stories/phase5/5.3.1-install-githubcomawsaws-sdk-go-v2services3.md deleted file mode 100644 index 7964dbd..0000000 --- a/docs/content/stories/phase5/5.3.1-install-githubcomawsaws-sdk-go-v2services3.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.3.1: Install `github.com/aws/aws-sdk-go-v2/service/s3` - -## Metadata -- **Task ID**: 5.3.1 -- **Title**: Install `github.com/aws/aws-sdk-go-v2/service/s3` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/aws/aws-sdk-go-v2/service/s3` - -## Requirements -- Install `github.com/aws/aws-sdk-go-v2/service/s3` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.3.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.3.2-create-pkginfrablobblobgo-interface.md b/docs/content/stories/phase5/5.3.2-create-pkginfrablobblobgo-interface.md deleted file mode 100644 index 76f698b..0000000 --- a/docs/content/stories/phase5/5.3.2-create-pkginfrablobblobgo-interface.md +++ /dev/null @@ -1,51 +0,0 @@ -# Task 5.3.2: Create `pkg/infra/blob/blob.go` interface: - -## Metadata -- **Task ID**: 5.3.2 -- **Title**: Create `pkg/infra/blob/blob.go` interface: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/infra/blob/blob.go` interface: - -## Requirements -- Create `pkg/infra/blob/blob.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.3.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type BlobStore interface { - Upload(ctx context.Context, key string, data []byte) error - Download(ctx context.Context, key string) ([]byte, error) - Delete(ctx context.Context, key string) error - GetSignedURL(ctx context.Context, key string, ttl time.Duration) (string, error) - } -``` diff --git a/docs/content/stories/phase5/5.3.3-implement-internalinfrablobs3_storego.md b/docs/content/stories/phase5/5.3.3-implement-internalinfrablobs3_storego.md deleted file mode 100644 index 6a4de9b..0000000 --- a/docs/content/stories/phase5/5.3.3-implement-internalinfrablobs3_storego.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.3.3: Implement `internal/infra/blob/s3_store.go` - -## Metadata -- **Task ID**: 5.3.3 -- **Title**: Implement `internal/infra/blob/s3_store.go` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/infra/blob/s3_store.go` - -## Requirements -- Implement `internal/infra/blob/s3_store.go` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.3.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.3.4-add-s3-config-to-configdefaultyaml.md b/docs/content/stories/phase5/5.3.4-add-s3-config-to-configdefaultyaml.md deleted file mode 100644 index 201971c..0000000 --- a/docs/content/stories/phase5/5.3.4-add-s3-config-to-configdefaultyaml.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.3.4: Add S3 config to `config/default.yaml` - -## Metadata -- **Task ID**: 5.3.4 -- **Title**: Add S3 config to `config/default.yaml` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add S3 config to `config/default.yaml` - -## Requirements -- Add S3 config to `config/default.yaml` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.3.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.3.5-register-in-di-container.md b/docs/content/stories/phase5/5.3.5-register-in-di-container.md deleted file mode 100644 index 4d43d9d..0000000 --- a/docs/content/stories/phase5/5.3.5-register-in-di-container.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.3.5: Register in DI container - -## Metadata -- **Task ID**: 5.3.5 -- **Title**: Register in DI container -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Register in DI container - -## Requirements -- Register in DI container - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.3.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.3.6-add-file-upload-endpoint-post-apiv1filesupload.md b/docs/content/stories/phase5/5.3.6-add-file-upload-endpoint-post-apiv1filesupload.md deleted file mode 100644 index 8c2be0f..0000000 --- a/docs/content/stories/phase5/5.3.6-add-file-upload-endpoint-post-apiv1filesupload.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.3.6: Add file upload endpoint: `POST /api/v1/files/upload` - -## Metadata -- **Task ID**: 5.3.6 -- **Title**: Add file upload endpoint: `POST /api/v1/files/upload` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add file upload endpoint: `POST /api/v1/files/upload` - -## Requirements -- Add file upload endpoint: `POST /api/v1/files/upload` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.3.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.4-email-notification.md b/docs/content/stories/phase5/5.4-email-notification.md new file mode 100644 index 0000000..4030913 --- /dev/null +++ b/docs/content/stories/phase5/5.4-email-notification.md @@ -0,0 +1,67 @@ +# Story 5.4: Email Notification System + +## Metadata +- **Story ID**: 5.4 +- **Title**: Email Notification System +- **Phase**: 5 - Infrastructure Adapters +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 5-6 hours +- **Dependencies**: 1.1, 2.2 + +## Goal +Implement a complete email notification system with SMTP support, HTML email templates, and integration with identity management. + +## Description +This story implements email notifications using SMTP with support for HTML emails and templates. It integrates with the identity service to send verification and password reset emails. + +## Deliverables + +### 1. Notification Interface (`pkg/notification/notification.go`) +- `Notifier` interface with: + - `SendEmail(ctx context.Context, to, subject, body string) error` + - `SendHTMLEmail(ctx context.Context, to, subject, htmlBody, textBody string) error` + - `SendSMS(ctx context.Context, to, message string) error` (placeholder) + +### 2. SMTP Implementation (`internal/infra/email/smtp_notifier.go`) +- SMTP client setup +- HTML email support +- Email templates for: + - Email verification + - Password reset + - Welcome email + +### 3. Integration with Identity Service +- Send verification email on registration +- Send password reset email +- Send welcome email + +### 4. Configuration +- Email config in `config/default.yaml`: + - SMTP server + - Port + - Username/password + - From address + +### 5. DI Integration +- Provider function for Notifier +- Register in DI container + +## Acceptance Criteria +- [ ] Notification interface is defined +- [ ] SMTP implementation works correctly +- [ ] HTML emails are sent successfully +- [ ] Email templates work +- [ ] Verification emails are sent on registration +- [ ] Password reset emails are sent +- [ ] Configuration is loaded from config +- [ ] Notifier is injectable via DI + +## Files to Create/Modify +- `pkg/notification/notification.go` - Notification interface +- `internal/infra/email/smtp_notifier.go` - SMTP implementation +- `internal/infra/email/templates.go` - Email templates +- `internal/identity/user_service.go` - Integrate email sending +- `internal/di/providers.go` - Add notifier provider +- `config/default.yaml` - Add email config + diff --git a/docs/content/stories/phase5/5.4.1-install-githubcomgo-mailmail.md b/docs/content/stories/phase5/5.4.1-install-githubcomgo-mailmail.md deleted file mode 100644 index c357e19..0000000 --- a/docs/content/stories/phase5/5.4.1-install-githubcomgo-mailmail.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.4.1: Install `github.com/go-mail/mail` - -## Metadata -- **Task ID**: 5.4.1 -- **Title**: Install `github.com/go-mail/mail` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/go-mail/mail` - -## Requirements -- Install `github.com/go-mail/mail` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.4.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.4.2-create-pkgnotificationnotificationgo-interface.md b/docs/content/stories/phase5/5.4.2-create-pkgnotificationnotificationgo-interface.md deleted file mode 100644 index 98014dc..0000000 --- a/docs/content/stories/phase5/5.4.2-create-pkgnotificationnotificationgo-interface.md +++ /dev/null @@ -1,49 +0,0 @@ -# Task 5.4.2: Create `pkg/notification/notification.go` interface: - -## Metadata -- **Task ID**: 5.4.2 -- **Title**: Create `pkg/notification/notification.go` interface: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/notification/notification.go` interface: - -## Requirements -- Create `pkg/notification/notification.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.4.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Notifier interface { - SendEmail(ctx context.Context, to, subject, body string) error - SendSMS(ctx context.Context, to, message string) error - } -``` diff --git a/docs/content/stories/phase5/5.4.3-implement-internalinfraemailsmtp_notifiergo.md b/docs/content/stories/phase5/5.4.3-implement-internalinfraemailsmtp_notifiergo.md deleted file mode 100644 index 6aaed34..0000000 --- a/docs/content/stories/phase5/5.4.3-implement-internalinfraemailsmtp_notifiergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.4.3: Implement `internal/infra/email/smtp_notifier.go`: - -## Metadata -- **Task ID**: 5.4.3 -- **Title**: Implement `internal/infra/email/smtp_notifier.go`: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/infra/email/smtp_notifier.go`: - -## Requirements -- Implement `internal/infra/email/smtp_notifier.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.4.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.4.4-add-email-config-to-configdefaultyaml.md b/docs/content/stories/phase5/5.4.4-add-email-config-to-configdefaultyaml.md deleted file mode 100644 index bf785fb..0000000 --- a/docs/content/stories/phase5/5.4.4-add-email-config-to-configdefaultyaml.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.4.4: Add email config to `config/default.yaml` - -## Metadata -- **Task ID**: 5.4.4 -- **Title**: Add email config to `config/default.yaml` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add email config to `config/default.yaml` - -## Requirements -- Add email config to `config/default.yaml` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.4.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.4.5-integrate-with-identity-service.md b/docs/content/stories/phase5/5.4.5-integrate-with-identity-service.md deleted file mode 100644 index f120b6e..0000000 --- a/docs/content/stories/phase5/5.4.5-integrate-with-identity-service.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.4.5: Integrate with identity service: - -## Metadata -- **Task ID**: 5.4.5 -- **Title**: Integrate with identity service: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Integrate with identity service: - -## Requirements -- Integrate with identity service: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.4.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.4.6-register-in-di-container.md b/docs/content/stories/phase5/5.4.6-register-in-di-container.md deleted file mode 100644 index 37a96fd..0000000 --- a/docs/content/stories/phase5/5.4.6-register-in-di-container.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.4.6: Register in DI container - -## Metadata -- **Task ID**: 5.4.6 -- **Title**: Register in DI container -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Register in DI container - -## Requirements -- Register in DI container - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.4.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.5-scheduler-jobs.md b/docs/content/stories/phase5/5.5-scheduler-jobs.md new file mode 100644 index 0000000..a7e1272 --- /dev/null +++ b/docs/content/stories/phase5/5.5-scheduler-jobs.md @@ -0,0 +1,74 @@ +# Story 5.5: Scheduler and Background Jobs System + +## Metadata +- **Story ID**: 5.5 +- **Title**: Scheduler and Background Jobs System +- **Phase**: 5 - Infrastructure Adapters +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 6-8 hours +- **Dependencies**: 1.1, 5.1 + +## Goal +Implement a complete scheduler and background job system with cron jobs, job queues, retries, and job status tracking. + +## Description +This story implements a scheduler system using Asynq (Redis-backed) that supports cron jobs for periodic tasks and job queues for background processing. Jobs can be registered from modules and tracked. + +## Deliverables + +### 1. Scheduler Interface (`pkg/scheduler/scheduler.go`) +- `Scheduler` interface with: + - `Cron(spec string, job JobFunc) error` - Schedule cron job + - `Enqueue(queue string, payload any) error` - Enqueue job + - `RegisterJob(name string, handler JobHandler) error` - Register job handler + +### 2. Asynq Implementation (`internal/infra/scheduler/asynq_scheduler.go`) +- Redis-backed job queue +- Cron jobs for periodic tasks +- Job retries and backoff +- Job status tracking +- Job result storage + +### 3. Job Registry (`internal/infra/scheduler/job_registry.go`) +- Register jobs from modules +- Start job processor on app startup +- Job lifecycle management + +### 4. Example Jobs +- Cleanup expired tokens (daily) +- Send digest emails (weekly) +- Database cleanup tasks + +### 5. Job Monitoring API +- `GET /api/v1/jobs/status` - Job status endpoint +- Job history and statistics + +### 6. Configuration +- Scheduler config in `config/default.yaml`: + - Redis connection (shared with cache) + - Concurrency settings + - Retry settings + +### 7. DI Integration +- Provider function for Scheduler +- Register in DI container + +## Acceptance Criteria +- [ ] Scheduler interface is defined +- [ ] Cron jobs can be scheduled +- [ ] Jobs can be enqueued +- [ ] Jobs are processed correctly +- [ ] Job retries work +- [ ] Job status is tracked +- [ ] Example jobs run on schedule +- [ ] Job monitoring API works + +## Files to Create/Modify +- `pkg/scheduler/scheduler.go` - Scheduler interface +- `internal/infra/scheduler/asynq_scheduler.go` - Asynq implementation +- `internal/infra/scheduler/job_registry.go` - Job registry +- `internal/infra/scheduler/jobs.go` - Example jobs +- `internal/di/providers.go` - Add scheduler provider +- `config/default.yaml` - Add scheduler config + diff --git a/docs/content/stories/phase5/5.5.1-install-githubcomrobfigcronv3-and-githubcomhibiken.md b/docs/content/stories/phase5/5.5.1-install-githubcomrobfigcronv3-and-githubcomhibiken.md deleted file mode 100644 index a9aa2d1..0000000 --- a/docs/content/stories/phase5/5.5.1-install-githubcomrobfigcronv3-and-githubcomhibiken.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.5.1: Install `github.com/robfig/cron/v3` and `github.com/hibiken/asynq` - -## Metadata -- **Task ID**: 5.5.1 -- **Title**: Install `github.com/robfig/cron/v3` and `github.com/hibiken/asynq` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/robfig/cron/v3` and `github.com/hibiken/asynq` - -## Requirements -- Install `github.com/robfig/cron/v3` and `github.com/hibiken/asynq` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.5.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.5.2-create-pkgschedulerschedulergo-interface.md b/docs/content/stories/phase5/5.5.2-create-pkgschedulerschedulergo-interface.md deleted file mode 100644 index f761705..0000000 --- a/docs/content/stories/phase5/5.5.2-create-pkgschedulerschedulergo-interface.md +++ /dev/null @@ -1,49 +0,0 @@ -# Task 5.5.2: Create `pkg/scheduler/scheduler.go` interface: - -## Metadata -- **Task ID**: 5.5.2 -- **Title**: Create `pkg/scheduler/scheduler.go` interface: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/scheduler/scheduler.go` interface: - -## Requirements -- Create `pkg/scheduler/scheduler.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.5.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type Scheduler interface { - Cron(spec string, job JobFunc) error - Enqueue(queue string, payload any) error - } -``` diff --git a/docs/content/stories/phase5/5.5.3-implement-internalinfraschedulerasynq_schedulergo.md b/docs/content/stories/phase5/5.5.3-implement-internalinfraschedulerasynq_schedulergo.md deleted file mode 100644 index 2b0a44a..0000000 --- a/docs/content/stories/phase5/5.5.3-implement-internalinfraschedulerasynq_schedulergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.5.3: Implement `internal/infra/scheduler/asynq_scheduler.go`: - -## Metadata -- **Task ID**: 5.5.3 -- **Title**: Implement `internal/infra/scheduler/asynq_scheduler.go`: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/infra/scheduler/asynq_scheduler.go`: - -## Requirements -- Implement `internal/infra/scheduler/asynq_scheduler.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.5.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.5.4-create-internalinfraschedulerjob_registrygo.md b/docs/content/stories/phase5/5.5.4-create-internalinfraschedulerjob_registrygo.md deleted file mode 100644 index 26e94ae..0000000 --- a/docs/content/stories/phase5/5.5.4-create-internalinfraschedulerjob_registrygo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.5.4: Create `internal/infra/scheduler/job_registry.go`: - -## Metadata -- **Task ID**: 5.5.4 -- **Title**: Create `internal/infra/scheduler/job_registry.go`: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `internal/infra/scheduler/job_registry.go`: - -## Requirements -- Create `internal/infra/scheduler/job_registry.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.5.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.5.5-add-example-jobs.md b/docs/content/stories/phase5/5.5.5-add-example-jobs.md deleted file mode 100644 index 694a346..0000000 --- a/docs/content/stories/phase5/5.5.5-add-example-jobs.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.5.5: Add example jobs: - -## Metadata -- **Task ID**: 5.5.5 -- **Title**: Add example jobs: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add example jobs: - -## Requirements -- Add example jobs: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.5.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.5.6-add-job-monitoring-endpoint-get-apiv1jobsstatus.md b/docs/content/stories/phase5/5.5.6-add-job-monitoring-endpoint-get-apiv1jobsstatus.md deleted file mode 100644 index 7e73da2..0000000 --- a/docs/content/stories/phase5/5.5.6-add-job-monitoring-endpoint-get-apiv1jobsstatus.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.5.6: Add job monitoring endpoint: `GET /api/v1/jobs/status` - -## Metadata -- **Task ID**: 5.5.6 -- **Title**: Add job monitoring endpoint: `GET /api/v1/jobs/status` -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add job monitoring endpoint: `GET /api/v1/jobs/status` - -## Requirements -- Add job monitoring endpoint: `GET /api/v1/jobs/status` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.5.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.6-secret-store.md b/docs/content/stories/phase5/5.6-secret-store.md new file mode 100644 index 0000000..642f54d --- /dev/null +++ b/docs/content/stories/phase5/5.6-secret-store.md @@ -0,0 +1,68 @@ +# Story 5.6: Secret Store Integration + +## Metadata +- **Story ID**: 5.6 +- **Title**: Secret Store Integration +- **Phase**: 5 - Infrastructure Adapters +- **Status**: Pending +- **Priority**: Medium +- **Estimated Time**: 4-5 hours +- **Dependencies**: 0.2 + +## Goal +Implement secret store integration supporting HashiCorp Vault and AWS Secrets Manager for secure secret management. + +## Description +This story implements secret store adapters that can retrieve secrets from external secret management systems, with integration into the configuration system. + +## Deliverables + +### 1. Secret Store Interface (`pkg/infra/secret/secret.go`) +- `SecretStore` interface with: + - `GetSecret(ctx context.Context, key string) (string, error)` + - `GetSecrets(ctx context.Context, prefix string) (map[string]string, error)` + +### 2. Vault Implementation (`internal/infra/secret/vault_store.go`) +- HashiCorp Vault client +- Support KV v2 secrets +- Authentication (token, app role) +- Secret caching + +### 3. AWS Secrets Manager (`internal/infra/secret/aws_secrets.go`) +- AWS Secrets Manager client +- Secret retrieval +- Secret caching + +### 4. Configuration Integration +- Integrate with config loader +- Overlay secrets on top of file/env config +- Load secrets lazily (cache) +- Secret key resolution + +### 5. Configuration +- Secret store config in `config/default.yaml`: + - Provider (vault, aws, none) + - Connection settings + - Cache settings + +### 6. DI Integration +- Provider function for SecretStore +- Register in DI container (optional, via config) + +## Acceptance Criteria +- [ ] Secret store interface is defined +- [ ] Vault implementation works +- [ ] AWS Secrets Manager implementation works +- [ ] Secrets are loaded into config +- [ ] Secret caching works +- [ ] Configuration integration works +- [ ] Secret store is optional (can be disabled) + +## Files to Create/Modify +- `pkg/infra/secret/secret.go` - Secret store interface +- `internal/infra/secret/vault_store.go` - Vault implementation +- `internal/infra/secret/aws_secrets.go` - AWS implementation +- `internal/config/loader.go` - Integrate secret loading +- `internal/di/providers.go` - Add secret store provider +- `config/default.yaml` - Add secret store config + diff --git a/docs/content/stories/phase5/5.6.1-create-pkginfrasecretsecretgo-interface.md b/docs/content/stories/phase5/5.6.1-create-pkginfrasecretsecretgo-interface.md deleted file mode 100644 index 079a9d3..0000000 --- a/docs/content/stories/phase5/5.6.1-create-pkginfrasecretsecretgo-interface.md +++ /dev/null @@ -1,48 +0,0 @@ -# Task 5.6.1: Create `pkg/infra/secret/secret.go` interface: - -## Metadata -- **Task ID**: 5.6.1 -- **Title**: Create `pkg/infra/secret/secret.go` interface: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/infra/secret/secret.go` interface: - -## Requirements -- Create `pkg/infra/secret/secret.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.6.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type SecretStore interface { - GetSecret(ctx context.Context, key string) (string, error) - } -``` diff --git a/docs/content/stories/phase5/5.6.2-implement-internalinfrasecretvault_storego-hashico.md b/docs/content/stories/phase5/5.6.2-implement-internalinfrasecretvault_storego-hashico.md deleted file mode 100644 index c451a51..0000000 --- a/docs/content/stories/phase5/5.6.2-implement-internalinfrasecretvault_storego-hashico.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.6.2: Implement `internal/infra/secret/vault_store.go` (HashiCorp Vault): - -## Metadata -- **Task ID**: 5.6.2 -- **Title**: Implement `internal/infra/secret/vault_store.go` (HashiCorp Vault): -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/infra/secret/vault_store.go` (HashiCorp Vault): - -## Requirements -- Implement `internal/infra/secret/vault_store.go` (HashiCorp Vault): - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.6.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.6.3-implement-internalinfrasecretaws_secretsgo-aws-sec.md b/docs/content/stories/phase5/5.6.3-implement-internalinfrasecretaws_secretsgo-aws-sec.md deleted file mode 100644 index f631d1c..0000000 --- a/docs/content/stories/phase5/5.6.3-implement-internalinfrasecretaws_secretsgo-aws-sec.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.6.3: Implement `internal/infra/secret/aws_secrets.go` (AWS Secrets Manager): - -## Metadata -- **Task ID**: 5.6.3 -- **Title**: Implement `internal/infra/secret/aws_secrets.go` (AWS Secrets Manager): -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/infra/secret/aws_secrets.go` (AWS Secrets Manager): - -## Requirements -- Implement `internal/infra/secret/aws_secrets.go` (AWS Secrets Manager): - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.6.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.6.4-integrate-with-config-loader.md b/docs/content/stories/phase5/5.6.4-integrate-with-config-loader.md deleted file mode 100644 index e5b09a6..0000000 --- a/docs/content/stories/phase5/5.6.4-integrate-with-config-loader.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.6.4: Integrate with config loader: - -## Metadata -- **Task ID**: 5.6.4 -- **Title**: Integrate with config loader: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Integrate with config loader: - -## Requirements -- Integrate with config loader: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.6.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.6.5-register-in-di-container-optional-via-config.md b/docs/content/stories/phase5/5.6.5-register-in-di-container-optional-via-config.md deleted file mode 100644 index 85ed67d..0000000 --- a/docs/content/stories/phase5/5.6.5-register-in-di-container-optional-via-config.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.6.5: Register in DI container (optional, via config) - -## Metadata -- **Task ID**: 5.6.5 -- **Title**: Register in DI container (optional, via config) -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Register in DI container (optional, via config) - -## Requirements -- Register in DI container (optional, via config) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.6.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.7-grpc-services.md b/docs/content/stories/phase5/5.7-grpc-services.md new file mode 100644 index 0000000..47a128b --- /dev/null +++ b/docs/content/stories/phase5/5.7-grpc-services.md @@ -0,0 +1,150 @@ +# Story 5.7: gRPC Service Definitions and Clients + +## Metadata +- **Story ID**: 5.7 +- **Title**: gRPC Service Definitions and Clients +- **Phase**: 5 - Infrastructure Adapters +- **Status**: Pending +- **Priority**: Medium +- **Estimated Time**: 8-10 hours +- **Dependencies**: 1.7, 3.5 + +## Goal +Implement gRPC service definitions and clients to enable microservices communication, allowing modules to be extracted as independent services. + +## Description +This story implements gRPC service definitions for core services and gRPC clients that implement the service client interfaces. This enables modules to communicate with services over the network when deployed as microservices. + +## Deliverables + +### 1. gRPC Service Definitions (`api/proto/`) +- Define Protocol Buffer files for core services: + - `identity.proto` - Identity service + - `auth.proto` - Authentication service + - `authz.proto` - Authorization service + - `permission.proto` - Permission service + - `audit.proto` - Audit service +- Use protobuf v3 +- Include proper message definitions +- Include service definitions + +### 2. gRPC Server Implementations (`internal/services/grpc/server/`) +- Implement gRPC servers for each service: + - `identity_server.go` - Identity gRPC server + - `auth_server.go` - Auth gRPC server + - `authz_server.go` - Authz gRPC server +- Server implementations wrap existing services +- Error handling and validation +- Request/response conversion + +### 3. gRPC Client Implementations (`internal/services/grpc/client/`) +- Implement gRPC clients that satisfy service client interfaces: + - `grpc_identity_client.go` - Identity gRPC client + - `grpc_auth_client.go` - Auth gRPC client + - `grpc_authz_client.go` - Authz gRPC client +- Connection pooling +- Retry logic +- Circuit breaker support +- Timeout handling + +### 4. gRPC Server Setup +- gRPC server initialization +- Service registration +- Health check service +- Reflection service (development) +- Integration with HTTP server (gRPC-Gateway optional) + +### 5. Code Generation +- `Makefile` target for protobuf generation +- Generate Go code from `.proto` files +- Generate gRPC server and client stubs + +### 6. Configuration +- gRPC configuration in `config/default.yaml`: + ```yaml + grpc: + enabled: false # Enable gRPC server + port: 9090 + reflection: true # Enable reflection (dev) + ``` + +### 7. Integration +- Integrate with service factory +- Support switching between local and gRPC clients +- Service registry integration for gRPC services + +## Implementation Steps + +1. **Install Dependencies** + ```bash + go get google.golang.org/grpc + go get google.golang.org/protobuf + go install google.golang.org/protobuf/cmd/protoc-gen-go + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc + ``` + +2. **Define Protocol Buffers** + - Create `api/proto/` directory + - Define `.proto` files for each service + - Define messages and services + +3. **Generate gRPC Code** + - Create `Makefile` target + - Generate Go code from protobuf + +4. **Implement gRPC Servers** + - Create server implementations + - Wrap existing services + - Handle errors and validation + +5. **Implement gRPC Clients** + - Create client implementations + - Implement service client interfaces + - Add connection management + +6. **Integrate with Service Factory** + - Update factory to support gRPC clients + - Add gRPC server startup + +## Acceptance Criteria +- [ ] gRPC service definitions are created +- [ ] gRPC servers are implemented +- [ ] gRPC clients implement service interfaces +- [ ] Service factory can create gRPC clients +- [ ] gRPC services can be enabled via configuration +- [ ] Code generation works +- [ ] gRPC clients work with service registry + +## Related ADRs +- [ADR-0029: Microservices Architecture](../../adr/0029-microservices-architecture.md) +- [ADR-0030: Service Communication Strategy](../../adr/0030-service-communication-strategy.md) + +## Implementation Notes +- Use protobuf v3 +- Support both unary and streaming RPCs +- Implement proper error handling +- Add OpenTelemetry instrumentation +- Support service versioning + +## Testing +```bash +# Generate protobuf code +make generate-proto + +# Test gRPC servers +go test ./internal/services/grpc/server/... + +# Test gRPC clients +go test ./internal/services/grpc/client/... +``` + +## Files to Create/Modify +- `api/proto/identity.proto` - Identity service definition +- `api/proto/auth.proto` - Auth service definition +- `api/proto/authz.proto` - Authz service definition +- `internal/services/grpc/server/` - gRPC server implementations +- `internal/services/grpc/client/` - gRPC client implementations +- `internal/services/factory.go` - Add gRPC client support +- `Makefile` - Add protobuf generation +- `config/default.yaml` - Add gRPC configuration + diff --git a/docs/content/stories/phase5/5.7.1-create-pkgtenanttenantgo-interface.md b/docs/content/stories/phase5/5.7.1-create-pkgtenanttenantgo-interface.md deleted file mode 100644 index 4c4c2a1..0000000 --- a/docs/content/stories/phase5/5.7.1-create-pkgtenanttenantgo-interface.md +++ /dev/null @@ -1,48 +0,0 @@ -# Task 5.7.1: Create `pkg/tenant/tenant.go` interface: - -## Metadata -- **Task ID**: 5.7.1 -- **Title**: Create `pkg/tenant/tenant.go` interface: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `pkg/tenant/tenant.go` interface: - -## Requirements -- Create `pkg/tenant/tenant.go` interface: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.7.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -type TenantResolver interface { - Resolve(ctx context.Context) (string, error) - } -``` diff --git a/docs/content/stories/phase5/5.7.2-implement-internaltenantresolvergo.md b/docs/content/stories/phase5/5.7.2-implement-internaltenantresolvergo.md deleted file mode 100644 index b7feecf..0000000 --- a/docs/content/stories/phase5/5.7.2-implement-internaltenantresolvergo.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.7.2: Implement `internal/tenant/resolver.go`: - -## Metadata -- **Task ID**: 5.7.2 -- **Title**: Implement `internal/tenant/resolver.go`: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement `internal/tenant/resolver.go`: - -## Requirements -- Implement `internal/tenant/resolver.go`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.7.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.7.3-add-tenant-middleware.md b/docs/content/stories/phase5/5.7.3-add-tenant-middleware.md deleted file mode 100644 index e9714b9..0000000 --- a/docs/content/stories/phase5/5.7.3-add-tenant-middleware.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.7.3: Add tenant middleware: - -## Metadata -- **Task ID**: 5.7.3 -- **Title**: Add tenant middleware: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add tenant middleware: - -## Requirements -- Add tenant middleware: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.7.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.7.4-update-ent-queries-to-filter-by-tenant_id.md b/docs/content/stories/phase5/5.7.4-update-ent-queries-to-filter-by-tenant_id.md deleted file mode 100644 index e126f25..0000000 --- a/docs/content/stories/phase5/5.7.4-update-ent-queries-to-filter-by-tenant_id.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.7.4: Update Ent queries to filter by tenant_id: - -## Metadata -- **Task ID**: 5.7.4 -- **Title**: Update Ent queries to filter by tenant_id: -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Update Ent queries to filter by tenant_id: - -## Requirements -- Update Ent queries to filter by tenant_id: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.7.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/5.7.5-update-user-entity-to-include-tenant_id.md b/docs/content/stories/phase5/5.7.5-update-user-entity-to-include-tenant_id.md deleted file mode 100644 index 72f6817..0000000 --- a/docs/content/stories/phase5/5.7.5-update-user-entity-to-include-tenant_id.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 5.7.5: Update User entity to include tenant_id - -## Metadata -- **Task ID**: 5.7.5 -- **Title**: Update User entity to include tenant_id -- **Phase**: 5 - Infrastructure Adapters -- **Section**: 5.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Update User entity to include tenant_id - -## Requirements -- Update User entity to include tenant_id - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 5.7.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase5/README.md b/docs/content/stories/phase5/README.md index 19c72f7..5925591 100644 --- a/docs/content/stories/phase5/README.md +++ b/docs/content/stories/phase5/README.md @@ -1,49 +1,58 @@ # Phase 5: Infrastructure Adapters ## Overview -Implement infrastructure adapters for caching (Redis), event bus (Kafka), background job scheduling (asynq), and multi-tenancy support. +Implement infrastructure adapters (cache, queue, blob storage, email), make adapters swappable via interfaces, add scheduler/background jobs system, and implement event bus (in-process and Kafka). -## Tasks +## Stories -### 5.1 Cache Implementation -- [5.1.1 - Install Redis Client](./5.1.1-install-githubcomredisgo-redisv9.md) -- [5.1.2 - Create Cache Interface](./5.1.2-create-pkginfracachecachego-interface.md) -- [5.1.3 - Implement Redis Cache](./5.1.3-implement-internalinfracacheredis_cachego.md) -- [5.1.4 - Add Redis Config](./5.1.4-add-redis-config-to-configdefaultyaml.md) -- [5.1.5 - Register in DI Container](./5.1.5-register-in-di-container.md) -- [5.1.6 - Add Cache Middleware](./5.1.6-add-cache-middleware-for-selected-routes-optional.md) +### 5.1 Cache System (Redis) +- [Story: 5.1 - Cache System](./5.1-cache-system.md) +- **Goal:** Implement a complete Redis-based caching system with a clean interface. +- **Deliverables:** Cache interface, Redis implementation, configuration, DI integration -### 5.2 Event Bus Implementation -- [5.2.1 - Create Event Bus Interface](./5.2.1-create-pkgeventbuseventbusgo-interface.md) -- [5.2.2 - Implement In-Process Bus](./5.2.2-implement-internalinfrabusinprocess_busgo.md) -- [5.2.3 - Implement Kafka Bus](./5.2.3-implement-internalinfrabuskafka_busgo.md) -- [5.2.4 - Add Kafka Config](./5.2.4-add-kafka-config-to-configdefaultyaml.md) +### 5.2 Event Bus System +- [Story: 5.2 - Event Bus](./5.2-event-bus.md) +- **Goal:** Implement a complete event bus system supporting both in-process and Kafka. +- **Deliverables:** Event bus interface, in-process bus, Kafka bus, core events -### 5.3 Background Job Scheduler -- [5.3.1 - Install Asynq](./5.3.1-install-githubcomhibikenasynq.md) -- [5.3.2 - Create Scheduler Interface](./5.3.2-create-pkgschedulerschedulergo-interface.md) -- [5.3.3 - Implement Asynq Scheduler](./5.3.3-implement-internalinfraschedulerasynq_schedulergo.md) -- [5.3.4 - Add Cron Support](./5.3.4-add-cron-support.md) +### 5.3 Blob Storage System +- [Story: 5.3 - Blob Storage](./5.3-blob-storage.md) +- **Goal:** Implement a complete blob storage system using S3. +- **Deliverables:** Blob storage interface, S3 implementation, file upload API -### 5.4 Multi-tenancy Support -- [5.4.1 - Create Tenant Resolver Interface](./5.4.1-create-pkgtenanttenantgo-interface.md) -- [5.4.2 - Implement Tenant Resolver](./5.4.2-implement-internaltenantresolvergo.md) -- [5.4.3 - Add Tenant Middleware](./5.4.3-add-tenant-middleware.md) -- [5.4.4 - Update Ent Queries](./5.4.4-update-ent-queries-with-tenant-scoping.md) +### 5.4 Email Notification System +- [Story: 5.4 - Email Notification](./5.4-email-notification.md) +- **Goal:** Implement a complete email notification system with SMTP support. +- **Deliverables:** Notification interface, SMTP implementation, email templates, identity integration + +### 5.5 Scheduler and Background Jobs System +- [Story: 5.5 - Scheduler & Jobs](./5.5-scheduler-jobs.md) +- **Goal:** Implement a complete scheduler and background job system. +- **Deliverables:** Scheduler interface, Asynq implementation, job registry, example jobs + +### 5.6 Secret Store Integration +- [Story: 5.6 - Secret Store](./5.6-secret-store.md) +- **Goal:** Implement secret store integration supporting Vault and AWS Secrets Manager. +- **Deliverables:** Secret store interface, Vault implementation, AWS implementation, config integration + +### 5.7 gRPC Service Definitions and Clients +- [Story: 5.7 - gRPC Services](./5.7-grpc-services.md) +- **Goal:** Implement gRPC service definitions and clients to enable microservices communication. +- **Deliverables:** gRPC service definitions, gRPC servers, gRPC clients, code generation ## Deliverables Checklist -- [ ] Redis cache adapter implemented -- [ ] Event bus supports in-process and Kafka -- [ ] Background job scheduler with asynq -- [ ] Cron job support -- [ ] Multi-tenancy resolver and middleware -- [ ] Database queries scoped by tenant +- [ ] Cache adapter (Redis) working +- [ ] Event bus (in-process and Kafka) functional +- [ ] Blob storage (S3) adapter +- [ ] Email notification system +- [ ] Scheduler and background jobs +- [ ] Secret store integration (optional) +- [ ] gRPC service definitions and clients ## Acceptance Criteria -- Cache operations work with Redis fallback -- Events can be published to Kafka -- Background jobs can be scheduled -- Cron jobs run on schedule -- Tenant isolation works for database queries -- Middleware extracts tenant from request - +- Cache stores and retrieves data correctly +- Events are published and consumed +- Files can be uploaded and downloaded +- Email notifications are sent +- Background jobs run on schedule +- Integration test: full infrastructure stack works diff --git a/docs/content/stories/phase6/6.1-enhanced-observability.md b/docs/content/stories/phase6/6.1-enhanced-observability.md new file mode 100644 index 0000000..6837973 --- /dev/null +++ b/docs/content/stories/phase6/6.1-enhanced-observability.md @@ -0,0 +1,72 @@ +# Story 6.1: Enhanced Observability + +## Metadata +- **Story ID**: 6.1 +- **Title**: Enhanced Observability +- **Phase**: 6 - Observability & Production Readiness +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 6-8 hours +- **Dependencies**: 1.6, 5.2, 5.1 + +## Goal +Enhance observability with full OpenTelemetry integration, comprehensive Prometheus metrics expansion, and improved logging with request correlation. + +## Description +This story enhances the observability system by completing OpenTelemetry integration with all infrastructure components, expanding Prometheus metrics, and improving logging with better correlation and structured fields. + +## Deliverables + +### 1. Complete OpenTelemetry Integration +- Export traces to Jaeger/OTLP collector +- Add database instrumentation (Ent interceptor) +- Add Kafka instrumentation +- Add Redis instrumentation +- Create custom spans: + - Module initialization spans + - Background job spans + - Event publishing spans +- Trace context propagation: + - Include trace ID in logs + - Propagate across HTTP calls + - Include in error reports + +### 2. Prometheus Metrics Expansion +- Add more metrics: + - Database connection pool stats + - Cache hit/miss ratio + - Event bus publish/consume rates + - Background job execution times + - Module-specific metrics (via module interface) +- Create metric labels: + - `module` label for module metrics + - `tenant_id` label (if multi-tenant) + - `status` label for error rates + +### 3. Enhanced Logging +- Add structured fields: + - `user_id` from context + - `tenant_id` from context + - `module` name for module logs + - `trace_id` from OpenTelemetry +- Create log aggregation config: + - JSON format for production + - Human-readable for development + - Support for Loki/CloudWatch/ELK + +## Acceptance Criteria +- [ ] Traces are exported and visible in Jaeger +- [ ] All infrastructure components are instrumented +- [ ] Trace IDs are included in logs +- [ ] Metrics are expanded with new dimensions +- [ ] Logs include all correlation fields +- [ ] Log aggregation works correctly + +## Files to Create/Modify +- `internal/observability/tracer.go` - Enhanced tracing +- `internal/infra/database/client.go` - Add tracing +- `internal/infra/cache/redis_cache.go` - Add tracing +- `internal/infra/bus/kafka_bus.go` - Add tracing +- `internal/metrics/metrics.go` - Expanded metrics +- `internal/logger/zap_logger.go` - Enhanced logging + diff --git a/docs/content/stories/phase6/6.1.1-complete-opentelemetry-setup.md b/docs/content/stories/phase6/6.1.1-complete-opentelemetry-setup.md deleted file mode 100644 index de21a21..0000000 --- a/docs/content/stories/phase6/6.1.1-complete-opentelemetry-setup.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.1.1: Complete OpenTelemetry setup: - -## Metadata -- **Task ID**: 6.1.1 -- **Title**: Complete OpenTelemetry setup: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Complete OpenTelemetry setup: - -## Requirements -- Complete OpenTelemetry setup: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.1.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.1.2-create-custom-spans.md b/docs/content/stories/phase6/6.1.2-create-custom-spans.md deleted file mode 100644 index d72be5e..0000000 --- a/docs/content/stories/phase6/6.1.2-create-custom-spans.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.1.2: Create custom spans: - -## Metadata -- **Task ID**: 6.1.2 -- **Title**: Create custom spans: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create custom spans: - -## Requirements -- Create custom spans: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.1.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.1.3-add-trace-context-propagation.md b/docs/content/stories/phase6/6.1.3-add-trace-context-propagation.md deleted file mode 100644 index aab7552..0000000 --- a/docs/content/stories/phase6/6.1.3-add-trace-context-propagation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.1.3: Add trace context propagation: - -## Metadata -- **Task ID**: 6.1.3 -- **Title**: Add trace context propagation: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add trace context propagation: - -## Requirements -- Add trace context propagation: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.1.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.2-error-reporting.md b/docs/content/stories/phase6/6.2-error-reporting.md new file mode 100644 index 0000000..fb39387 --- /dev/null +++ b/docs/content/stories/phase6/6.2-error-reporting.md @@ -0,0 +1,53 @@ +# Story 6.2: Error Reporting (Sentry) + +## Metadata +- **Story ID**: 6.2 +- **Title**: Error Reporting (Sentry) +- **Phase**: 6 - Observability & Production Readiness +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 4-5 hours +- **Dependencies**: 1.4 + +## Goal +Add comprehensive error reporting with Sentry integration that captures errors with full context. + +## Description +This story integrates Sentry for error reporting, sending all errors from the error bus to Sentry with complete context including trace IDs, user information, and module context. + +## Deliverables + +### 1. Sentry Integration +- Install and configure Sentry SDK +- Integrate with error bus: + - Send errors to Sentry + - Include trace ID in Sentry events + - Add user context (user ID, email) + - Add module context (module name) +- Sentry middleware: + - Capture panics + - Capture HTTP errors (4xx, 5xx) +- Configure Sentry DSN via config + +### 2. Error Context Enhancement +- Enrich errors with: + - Request context + - User information + - Module information + - Stack traces + - Environment information + +## Acceptance Criteria +- [ ] Errors are reported to Sentry with context +- [ ] Panics are captured and reported +- [ ] HTTP errors are captured +- [ ] Trace IDs are included in Sentry events +- [ ] User context is included +- [ ] Sentry DSN is configurable + +## Files to Create/Modify +- `internal/errorbus/sentry_bus.go` - Sentry integration +- `internal/server/middleware.go` - Sentry middleware +- `internal/di/providers.go` - Add Sentry provider +- `config/default.yaml` - Add Sentry config + diff --git a/docs/content/stories/phase6/6.2.1-install-githubcomgetsentrysentry-go.md b/docs/content/stories/phase6/6.2.1-install-githubcomgetsentrysentry-go.md deleted file mode 100644 index 73f4483..0000000 --- a/docs/content/stories/phase6/6.2.1-install-githubcomgetsentrysentry-go.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.2.1: Install `github.com/getsentry/sentry-go` - -## Metadata -- **Task ID**: 6.2.1 -- **Title**: Install `github.com/getsentry/sentry-go` -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/getsentry/sentry-go` - -## Requirements -- Install `github.com/getsentry/sentry-go` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.2.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.2.2-integrate-with-error-bus.md b/docs/content/stories/phase6/6.2.2-integrate-with-error-bus.md deleted file mode 100644 index 2f112ab..0000000 --- a/docs/content/stories/phase6/6.2.2-integrate-with-error-bus.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.2.2: Integrate with error bus: - -## Metadata -- **Task ID**: 6.2.2 -- **Title**: Integrate with error bus: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Integrate with error bus: - -## Requirements -- Integrate with error bus: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.2.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.2.3-add-sentry-middleware.md b/docs/content/stories/phase6/6.2.3-add-sentry-middleware.md deleted file mode 100644 index 1cca251..0000000 --- a/docs/content/stories/phase6/6.2.3-add-sentry-middleware.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.2.3: Add Sentry middleware: - -## Metadata -- **Task ID**: 6.2.3 -- **Title**: Add Sentry middleware: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add Sentry middleware: - -## Requirements -- Add Sentry middleware: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.2.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.2.4-configure-sentry-dsn-via-config.md b/docs/content/stories/phase6/6.2.4-configure-sentry-dsn-via-config.md deleted file mode 100644 index 1b23a6e..0000000 --- a/docs/content/stories/phase6/6.2.4-configure-sentry-dsn-via-config.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.2.4: Configure Sentry DSN via config - -## Metadata -- **Task ID**: 6.2.4 -- **Title**: Configure Sentry DSN via config -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Configure Sentry DSN via config - -## Requirements -- Configure Sentry DSN via config - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.2.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.3-grafana-dashboards.md b/docs/content/stories/phase6/6.3-grafana-dashboards.md new file mode 100644 index 0000000..688d025 --- /dev/null +++ b/docs/content/stories/phase6/6.3-grafana-dashboards.md @@ -0,0 +1,46 @@ +# Story 6.3: Grafana Dashboards + +## Metadata +- **Story ID**: 6.3 +- **Title**: Grafana Dashboards +- **Phase**: 6 - Observability & Production Readiness +- **Status**: Pending +- **Priority**: Medium +- **Estimated Time**: 4-5 hours +- **Dependencies**: 1.3, 6.1 + +## Goal +Create comprehensive Grafana dashboards for monitoring platform health, performance, and errors. + +## Description +This story creates Grafana dashboard JSON files that visualize platform metrics, health, and performance data from Prometheus. + +## Deliverables + +### 1. Grafana Dashboards (`ops/grafana/dashboards/`) +- `platform-overview.json` - Overall health dashboard +- `http-metrics.json` - HTTP request metrics +- `database-metrics.json` - Database performance +- `module-metrics.json` - Per-module metrics +- `error-rates.json` - Error tracking +- Dashboard setup documentation + +### 2. Documentation +- Document dashboard setup in `docs/operations.md` +- Dashboard import instructions +- Metric explanation + +## Acceptance Criteria +- [ ] All dashboards are created +- [ ] Dashboards display correct metrics +- [ ] Dashboard setup is documented +- [ ] Dashboards can be imported into Grafana + +## Files to Create/Modify +- `ops/grafana/dashboards/platform-overview.json` +- `ops/grafana/dashboards/http-metrics.json` +- `ops/grafana/dashboards/database-metrics.json` +- `ops/grafana/dashboards/module-metrics.json` +- `ops/grafana/dashboards/error-rates.json` +- `docs/operations.md` - Dashboard documentation + diff --git a/docs/content/stories/phase6/6.3.1-add-request-correlation.md b/docs/content/stories/phase6/6.3.1-add-request-correlation.md deleted file mode 100644 index ad0543a..0000000 --- a/docs/content/stories/phase6/6.3.1-add-request-correlation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.3.1: Add request correlation: - -## Metadata -- **Task ID**: 6.3.1 -- **Title**: Add request correlation: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add request correlation: - -## Requirements -- Add request correlation: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.3.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.3.2-add-structured-fields.md b/docs/content/stories/phase6/6.3.2-add-structured-fields.md deleted file mode 100644 index aae1228..0000000 --- a/docs/content/stories/phase6/6.3.2-add-structured-fields.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.3.2: Add structured fields: - -## Metadata -- **Task ID**: 6.3.2 -- **Title**: Add structured fields: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add structured fields: - -## Requirements -- Add structured fields: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.3.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.3.3-create-log-aggregation-config.md b/docs/content/stories/phase6/6.3.3-create-log-aggregation-config.md deleted file mode 100644 index 67baa02..0000000 --- a/docs/content/stories/phase6/6.3.3-create-log-aggregation-config.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.3.3: Create log aggregation config: - -## Metadata -- **Task ID**: 6.3.3 -- **Title**: Create log aggregation config: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create log aggregation config: - -## Requirements -- Create log aggregation config: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.3.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.4-rate-limiting.md b/docs/content/stories/phase6/6.4-rate-limiting.md new file mode 100644 index 0000000..7920e31 --- /dev/null +++ b/docs/content/stories/phase6/6.4-rate-limiting.md @@ -0,0 +1,53 @@ +# Story 6.4: Rate Limiting + +## Metadata +- **Story ID**: 6.4 +- **Title**: Rate Limiting +- **Phase**: 6 - Observability & Production Readiness +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 4-5 hours +- **Dependencies**: 1.5, 5.1 + +## Goal +Implement rate limiting to prevent API abuse and ensure fair resource usage. + +## Description +This story implements rate limiting middleware that limits requests per user and per IP address, with configurable limits per endpoint. + +## Deliverables + +### 1. Rate Limiting Middleware +- Per-user rate limiting +- Per-IP rate limiting +- Configurable limits per endpoint +- Rate limit storage (Redis) +- Return `X-RateLimit-*` headers + +### 2. Configuration +- Rate limit config in `config/default.yaml`: + ```yaml + rate_limiting: + enabled: true + per_user: 100/minute + per_ip: 1000/minute + ``` + +### 3. Integration +- Integrate with HTTP server +- Add to middleware stack +- Error responses for rate limit exceeded + +## Acceptance Criteria +- [ ] Rate limiting prevents abuse +- [ ] Per-user limits work correctly +- [ ] Per-IP limits work correctly +- [ ] Rate limit headers are returned +- [ ] Configuration is flexible +- [ ] Rate limits are stored in Redis + +## Files to Create/Modify +- `internal/server/middleware.go` - Rate limiting middleware +- `internal/infra/ratelimit/limiter.go` - Rate limiter implementation +- `config/default.yaml` - Add rate limit config + diff --git a/docs/content/stories/phase6/6.4.1-add-more-metrics.md b/docs/content/stories/phase6/6.4.1-add-more-metrics.md deleted file mode 100644 index 347fa6a..0000000 --- a/docs/content/stories/phase6/6.4.1-add-more-metrics.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.4.1: Add more metrics: - -## Metadata -- **Task ID**: 6.4.1 -- **Title**: Add more metrics: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add more metrics: - -## Requirements -- Add more metrics: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.4.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.4.2-create-metric-labels.md b/docs/content/stories/phase6/6.4.2-create-metric-labels.md deleted file mode 100644 index 57dded4..0000000 --- a/docs/content/stories/phase6/6.4.2-create-metric-labels.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.4.2: Create metric labels: - -## Metadata -- **Task ID**: 6.4.2 -- **Title**: Create metric labels: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create metric labels: - -## Requirements -- Create metric labels: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.4.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.5-security-hardening.md b/docs/content/stories/phase6/6.5-security-hardening.md new file mode 100644 index 0000000..727f3c8 --- /dev/null +++ b/docs/content/stories/phase6/6.5-security-hardening.md @@ -0,0 +1,54 @@ +# Story 6.5: Security Hardening + +## Metadata +- **Story ID**: 6.5 +- **Title**: Security Hardening +- **Phase**: 6 - Observability & Production Readiness +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 5-6 hours +- **Dependencies**: 1.5 + +## Goal +Add comprehensive security hardening including security headers, input validation, and request size limits. + +## Description +This story implements security best practices including security headers, input validation, request size limits, and SQL injection protection. + +## Deliverables + +### 1. Security Headers Middleware +- `X-Content-Type-Options: nosniff` +- `X-Frame-Options: DENY` +- `X-XSS-Protection: 1; mode=block` +- `Strict-Transport-Security` (if HTTPS) +- `Content-Security-Policy` + +### 2. Request Size Limits +- Max body size (10MB default) +- Max header size +- Configurable limits + +### 3. Input Validation +- Use `github.com/go-playground/validator` +- Validate all request bodies +- Sanitize user inputs +- Validation error responses + +### 4. SQL Injection Protection +- Use parameterized queries (Ent already does this) +- Add linter rule to prevent raw SQL +- Security scanning + +## Acceptance Criteria +- [ ] Security headers are present +- [ ] Request size limits are enforced +- [ ] Input validation works +- [ ] SQL injection protection is in place +- [ ] Security headers are configurable + +## Files to Create/Modify +- `internal/server/middleware.go` - Security headers middleware +- `internal/server/validation.go` - Input validation +- `config/default.yaml` - Add security config + diff --git a/docs/content/stories/phase6/6.5.1-create-opsgrafanadashboards.md b/docs/content/stories/phase6/6.5.1-create-opsgrafanadashboards.md deleted file mode 100644 index b502783..0000000 --- a/docs/content/stories/phase6/6.5.1-create-opsgrafanadashboards.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.5.1: Create `ops/grafana/dashboards/`: - -## Metadata -- **Task ID**: 6.5.1 -- **Title**: Create `ops/grafana/dashboards/`: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `ops/grafana/dashboards/`: - -## Requirements -- Create `ops/grafana/dashboards/`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.5.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.5.2-document-dashboard-setup-in-docsoperationsmd.md b/docs/content/stories/phase6/6.5.2-document-dashboard-setup-in-docsoperationsmd.md deleted file mode 100644 index 44fc03d..0000000 --- a/docs/content/stories/phase6/6.5.2-document-dashboard-setup-in-docsoperationsmd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.5.2: Document dashboard setup in `docs/operations.md` - -## Metadata -- **Task ID**: 6.5.2 -- **Title**: Document dashboard setup in `docs/operations.md` -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Document dashboard setup in `docs/operations.md` - -## Requirements -- Document dashboard setup in `docs/operations.md` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.5.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.6-performance-optimization.md b/docs/content/stories/phase6/6.6-performance-optimization.md new file mode 100644 index 0000000..169a413 --- /dev/null +++ b/docs/content/stories/phase6/6.6-performance-optimization.md @@ -0,0 +1,53 @@ +# Story 6.6: Performance Optimization + +## Metadata +- **Story ID**: 6.6 +- **Title**: Performance Optimization +- **Phase**: 6 - Observability & Production Readiness +- **Status**: Pending +- **Priority**: Medium +- **Estimated Time**: 6-8 hours +- **Dependencies**: 1.2, 5.1 + +## Goal +Optimize platform performance through database connection pooling, query optimization, response compression, and caching strategies. + +## Description +This story implements performance optimizations including database connection pooling, query optimization, response compression, and strategic caching. + +## Deliverables + +### 1. Database Connection Pooling +- Configure max connections +- Configure idle timeout +- Monitor pool stats +- Connection health checks + +### 2. Query Optimization +- Add indexes for common queries +- Use database query logging (development) +- Add slow query detection +- Query performance monitoring + +### 3. Response Compression +- Gzip middleware for large responses +- Configurable compression levels +- Content type filtering + +### 4. Caching Strategy +- Cache frequently accessed data (user permissions, roles) +- Cache invalidation strategies +- Cache warming + +## Acceptance Criteria +- [ ] Database connection pooling is optimized +- [ ] Query performance is improved +- [ ] Response compression works +- [ ] Caching strategy is effective +- [ ] Performance meets SLA (< 100ms p95 for auth endpoints) + +## Files to Create/Modify +- `internal/infra/database/client.go` - Connection pooling +- `internal/server/middleware.go` - Compression middleware +- `internal/perm/in_memory_resolver.go` - Add caching + diff --git a/docs/content/stories/phase6/6.6.1-install-githubcomululelimiterv3.md b/docs/content/stories/phase6/6.6.1-install-githubcomululelimiterv3.md deleted file mode 100644 index 95b62b0..0000000 --- a/docs/content/stories/phase6/6.6.1-install-githubcomululelimiterv3.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.6.1: Install `github.com/ulule/limiter/v3` - -## Metadata -- **Task ID**: 6.6.1 -- **Title**: Install `github.com/ulule/limiter/v3` -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/ulule/limiter/v3` - -## Requirements -- Install `github.com/ulule/limiter/v3` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.6.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.6.2-create-rate-limit-middleware.md b/docs/content/stories/phase6/6.6.2-create-rate-limit-middleware.md deleted file mode 100644 index 26d351e..0000000 --- a/docs/content/stories/phase6/6.6.2-create-rate-limit-middleware.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.6.2: Create rate limit middleware: - -## Metadata -- **Task ID**: 6.6.2 -- **Title**: Create rate limit middleware: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create rate limit middleware: - -## Requirements -- Create rate limit middleware: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.6.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.6.3-add-rate-limit-config.md b/docs/content/stories/phase6/6.6.3-add-rate-limit-config.md deleted file mode 100644 index 83857df..0000000 --- a/docs/content/stories/phase6/6.6.3-add-rate-limit-config.md +++ /dev/null @@ -1,49 +0,0 @@ -# Task 6.6.3: Add rate limit config: - -## Metadata -- **Task ID**: 6.6.3 -- **Title**: Add rate limit config: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add rate limit config: - -## Requirements -- Add rate limit config: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.6.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -rate_limiting: - enabled: true - per_user: 100/minute - per_ip: 1000/minute -``` diff --git a/docs/content/stories/phase6/6.6.4-return-x-ratelimit--headers.md b/docs/content/stories/phase6/6.6.4-return-x-ratelimit--headers.md deleted file mode 100644 index f6f1825..0000000 --- a/docs/content/stories/phase6/6.6.4-return-x-ratelimit--headers.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.6.4: Return `X-RateLimit-*` headers - -## Metadata -- **Task ID**: 6.6.4 -- **Title**: Return `X-RateLimit-*` headers -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Return `X-RateLimit-*` headers - -## Requirements -- Return `X-RateLimit-*` headers - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.6.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.7.1-add-security-headers-middleware.md b/docs/content/stories/phase6/6.7.1-add-security-headers-middleware.md deleted file mode 100644 index 7d4fd33..0000000 --- a/docs/content/stories/phase6/6.7.1-add-security-headers-middleware.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.7.1: Add security headers middleware: - -## Metadata -- **Task ID**: 6.7.1 -- **Title**: Add security headers middleware: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add security headers middleware: - -## Requirements -- Add security headers middleware: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.7.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.7.2-add-request-size-limits.md b/docs/content/stories/phase6/6.7.2-add-request-size-limits.md deleted file mode 100644 index f8eabae..0000000 --- a/docs/content/stories/phase6/6.7.2-add-request-size-limits.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.7.2: Add request size limits: - -## Metadata -- **Task ID**: 6.7.2 -- **Title**: Add request size limits: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add request size limits: - -## Requirements -- Add request size limits: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.7.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.7.3-add-input-validation.md b/docs/content/stories/phase6/6.7.3-add-input-validation.md deleted file mode 100644 index 1d03584..0000000 --- a/docs/content/stories/phase6/6.7.3-add-input-validation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.7.3: Add input validation: - -## Metadata -- **Task ID**: 6.7.3 -- **Title**: Add input validation: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add input validation: - -## Requirements -- Add input validation: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.7.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.7.4-add-sql-injection-protection.md b/docs/content/stories/phase6/6.7.4-add-sql-injection-protection.md deleted file mode 100644 index 7af8c66..0000000 --- a/docs/content/stories/phase6/6.7.4-add-sql-injection-protection.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.7.4: Add SQL injection protection: - -## Metadata -- **Task ID**: 6.7.4 -- **Title**: Add SQL injection protection: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add SQL injection protection: - -## Requirements -- Add SQL injection protection: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.7.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.8.1-add-database-connection-pooling.md b/docs/content/stories/phase6/6.8.1-add-database-connection-pooling.md deleted file mode 100644 index 5011938..0000000 --- a/docs/content/stories/phase6/6.8.1-add-database-connection-pooling.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.8.1: Add database connection pooling: - -## Metadata -- **Task ID**: 6.8.1 -- **Title**: Add database connection pooling: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add database connection pooling: - -## Requirements -- Add database connection pooling: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.8.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.8.2-add-query-optimization.md b/docs/content/stories/phase6/6.8.2-add-query-optimization.md deleted file mode 100644 index b657db1..0000000 --- a/docs/content/stories/phase6/6.8.2-add-query-optimization.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.8.2: Add query optimization: - -## Metadata -- **Task ID**: 6.8.2 -- **Title**: Add query optimization: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add query optimization: - -## Requirements -- Add query optimization: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.8.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.8.3-add-response-compression.md b/docs/content/stories/phase6/6.8.3-add-response-compression.md deleted file mode 100644 index 8d95f75..0000000 --- a/docs/content/stories/phase6/6.8.3-add-response-compression.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.8.3: Add response compression: - -## Metadata -- **Task ID**: 6.8.3 -- **Title**: Add response compression: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add response compression: - -## Requirements -- Add response compression: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.8.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/6.8.4-add-caching-strategy.md b/docs/content/stories/phase6/6.8.4-add-caching-strategy.md deleted file mode 100644 index 291f783..0000000 --- a/docs/content/stories/phase6/6.8.4-add-caching-strategy.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 6.8.4: Add caching strategy: - -## Metadata -- **Task ID**: 6.8.4 -- **Title**: Add caching strategy: -- **Phase**: 6 - Observability & Production Readiness -- **Section**: 6.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add caching strategy: - -## Requirements -- Add caching strategy: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 6.8.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase6/README.md b/docs/content/stories/phase6/README.md index cc98773..014022c 100644 --- a/docs/content/stories/phase6/README.md +++ b/docs/content/stories/phase6/README.md @@ -1,48 +1,55 @@ # Phase 6: Observability & Production Readiness ## Overview -Complete observability setup with OpenTelemetry, integrate error reporting with Sentry, enhance logging with correlation IDs, and add rate limiting. +Enhance observability with full OpenTelemetry integration, add comprehensive error reporting (Sentry), create Grafana dashboards, improve logging with request correlation, add rate limiting and security hardening, and optimize performance. -## Tasks +## Stories -### 6.1 OpenTelemetry Completion -- [6.1.1 - Complete OpenTelemetry Setup](./6.1.1-complete-opentelemetry-setup.md) -- [6.1.2 - Create Custom Spans](./6.1.2-create-custom-spans.md) -- [6.1.3 - Add Trace Context Propagation](./6.1.3-add-trace-context-propagation.md) +### 6.1 Enhanced Observability +- [Story: 6.1 - Enhanced Observability](./6.1-enhanced-observability.md) +- **Goal:** Enhance observability with full OpenTelemetry integration, comprehensive Prometheus metrics, and improved logging. +- **Deliverables:** Complete OpenTelemetry integration, expanded metrics, enhanced logging ### 6.2 Error Reporting (Sentry) -- [6.2.1 - Install Sentry](./6.2.1-install-githubcomgetsentrysentry-go.md) -- [6.2.2 - Integrate with Error Bus](./6.2.2-integrate-with-error-bus.md) -- [6.2.3 - Add Sentry Middleware](./6.2.3-add-sentry-middleware.md) -- [6.2.4 - Configure Sentry DSN](./6.2.4-configure-sentry-dsn-via-config.md) +- [Story: 6.2 - Error Reporting](./6.2-error-reporting.md) +- **Goal:** Add comprehensive error reporting with Sentry integration. +- **Deliverables:** Sentry integration, error context enhancement -### 6.3 Enhanced Logging -- [6.3.1 - Add Request Correlation](./6.3.1-add-request-correlation.md) -- [6.3.2 - Add Structured Fields](./6.3.2-add-structured-fields.md) -- [6.3.3 - Create Log Aggregation Config](./6.3.3-create-log-aggregation-config.md) +### 6.3 Grafana Dashboards +- [Story: 6.3 - Grafana Dashboards](./6.3-grafana-dashboards.md) +- **Goal:** Create comprehensive Grafana dashboards for monitoring. +- **Deliverables:** Grafana dashboard JSON files, documentation ### 6.4 Rate Limiting -- [6.4.1 - Create Rate Limiter Interface](./6.4.1-create-pkgratelimitratelimitergo-interface.md) -- [6.4.2 - Implement Redis Rate Limiter](./6.4.2-implement-internalratelimitredis_limitergo.md) -- [6.4.3 - Add Rate Limit Middleware](./6.4.3-add-rate-limit-middleware.md) +- [Story: 6.4 - Rate Limiting](./6.4-rate-limiting.md) +- **Goal:** Implement rate limiting to prevent API abuse. +- **Deliverables:** Rate limiting middleware, configuration -### 6.5 Production Configuration -- [6.5.1 - Create Production Config Template](./6.5.1-create-production-config-template.md) -- [6.5.2 - Add Environment-Specific Settings](./6.5.2-add-environment-specific-settings.md) +### 6.5 Security Hardening +- [Story: 6.5 - Security Hardening](./6.5-security-hardening.md) +- **Goal:** Add comprehensive security hardening. +- **Deliverables:** Security headers, input validation, request limits + +### 6.6 Performance Optimization +- [Story: 6.6 - Performance Optimization](./6.6-performance-optimization.md) +- **Goal:** Optimize platform performance. +- **Deliverables:** Connection pooling, query optimization, compression, caching ## Deliverables Checklist -- [ ] OpenTelemetry fully integrated with custom spans -- [ ] Sentry error reporting working -- [ ] Enhanced logging with correlation IDs -- [ ] Rate limiting middleware implemented -- [ ] Production configuration templates ready -- [ ] All observability data flowing to external systems +- [ ] Full OpenTelemetry integration +- [ ] Sentry error reporting +- [ ] Enhanced logging with correlation +- [ ] Comprehensive Prometheus metrics +- [ ] Grafana dashboards +- [ ] Rate limiting +- [ ] Security hardening +- [ ] Performance optimizations ## Acceptance Criteria -- Traces are exported to OTLP endpoint -- Errors are reported to Sentry -- Logs include correlation IDs +- Traces are exported and visible in Jaeger +- Errors are reported to Sentry with context +- Logs include request IDs and trace IDs +- Metrics are exposed and scraped by Prometheus - Rate limiting prevents abuse -- Production configs are validated -- All metrics are exposed via Prometheus - +- Security headers are present +- Performance meets SLA (< 100ms p95 for auth endpoints) diff --git a/docs/content/stories/phase7/7.1-testing-suite.md b/docs/content/stories/phase7/7.1-testing-suite.md new file mode 100644 index 0000000..89505cf --- /dev/null +++ b/docs/content/stories/phase7/7.1-testing-suite.md @@ -0,0 +1,83 @@ +# Story 7.1: Comprehensive Testing Suite + +## Metadata +- **Story ID**: 7.1 +- **Title**: Comprehensive Testing Suite +- **Phase**: 7 - Testing, Documentation & CI/CD +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 10-12 hours +- **Dependencies**: All previous phases + +## Goal +Achieve comprehensive test coverage with unit tests, integration tests, and contract tests. + +## Description +This story implements a complete testing suite with >80% code coverage, integration tests using testcontainers, and contract tests for API validation. + +## Deliverables + +### 1. Unit Tests +- Achieve >80% code coverage for core modules: + - Config loader + - Logger + - Auth service + - Permission resolver + - Module registry +- Use `github.com/stretchr/testify` for assertions +- Use `github.com/golang/mock` or `mockery` for mocks +- Test helpers: + - `testutil.NewTestDB()` - In-memory SQLite for tests + - `testutil.NewTestUser()` - Create test user + - `testutil.NewTestContext()` - Context with user + +### 2. Integration Tests +- Install `github.com/testcontainers/testcontainers-go` +- Create integration test suite: + - Full HTTP request flow + - Database operations + - Event bus publishing/consuming + - Background job execution +- Test scenarios: + - User registration → login → API access + - Role assignment → permission check + - Module loading and initialization + - Multi-module interaction +- Create `docker-compose.test.yml`: + - PostgreSQL + - Redis + - Kafka (optional) +- Add test tags: `//go:build integration` + +### 3. Contract Tests +- Install `github.com/pact-foundation/pact-go` (optional) +- Create API contract tests: + - Verify API responses match OpenAPI spec + - Test backward compatibility +- Use OpenAPI validator: + - Install `github.com/getkin/kin-openapi` + - Validate request/response against OpenAPI spec + - Generate OpenAPI spec from code annotations + +### 4. Load Testing +- Create `perf/` directory with k6 scripts: + - `perf/auth-load.js` - Login endpoint load test + - `perf/api-load.js` - General API load test +- Document performance benchmarks: + - Request latency (p50, p95, p99) + - Throughput (requests/second) + - Resource usage (CPU, memory) + +## Acceptance Criteria +- [ ] All tests pass in CI +- [ ] Code coverage >80% +- [ ] Integration tests work with testcontainers +- [ ] Contract tests validate API +- [ ] Load tests are documented + +## Files to Create/Modify +- `internal/testutil/` - Test utilities +- `docker-compose.test.yml` - Test containers +- `perf/` - Load test scripts +- All test files across the codebase + diff --git a/docs/content/stories/phase7/7.1.1-achieve-80-code-coverage-for-core-modules.md b/docs/content/stories/phase7/7.1.1-achieve-80-code-coverage-for-core-modules.md deleted file mode 100644 index bbe0be8..0000000 --- a/docs/content/stories/phase7/7.1.1-achieve-80-code-coverage-for-core-modules.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.1.1: Achieve >80% code coverage for core modules: - -## Metadata -- **Task ID**: 7.1.1 -- **Title**: Achieve >80% code coverage for core modules: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Achieve >80% code coverage for core modules: - -## Requirements -- Achieve >80% code coverage for core modules: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.1.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.1.2-use-githubcomstretchrtestify-for-assertions.md b/docs/content/stories/phase7/7.1.2-use-githubcomstretchrtestify-for-assertions.md deleted file mode 100644 index 7bf3557..0000000 --- a/docs/content/stories/phase7/7.1.2-use-githubcomstretchrtestify-for-assertions.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.1.2: Use `github.com/stretchr/testify` for assertions - -## Metadata -- **Task ID**: 7.1.2 -- **Title**: Use `github.com/stretchr/testify` for assertions -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Use `github.com/stretchr/testify` for assertions - -## Requirements -- Use `github.com/stretchr/testify` for assertions - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.1.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.1.3-use-githubcomgolangmock-or-mockery-for-mocks.md b/docs/content/stories/phase7/7.1.3-use-githubcomgolangmock-or-mockery-for-mocks.md deleted file mode 100644 index c4e5b5d..0000000 --- a/docs/content/stories/phase7/7.1.3-use-githubcomgolangmock-or-mockery-for-mocks.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.1.3: Use `github.com/golang/mock` or `mockery` for mocks - -## Metadata -- **Task ID**: 7.1.3 -- **Title**: Use `github.com/golang/mock` or `mockery` for mocks -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Use `github.com/golang/mock` or `mockery` for mocks - -## Requirements -- Use `github.com/golang/mock` or `mockery` for mocks - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.1.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.1.4-add-test-helpers.md b/docs/content/stories/phase7/7.1.4-add-test-helpers.md deleted file mode 100644 index 9a05ba5..0000000 --- a/docs/content/stories/phase7/7.1.4-add-test-helpers.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.1.4: Add test helpers: - -## Metadata -- **Task ID**: 7.1.4 -- **Title**: Add test helpers: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add test helpers: - -## Requirements -- Add test helpers: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.1.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.2-documentation.md b/docs/content/stories/phase7/7.2-documentation.md new file mode 100644 index 0000000..9397743 --- /dev/null +++ b/docs/content/stories/phase7/7.2-documentation.md @@ -0,0 +1,68 @@ +# Story 7.2: Complete Documentation + +## Metadata +- **Story ID**: 7.2 +- **Title**: Complete Documentation +- **Phase**: 7 - Testing, Documentation & CI/CD +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 8-10 hours +- **Dependencies**: All previous phases + +## Goal +Create comprehensive documentation covering architecture, API, operations, and developer guides. + +## Description +This story creates complete documentation including README, architecture docs, API docs, operations guides, and code examples. + +## Deliverables + +### 1. Core Documentation +- **README.md**: + - Quick start guide + - Architecture overview + - Installation instructions + - Development setup +- **docs/architecture.md**: + - System architecture diagram + - Module system explanation + - Extension points +- **docs/extension-points.md**: + - How to create a module + - Permission system + - Event bus usage + - Background jobs + +### 2. API Documentation +- **docs/api.md**: + - API endpoints documentation + - Authentication flow + - Error codes + - Request/response examples + +### 3. Operations Documentation +- **docs/operations.md**: + - Deployment guide + - Monitoring setup + - Troubleshooting + - Grafana dashboards + +### 4. Code Examples +- `examples/` directory with sample modules +- Code comments and godoc +- Tutorial examples + +## Acceptance Criteria +- [ ] Documentation is complete and accurate +- [ ] All major features are documented +- [ ] Code examples work +- [ ] Documentation is accessible + +## Files to Create/Modify +- `README.md` - Main documentation +- `docs/architecture.md` - Architecture docs +- `docs/extension-points.md` - Extension guide +- `docs/api.md` - API documentation +- `docs/operations.md` - Operations guide +- `examples/` - Code examples + diff --git a/docs/content/stories/phase7/7.2.1-install-githubcomtestcontainerstestcontainers-go.md b/docs/content/stories/phase7/7.2.1-install-githubcomtestcontainerstestcontainers-go.md deleted file mode 100644 index 809b423..0000000 --- a/docs/content/stories/phase7/7.2.1-install-githubcomtestcontainerstestcontainers-go.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.2.1: Install `github.com/testcontainers/testcontainers-go` - -## Metadata -- **Task ID**: 7.2.1 -- **Title**: Install `github.com/testcontainers/testcontainers-go` -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/testcontainers/testcontainers-go` - -## Requirements -- Install `github.com/testcontainers/testcontainers-go` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.2.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.2.2-create-integration-test-suite.md b/docs/content/stories/phase7/7.2.2-create-integration-test-suite.md deleted file mode 100644 index f1abf76..0000000 --- a/docs/content/stories/phase7/7.2.2-create-integration-test-suite.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.2.2: Create integration test suite: - -## Metadata -- **Task ID**: 7.2.2 -- **Title**: Create integration test suite: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create integration test suite: - -## Requirements -- Create integration test suite: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.2.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.2.3-test-scenarios.md b/docs/content/stories/phase7/7.2.3-test-scenarios.md deleted file mode 100644 index d87c4d2..0000000 --- a/docs/content/stories/phase7/7.2.3-test-scenarios.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.2.3: Test scenarios: - -## Metadata -- **Task ID**: 7.2.3 -- **Title**: Test scenarios: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Test scenarios: - -## Requirements -- Test scenarios: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.2.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.2.4-create-docker-composetestyml.md b/docs/content/stories/phase7/7.2.4-create-docker-composetestyml.md deleted file mode 100644 index ac1e868..0000000 --- a/docs/content/stories/phase7/7.2.4-create-docker-composetestyml.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.2.4: Create `docker-compose.test.yml`: - -## Metadata -- **Task ID**: 7.2.4 -- **Title**: Create `docker-compose.test.yml`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docker-compose.test.yml`: - -## Requirements -- Create `docker-compose.test.yml`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.2.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.2.5-add-test-tags-gobuild-integration.md b/docs/content/stories/phase7/7.2.5-add-test-tags-gobuild-integration.md deleted file mode 100644 index 2ea99f1..0000000 --- a/docs/content/stories/phase7/7.2.5-add-test-tags-gobuild-integration.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.2.5: Add test tags: `//go:build integration` - -## Metadata -- **Task ID**: 7.2.5 -- **Title**: Add test tags: `//go:build integration` -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add test tags: `//go:build integration` - -## Requirements -- Add test tags: `//go:build integration` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.2.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.3-cicd-enhancement.md b/docs/content/stories/phase7/7.3-cicd-enhancement.md new file mode 100644 index 0000000..2b9f322 --- /dev/null +++ b/docs/content/stories/phase7/7.3-cicd-enhancement.md @@ -0,0 +1,51 @@ +# Story 7.3: CI/CD Pipeline Enhancement + +## Metadata +- **Story ID**: 7.3 +- **Title**: CI/CD Pipeline Enhancement +- **Phase**: 7 - Testing, Documentation & CI/CD +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 5-6 hours +- **Dependencies**: 7.1 + +## Goal +Enhance CI/CD pipeline with comprehensive testing, security scanning, and release automation. + +## Description +This story enhances the CI/CD pipeline to run comprehensive tests, perform security scanning, and automate releases with Docker image builds. + +## Deliverables + +### 1. Enhanced CI Pipeline +- Update `.github/workflows/ci.yml`: + - Run unit tests with coverage + - Run integration tests (with testcontainers) + - Run linters (golangci-lint, gosec) + - Generate coverage report + - Upload artifacts + +### 2. Release Workflow +- Add release workflow: + - Semantic versioning + - Tag releases + - Build and push Docker images + - Generate changelog + +### 3. Security Scanning +- `gosec` for security issues +- Dependabot for dependency updates +- Trivy for container scanning + +## Acceptance Criteria +- [ ] CI pipeline runs all tests +- [ ] Coverage reports are generated +- [ ] Security scanning works +- [ ] Release workflow works +- [ ] Docker images are built and pushed + +## Files to Create/Modify +- `.github/workflows/ci.yml` - Enhanced CI +- `.github/workflows/release.yml` - Release workflow +- `.github/dependabot.yml` - Dependabot config + diff --git a/docs/content/stories/phase7/7.3.1-install-githubcompact-foundationpact-go-optional.md b/docs/content/stories/phase7/7.3.1-install-githubcompact-foundationpact-go-optional.md deleted file mode 100644 index de2ef93..0000000 --- a/docs/content/stories/phase7/7.3.1-install-githubcompact-foundationpact-go-optional.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.3.1: Install `github.com/pact-foundation/pact-go` (optional) - -## Metadata -- **Task ID**: 7.3.1 -- **Title**: Install `github.com/pact-foundation/pact-go` (optional) -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/pact-foundation/pact-go` (optional) - -## Requirements -- Install `github.com/pact-foundation/pact-go` (optional) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.3.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.3.2-create-api-contract-tests.md b/docs/content/stories/phase7/7.3.2-create-api-contract-tests.md deleted file mode 100644 index 12cb96d..0000000 --- a/docs/content/stories/phase7/7.3.2-create-api-contract-tests.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.3.2: Create API contract tests: - -## Metadata -- **Task ID**: 7.3.2 -- **Title**: Create API contract tests: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create API contract tests: - -## Requirements -- Create API contract tests: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.3.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.3.3-use-openapi-validator.md b/docs/content/stories/phase7/7.3.3-use-openapi-validator.md deleted file mode 100644 index a1302f5..0000000 --- a/docs/content/stories/phase7/7.3.3-use-openapi-validator.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.3.3: Use OpenAPI validator: - -## Metadata -- **Task ID**: 7.3.3 -- **Title**: Use OpenAPI validator: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Use OpenAPI validator: - -## Requirements -- Use OpenAPI validator: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.3.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.4-docker-deployment.md b/docs/content/stories/phase7/7.4-docker-deployment.md new file mode 100644 index 0000000..b5b3781 --- /dev/null +++ b/docs/content/stories/phase7/7.4-docker-deployment.md @@ -0,0 +1,77 @@ +# Story 7.4: Docker and Deployment + +## Metadata +- **Story ID**: 7.4 +- **Title**: Docker and Deployment +- **Phase**: 7 - Testing, Documentation & CI/CD +- **Status**: Pending +- **Priority**: High +- **Estimated Time**: 6-8 hours +- **Dependencies**: All previous phases + +## Goal +Create production-ready Docker images and comprehensive deployment guides. + +## Description +This story creates multi-stage Dockerfiles, Docker Compose files, and deployment guides for various platforms. + +## Deliverables + +### 1. Docker Images +- Create multi-stage `Dockerfile`: + - Build stage with Go + - Runtime stage (distroless) + - Health checks + - Proper layer caching + +### 2. Docker Compose +- Create `docker-compose.yml` for development: + - Platform service + - PostgreSQL + - Redis + - Kafka (optional) +- Create `docker-compose.prod.yml` for production + +### 3. Deployment Guides +- **docs/deployment/kubernetes.md**: + - Kubernetes manifests + - Helm chart (optional) + - Service definitions + - ConfigMap and Secret management +- **docs/deployment/docker.md**: + - Docker Compose deployment + - Environment variables + - Volume mounts +- **docs/deployment/cloud.md**: + - AWS/GCP/Azure deployment notes + - Managed service integration + - Load balancer configuration + +### 4. Developer Experience +- Create `Makefile` with common tasks: + - `make dev` - Start dev environment + - `make test` - Run tests + - `make lint` - Run linters + - `make generate` - Generate code + - `make docker-build` - Build Docker image + - `make migrate` - Run migrations +- Add development scripts: + - `scripts/dev.sh` - Start all services + - `scripts/test.sh` - Run test suite + - `scripts/seed.sh` - Seed test data +- Create `.env.example` with all config variables + +## Acceptance Criteria +- [ ] Docker images build and run successfully +- [ ] Docker Compose works for development +- [ ] Deployment guides are tested +- [ ] New developers can set up environment in <30 minutes + +## Files to Create/Modify +- `Dockerfile` - Multi-stage build +- `docker-compose.yml` - Development compose +- `docker-compose.prod.yml` - Production compose +- `docs/deployment/` - Deployment guides +- `Makefile` - Enhanced with more commands +- `scripts/` - Development scripts + diff --git a/docs/content/stories/phase7/7.4.1-create-perf-directory-with-k6-scripts.md b/docs/content/stories/phase7/7.4.1-create-perf-directory-with-k6-scripts.md deleted file mode 100644 index 46dd39d..0000000 --- a/docs/content/stories/phase7/7.4.1-create-perf-directory-with-k6-scripts.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.4.1: Create `perf/` directory with k6 scripts: - -## Metadata -- **Task ID**: 7.4.1 -- **Title**: Create `perf/` directory with k6 scripts: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `perf/` directory with k6 scripts: - -## Requirements -- Create `perf/` directory with k6 scripts: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.4.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.4.2-document-performance-benchmarks.md b/docs/content/stories/phase7/7.4.2-document-performance-benchmarks.md deleted file mode 100644 index 0fc1629..0000000 --- a/docs/content/stories/phase7/7.4.2-document-performance-benchmarks.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.4.2: Document performance benchmarks: - -## Metadata -- **Task ID**: 7.4.2 -- **Title**: Document performance benchmarks: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Document performance benchmarks: - -## Requirements -- Document performance benchmarks: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.4.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.5.1-create-readmemd.md b/docs/content/stories/phase7/7.5.1-create-readmemd.md deleted file mode 100644 index 6246705..0000000 --- a/docs/content/stories/phase7/7.5.1-create-readmemd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.5.1: Create `README.md`: - -## Metadata -- **Task ID**: 7.5.1 -- **Title**: Create `README.md`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `README.md`: - -## Requirements -- Create `README.md`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.5.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.5.2-create-docsarchitecturemd.md b/docs/content/stories/phase7/7.5.2-create-docsarchitecturemd.md deleted file mode 100644 index 61f2f77..0000000 --- a/docs/content/stories/phase7/7.5.2-create-docsarchitecturemd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.5.2: Create `docs/architecture.md`: - -## Metadata -- **Task ID**: 7.5.2 -- **Title**: Create `docs/architecture.md`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docs/architecture.md`: - -## Requirements -- Create `docs/architecture.md`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.5.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.5.3-create-docsextension-pointsmd.md b/docs/content/stories/phase7/7.5.3-create-docsextension-pointsmd.md deleted file mode 100644 index 1114bb6..0000000 --- a/docs/content/stories/phase7/7.5.3-create-docsextension-pointsmd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.5.3: Create `docs/extension-points.md`: - -## Metadata -- **Task ID**: 7.5.3 -- **Title**: Create `docs/extension-points.md`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docs/extension-points.md`: - -## Requirements -- Create `docs/extension-points.md`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.5.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.5.4-create-docsapimd.md b/docs/content/stories/phase7/7.5.4-create-docsapimd.md deleted file mode 100644 index 151830d..0000000 --- a/docs/content/stories/phase7/7.5.4-create-docsapimd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.5.4: Create `docs/api.md`: - -## Metadata -- **Task ID**: 7.5.4 -- **Title**: Create `docs/api.md`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docs/api.md`: - -## Requirements -- Create `docs/api.md`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.5.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.5.5-create-docsoperationsmd.md b/docs/content/stories/phase7/7.5.5-create-docsoperationsmd.md deleted file mode 100644 index 0d8e532..0000000 --- a/docs/content/stories/phase7/7.5.5-create-docsoperationsmd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.5.5: Create `docs/operations.md`: - -## Metadata -- **Task ID**: 7.5.5 -- **Title**: Create `docs/operations.md`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docs/operations.md`: - -## Requirements -- Create `docs/operations.md`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.5.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.5.6-add-code-examples.md b/docs/content/stories/phase7/7.5.6-add-code-examples.md deleted file mode 100644 index 77639e2..0000000 --- a/docs/content/stories/phase7/7.5.6-add-code-examples.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.5.6: Add code examples: - -## Metadata -- **Task ID**: 7.5.6 -- **Title**: Add code examples: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add code examples: - -## Requirements -- Add code examples: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.5.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.6.1-update-githubworkflowsciyml.md b/docs/content/stories/phase7/7.6.1-update-githubworkflowsciyml.md deleted file mode 100644 index 30a0843..0000000 --- a/docs/content/stories/phase7/7.6.1-update-githubworkflowsciyml.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.6.1: Update `.github/workflows/ci.yml`: - -## Metadata -- **Task ID**: 7.6.1 -- **Title**: Update `.github/workflows/ci.yml`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Update `.github/workflows/ci.yml`: - -## Requirements -- Update `.github/workflows/ci.yml`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.6.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.6.2-add-release-workflow.md b/docs/content/stories/phase7/7.6.2-add-release-workflow.md deleted file mode 100644 index a147bc4..0000000 --- a/docs/content/stories/phase7/7.6.2-add-release-workflow.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.6.2: Add release workflow: - -## Metadata -- **Task ID**: 7.6.2 -- **Title**: Add release workflow: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add release workflow: - -## Requirements -- Add release workflow: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.6.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.6.3-add-security-scanning.md b/docs/content/stories/phase7/7.6.3-add-security-scanning.md deleted file mode 100644 index 018a266..0000000 --- a/docs/content/stories/phase7/7.6.3-add-security-scanning.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.6.3: Add security scanning: - -## Metadata -- **Task ID**: 7.6.3 -- **Title**: Add security scanning: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add security scanning: - -## Requirements -- Add security scanning: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.6.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.7.1-create-multi-stage-dockerfile.md b/docs/content/stories/phase7/7.7.1-create-multi-stage-dockerfile.md deleted file mode 100644 index b55fff8..0000000 --- a/docs/content/stories/phase7/7.7.1-create-multi-stage-dockerfile.md +++ /dev/null @@ -1,52 +0,0 @@ -# Task 7.7.1: Create multi-stage `Dockerfile`: - -## Metadata -- **Task ID**: 7.7.1 -- **Title**: Create multi-stage `Dockerfile`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create multi-stage `Dockerfile`: - -## Requirements -- Create multi-stage `Dockerfile`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.7.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -# Build stage - FROM golang:1.22-alpine AS builder - # ... build commands - - # Runtime stage - FROM gcr.io/distroless/static-debian12 - # ... copy binary -``` diff --git a/docs/content/stories/phase7/7.7.2-create-docker-composeyml-for-development.md b/docs/content/stories/phase7/7.7.2-create-docker-composeyml-for-development.md deleted file mode 100644 index 12ecd3f..0000000 --- a/docs/content/stories/phase7/7.7.2-create-docker-composeyml-for-development.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.7.2: Create `docker-compose.yml` for development: - -## Metadata -- **Task ID**: 7.7.2 -- **Title**: Create `docker-compose.yml` for development: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docker-compose.yml` for development: - -## Requirements -- Create `docker-compose.yml` for development: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.7.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.7.3-create-docker-composeprodyml-for-production.md b/docs/content/stories/phase7/7.7.3-create-docker-composeprodyml-for-production.md deleted file mode 100644 index d5e5c6a..0000000 --- a/docs/content/stories/phase7/7.7.3-create-docker-composeprodyml-for-production.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.7.3: Create `docker-compose.prod.yml` for production - -## Metadata -- **Task ID**: 7.7.3 -- **Title**: Create `docker-compose.prod.yml` for production -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docker-compose.prod.yml` for production - -## Requirements -- Create `docker-compose.prod.yml` for production - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.7.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.7.4-add-health-checks-to-dockerfile.md b/docs/content/stories/phase7/7.7.4-add-health-checks-to-dockerfile.md deleted file mode 100644 index 058533f..0000000 --- a/docs/content/stories/phase7/7.7.4-add-health-checks-to-dockerfile.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.7.4: Add health checks to Dockerfile - -## Metadata -- **Task ID**: 7.7.4 -- **Title**: Add health checks to Dockerfile -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add health checks to Dockerfile - -## Requirements -- Add health checks to Dockerfile - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.7.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.7.5-document-docker-usage-in-docsdeploymentmd.md b/docs/content/stories/phase7/7.7.5-document-docker-usage-in-docsdeploymentmd.md deleted file mode 100644 index d777df4..0000000 --- a/docs/content/stories/phase7/7.7.5-document-docker-usage-in-docsdeploymentmd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.7.5: Document Docker usage in `docs/deployment.md` - -## Metadata -- **Task ID**: 7.7.5 -- **Title**: Document Docker usage in `docs/deployment.md` -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Document Docker usage in `docs/deployment.md` - -## Requirements -- Document Docker usage in `docs/deployment.md` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.7.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.8.1-create-docsdeploymentkubernetesmd.md b/docs/content/stories/phase7/7.8.1-create-docsdeploymentkubernetesmd.md deleted file mode 100644 index 8026c72..0000000 --- a/docs/content/stories/phase7/7.8.1-create-docsdeploymentkubernetesmd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.8.1: Create `docs/deployment/kubernetes.md`: - -## Metadata -- **Task ID**: 7.8.1 -- **Title**: Create `docs/deployment/kubernetes.md`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docs/deployment/kubernetes.md`: - -## Requirements -- Create `docs/deployment/kubernetes.md`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.8.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.8.2-create-docsdeploymentdockermd.md b/docs/content/stories/phase7/7.8.2-create-docsdeploymentdockermd.md deleted file mode 100644 index 81fe93f..0000000 --- a/docs/content/stories/phase7/7.8.2-create-docsdeploymentdockermd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.8.2: Create `docs/deployment/docker.md`: - -## Metadata -- **Task ID**: 7.8.2 -- **Title**: Create `docs/deployment/docker.md`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docs/deployment/docker.md`: - -## Requirements -- Create `docs/deployment/docker.md`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.8.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.8.3-create-docsdeploymentcloudmd.md b/docs/content/stories/phase7/7.8.3-create-docsdeploymentcloudmd.md deleted file mode 100644 index 698ee84..0000000 --- a/docs/content/stories/phase7/7.8.3-create-docsdeploymentcloudmd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.8.3: Create `docs/deployment/cloud.md`: - -## Metadata -- **Task ID**: 7.8.3 -- **Title**: Create `docs/deployment/cloud.md`: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.8 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `docs/deployment/cloud.md`: - -## Requirements -- Create `docs/deployment/cloud.md`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.8.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.9.1-create-makefile-with-common-tasks.md b/docs/content/stories/phase7/7.9.1-create-makefile-with-common-tasks.md deleted file mode 100644 index 696e320..0000000 --- a/docs/content/stories/phase7/7.9.1-create-makefile-with-common-tasks.md +++ /dev/null @@ -1,51 +0,0 @@ -# Task 7.9.1: Create `Makefile` with common tasks: - -## Metadata -- **Task ID**: 7.9.1 -- **Title**: Create `Makefile` with common tasks: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.9 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `Makefile` with common tasks: - -## Requirements -- Create `Makefile` with common tasks: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.9.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - - -## Code Reference - -```go -make dev # Start dev environment - make test # Run tests - make lint # Run linters - make generate # Generate code - make docker-build # Build Docker image - make migrate # Run migrations -``` diff --git a/docs/content/stories/phase7/7.9.2-add-development-scripts.md b/docs/content/stories/phase7/7.9.2-add-development-scripts.md deleted file mode 100644 index 83a81b2..0000000 --- a/docs/content/stories/phase7/7.9.2-add-development-scripts.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.9.2: Add development scripts: - -## Metadata -- **Task ID**: 7.9.2 -- **Title**: Add development scripts: -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.9 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add development scripts: - -## Requirements -- Add development scripts: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.9.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.9.3-create-envexample-with-all-config-variables.md b/docs/content/stories/phase7/7.9.3-create-envexample-with-all-config-variables.md deleted file mode 100644 index 35ca006..0000000 --- a/docs/content/stories/phase7/7.9.3-create-envexample-with-all-config-variables.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.9.3: Create `.env.example` with all config variables - -## Metadata -- **Task ID**: 7.9.3 -- **Title**: Create `.env.example` with all config variables -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.9 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `.env.example` with all config variables - -## Requirements -- Create `.env.example` with all config variables - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.9.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/7.9.4-add-pre-commit-hooks-optional.md b/docs/content/stories/phase7/7.9.4-add-pre-commit-hooks-optional.md deleted file mode 100644 index 6a4fa4b..0000000 --- a/docs/content/stories/phase7/7.9.4-add-pre-commit-hooks-optional.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 7.9.4: Add pre-commit hooks (optional): - -## Metadata -- **Task ID**: 7.9.4 -- **Title**: Add pre-commit hooks (optional): -- **Phase**: 7 - Testing, Documentation & CI/CD -- **Section**: 7.9 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add pre-commit hooks (optional): - -## Requirements -- Add pre-commit hooks (optional): - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 7.9.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase7/README.md b/docs/content/stories/phase7/README.md index fa0939d..8b374c3 100644 --- a/docs/content/stories/phase7/README.md +++ b/docs/content/stories/phase7/README.md @@ -1,56 +1,42 @@ # Phase 7: Testing, Documentation & CI/CD ## Overview -Establish comprehensive testing strategy with unit, integration, and contract tests. Complete CI/CD pipeline, generate API documentation, and create deployment guides. +Comprehensive test coverage (unit, integration, contract), complete documentation, production-ready CI/CD pipeline, Docker images and deployment guides, and developer tooling. -## Tasks +## Stories -### 7.1 Unit Testing -- [7.1.1 - Achieve 80% Code Coverage](./7.1.1-achieve-80-code-coverage-for-core-modules.md) -- [7.1.2 - Use Testify for Assertions](./7.1.2-use-githubcomstretchrtestify-for-assertions.md) -- [7.1.3 - Use Mockery for Mocks](./7.1.3-use-githubcomgolangmock-or-mockery-for-mocks.md) -- [7.1.4 - Add Test Helpers](./7.1.4-add-test-helpers.md) +### 7.1 Comprehensive Testing Suite +- [Story: 7.1 - Testing Suite](./7.1-testing-suite.md) +- **Goal:** Achieve comprehensive test coverage with unit tests, integration tests, and contract tests. +- **Deliverables:** Unit tests (>80% coverage), integration tests, contract tests, load tests -### 7.2 Integration Testing -- [7.2.1 - Install Testcontainers](./7.2.1-install-githubcomtestcontainerstestcontainers-go.md) -- [7.2.2 - Create Integration Test Suite](./7.2.2-create-integration-test-suite.md) -- [7.2.3 - Test Scenarios](./7.2.3-test-scenarios.md) -- [7.2.4 - Create Docker Compose Test](./7.2.4-create-docker-composetestyml.md) -- [7.2.5 - Add Test Tags](./7.2.5-add-test-tags-gobuild-integration.md) +### 7.2 Complete Documentation +- [Story: 7.2 - Documentation](./7.2-documentation.md) +- **Goal:** Create comprehensive documentation covering architecture, API, operations, and developer guides. +- **Deliverables:** README, architecture docs, API docs, operations guides, code examples -### 7.3 Contract Testing -- [7.3.1 - Install Pact Go](./7.3.1-install-githubcompact-foundationpact-go-optional.md) -- [7.3.2 - Create Contract Tests](./7.3.2-create-contract-tests.md) +### 7.3 CI/CD Pipeline Enhancement +- [Story: 7.3 - CI/CD Enhancement](./7.3-cicd-enhancement.md) +- **Goal:** Enhance CI/CD pipeline with comprehensive testing, security scanning, and release automation. +- **Deliverables:** Enhanced CI pipeline, release workflow, security scanning -### 7.4 API Documentation -- [7.4.1 - Generate OpenAPI Spec](./7.4.1-generate-openapi-spec.md) -- [7.4.2 - Add Swagger UI](./7.4.2-add-swagger-ui.md) -- [7.4.3 - Document API Endpoints](./7.4.3-document-api-endpoints.md) - -### 7.5 CI/CD Pipeline -- [7.5.1 - Enhance GitHub Actions](./7.5.1-enhance-github-actions-workflow.md) -- [7.5.2 - Add Test Coverage Reporting](./7.5.2-add-test-coverage-reporting.md) -- [7.5.3 - Add Docker Image Building](./7.5.3-add-docker-image-building.md) -- [7.5.4 - Add Deployment Workflows](./7.5.4-add-deployment-workflows.md) - -### 7.6 Documentation -- [7.6.1 - Create Developer Guide](./7.6.1-create-developer-guide.md) -- [7.6.2 - Create Deployment Guide](./7.6.2-create-deployment-guide.md) -- [7.6.3 - Create Module Development Guide](./7.6.3-create-module-development-guide.md) +### 7.4 Docker and Deployment +- [Story: 7.4 - Docker & Deployment](./7.4-docker-deployment.md) +- **Goal:** Create production-ready Docker images and comprehensive deployment guides. +- **Deliverables:** Docker images, Docker Compose, deployment guides, developer tooling ## Deliverables Checklist -- [ ] Unit tests achieve 80% coverage -- [ ] Integration tests with testcontainers -- [ ] Contract tests for API -- [ ] OpenAPI documentation generated -- [ ] CI/CD pipeline complete -- [ ] Comprehensive documentation +- [ ] >80% test coverage +- [ ] Integration test suite +- [ ] Complete documentation +- [ ] Production CI/CD pipeline +- [ ] Docker images and deployment guides +- [ ] Developer tooling and scripts ## Acceptance Criteria -- `make test` runs all tests -- `make test-integration` runs integration tests -- CI pipeline passes on all PRs -- API documentation is up-to-date -- Deployment guides are complete -- Code coverage reports are generated - +- All tests pass in CI +- Code coverage >80% +- Documentation is complete and accurate +- Docker images build and run successfully +- Deployment guides are tested +- New developers can set up environment in <30 minutes diff --git a/docs/content/stories/phase8/8.1-oidc-support.md b/docs/content/stories/phase8/8.1-oidc-support.md new file mode 100644 index 0000000..aadbbfe --- /dev/null +++ b/docs/content/stories/phase8/8.1-oidc-support.md @@ -0,0 +1,47 @@ +# Story 8.1: OpenID Connect (OIDC) Support + +## Metadata +- **Story ID**: 8.1 +- **Title**: OpenID Connect (OIDC) Support +- **Phase**: 8 - Advanced Features & Polish +- **Status**: Pending +- **Priority**: Low +- **Estimated Time**: 6-8 hours +- **Dependencies**: 2.1 + +## Goal +Add OpenID Connect (OIDC) support for external identity providers and OIDC provider capabilities. + +## Description +This story implements OIDC client support for validating tokens from external IdPs and optional OIDC provider functionality. + +## Deliverables + +### 1. OIDC Client Support +- Install `github.com/coreos/go-oidc` +- Validate tokens from external IdP +- Map claims to internal user +- Integration with authentication system + +### 2. OIDC Provider (Optional) +- Discovery endpoint +- JWKS endpoint +- Token endpoint +- UserInfo endpoint + +### 3. Documentation +- Document OIDC setup in `docs/auth.md` +- Configuration examples +- Integration guide + +## Acceptance Criteria +- [ ] OIDC client validates external tokens +- [ ] Claims are mapped to internal users +- [ ] OIDC provider works (if implemented) +- [ ] Documentation is complete + +## Files to Create/Modify +- `internal/auth/oidc_client.go` - OIDC client +- `internal/auth/oidc_provider.go` - OIDC provider (optional) +- `docs/auth.md` - OIDC documentation + diff --git a/docs/content/stories/phase8/8.1.1-install-githubcomcoreosgo-oidc.md b/docs/content/stories/phase8/8.1.1-install-githubcomcoreosgo-oidc.md deleted file mode 100644 index a87728d..0000000 --- a/docs/content/stories/phase8/8.1.1-install-githubcomcoreosgo-oidc.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.1.1: Install `github.com/coreos/go-oidc` - -## Metadata -- **Task ID**: 8.1.1 -- **Title**: Install `github.com/coreos/go-oidc` -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/coreos/go-oidc` - -## Requirements -- Install `github.com/coreos/go-oidc` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.1.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.1.2-implement-oidc-provider.md b/docs/content/stories/phase8/8.1.2-implement-oidc-provider.md deleted file mode 100644 index 9916516..0000000 --- a/docs/content/stories/phase8/8.1.2-implement-oidc-provider.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.1.2: Implement OIDC provider: - -## Metadata -- **Task ID**: 8.1.2 -- **Title**: Implement OIDC provider: -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement OIDC provider: - -## Requirements -- Implement OIDC provider: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.1.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.1.3-add-oidc-client-support.md b/docs/content/stories/phase8/8.1.3-add-oidc-client-support.md deleted file mode 100644 index 7468336..0000000 --- a/docs/content/stories/phase8/8.1.3-add-oidc-client-support.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.1.3: Add OIDC client support: - -## Metadata -- **Task ID**: 8.1.3 -- **Title**: Add OIDC client support: -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add OIDC client support: - -## Requirements -- Add OIDC client support: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.1.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.1.4-document-oidc-setup-in-docsauthmd.md b/docs/content/stories/phase8/8.1.4-document-oidc-setup-in-docsauthmd.md deleted file mode 100644 index 00873b4..0000000 --- a/docs/content/stories/phase8/8.1.4-document-oidc-setup-in-docsauthmd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.1.4: Document OIDC setup in `docs/auth.md` - -## Metadata -- **Task ID**: 8.1.4 -- **Title**: Document OIDC setup in `docs/auth.md` -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.1 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Document OIDC setup in `docs/auth.md` - -## Requirements -- Document OIDC setup in `docs/auth.md` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.1.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.2-graphql-api.md b/docs/content/stories/phase8/8.2-graphql-api.md new file mode 100644 index 0000000..852cee6 --- /dev/null +++ b/docs/content/stories/phase8/8.2-graphql-api.md @@ -0,0 +1,50 @@ +# Story 8.2: GraphQL API + +## Metadata +- **Story ID**: 8.2 +- **Title**: GraphQL API +- **Phase**: 8 - Advanced Features & Polish +- **Status**: Pending +- **Priority**: Low +- **Estimated Time**: 8-10 hours +- **Dependencies**: 1.5, 2.1, 4.1 + +## Goal +Add optional GraphQL API alongside REST API for flexible data querying. + +## Description +This story implements a GraphQL API using gqlgen that provides an alternative to REST endpoints with flexible querying capabilities. + +## Deliverables + +### 1. GraphQL Schema +- Install `github.com/99designs/gqlgen` +- Create GraphQL schema: + - User queries + - Blog queries + - Mutations + - Subscriptions (optional) + +### 2. GraphQL Resolvers +- Implement resolvers: + - Use existing services + - Add authorization checks + - Error handling + +### 3. GraphQL Endpoint +- Add GraphQL endpoint: `POST /graphql` +- GraphQL playground: `GET /graphql` (development) +- Integration with authentication + +## Acceptance Criteria +- [ ] GraphQL schema is defined +- [ ] Resolvers work correctly +- [ ] Authorization is enforced +- [ ] GraphQL endpoint works +- [ ] GraphQL playground works (dev) + +## Files to Create/Modify +- `api/graphql/schema.graphql` - GraphQL schema +- `internal/api/graphql/resolvers.go` - Resolvers +- `internal/server/routes.go` - Add GraphQL route + diff --git a/docs/content/stories/phase8/8.2.1-install-githubcom99designsgqlgen.md b/docs/content/stories/phase8/8.2.1-install-githubcom99designsgqlgen.md deleted file mode 100644 index f7c806c..0000000 --- a/docs/content/stories/phase8/8.2.1-install-githubcom99designsgqlgen.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.2.1: Install `github.com/99designs/gqlgen` - -## Metadata -- **Task ID**: 8.2.1 -- **Title**: Install `github.com/99designs/gqlgen` -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install `github.com/99designs/gqlgen` - -## Requirements -- Install `github.com/99designs/gqlgen` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.2.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.2.2-create-graphql-schema.md b/docs/content/stories/phase8/8.2.2-create-graphql-schema.md deleted file mode 100644 index 63eff7f..0000000 --- a/docs/content/stories/phase8/8.2.2-create-graphql-schema.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.2.2: Create GraphQL schema: - -## Metadata -- **Task ID**: 8.2.2 -- **Title**: Create GraphQL schema: -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create GraphQL schema: - -## Requirements -- Create GraphQL schema: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.2.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.2.3-implement-resolvers.md b/docs/content/stories/phase8/8.2.3-implement-resolvers.md deleted file mode 100644 index 75d831d..0000000 --- a/docs/content/stories/phase8/8.2.3-implement-resolvers.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.2.3: Implement resolvers: - -## Metadata -- **Task ID**: 8.2.3 -- **Title**: Implement resolvers: -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement resolvers: - -## Requirements -- Implement resolvers: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.2.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.2.4-add-graphql-endpoint-post-graphql.md b/docs/content/stories/phase8/8.2.4-add-graphql-endpoint-post-graphql.md deleted file mode 100644 index b781948..0000000 --- a/docs/content/stories/phase8/8.2.4-add-graphql-endpoint-post-graphql.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.2.4: Add GraphQL endpoint: `POST /graphql` - -## Metadata -- **Task ID**: 8.2.4 -- **Title**: Add GraphQL endpoint: `POST /graphql` -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.2 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add GraphQL endpoint: `POST /graphql` - -## Requirements -- Add GraphQL endpoint: `POST /graphql` - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.2.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.3-additional-modules.md b/docs/content/stories/phase8/8.3-additional-modules.md new file mode 100644 index 0000000..34cf8d8 --- /dev/null +++ b/docs/content/stories/phase8/8.3-additional-modules.md @@ -0,0 +1,42 @@ +# Story 8.3: Additional Sample Modules + +## Metadata +- **Story ID**: 8.3 +- **Title**: Additional Sample Modules +- **Phase**: 8 - Advanced Features & Polish +- **Status**: Pending +- **Priority**: Low +- **Estimated Time**: 10-12 hours +- **Dependencies**: 4.1 + +## Goal +Create additional sample modules to demonstrate different use cases and patterns. + +## Description +This story creates additional sample modules (notification, analytics) to show different module patterns and use cases. + +## Deliverables + +### 1. Notification Module +- Create `modules/notification/`: + - Email templates + - Notification preferences + - Notification history + - Notification API + +### 2. Analytics Module +- Create `modules/analytics/`: + - Event tracking + - Analytics dashboard API + - Export functionality + +## Acceptance Criteria +- [ ] Notification module works +- [ ] Analytics module works +- [ ] Modules demonstrate different patterns +- [ ] Modules are well-documented + +## Files to Create/Modify +- `modules/notification/` - Notification module +- `modules/analytics/` - Analytics module + diff --git a/docs/content/stories/phase8/8.3.1-add-requestresponse-transformation.md b/docs/content/stories/phase8/8.3.1-add-requestresponse-transformation.md deleted file mode 100644 index a1d0a2b..0000000 --- a/docs/content/stories/phase8/8.3.1-add-requestresponse-transformation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.3.1: Add request/response transformation - -## Metadata -- **Task ID**: 8.3.1 -- **Title**: Add request/response transformation -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add request/response transformation - -## Requirements -- Add request/response transformation - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.3.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.3.2-add-api-key-authentication.md b/docs/content/stories/phase8/8.3.2-add-api-key-authentication.md deleted file mode 100644 index e5da549..0000000 --- a/docs/content/stories/phase8/8.3.2-add-api-key-authentication.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.3.2: Add API key authentication - -## Metadata -- **Task ID**: 8.3.2 -- **Title**: Add API key authentication -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add API key authentication - -## Requirements -- Add API key authentication - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.3.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.3.3-add-request-routing-rules.md b/docs/content/stories/phase8/8.3.3-add-request-routing-rules.md deleted file mode 100644 index e074e2f..0000000 --- a/docs/content/stories/phase8/8.3.3-add-request-routing-rules.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.3.3: Add request routing rules - -## Metadata -- **Task ID**: 8.3.3 -- **Title**: Add request routing rules -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add request routing rules - -## Requirements -- Add request routing rules - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.3.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.3.4-add-api-versioning-support.md b/docs/content/stories/phase8/8.3.4-add-api-versioning-support.md deleted file mode 100644 index 79a811b..0000000 --- a/docs/content/stories/phase8/8.3.4-add-api-versioning-support.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.3.4: Add API versioning support - -## Metadata -- **Task ID**: 8.3.4 -- **Title**: Add API versioning support -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.3 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add API versioning support - -## Requirements -- Add API versioning support - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.3.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.4-final-polish.md b/docs/content/stories/phase8/8.4-final-polish.md new file mode 100644 index 0000000..f7d79e9 --- /dev/null +++ b/docs/content/stories/phase8/8.4-final-polish.md @@ -0,0 +1,63 @@ +# Story 8.4: Final Polish and Optimization + +## Metadata +- **Story ID**: 8.4 +- **Title**: Final Polish and Optimization +- **Phase**: 8 - Advanced Features & Polish +- **Status**: Pending +- **Priority**: Medium +- **Estimated Time**: 8-10 hours +- **Dependencies**: All previous phases + +## Goal +Final polish, bug fixes, performance optimization, and security audit. + +## Description +This story covers final polish including code review, refactoring, bug fixes, performance profiling, security audit, and documentation review. + +## Deliverables + +### 1. Code Review and Refactoring +- Code review of all modules +- Refactor for consistency +- Improve code quality +- Remove dead code + +### 2. Bug Fixes +- Fix identified bugs +- Address technical debt +- Improve error handling + +### 3. Performance Profiling +- Profile critical paths +- Optimize bottlenecks +- Add database query caching +- Optimize N+1 queries +- Add response caching (Redis) +- Implement connection pooling optimizations +- Add database read replicas support + +### 4. Security Audit +- Security review +- Fix security issues +- Update dependencies +- Security best practices + +### 5. Documentation Review +- Review all documentation +- Update outdated docs +- Add missing documentation +- Improve examples + +## Acceptance Criteria +- [ ] Code quality is high +- [ ] Bugs are fixed +- [ ] Performance is optimized +- [ ] Security audit passes +- [ ] Documentation is complete + +## Files to Create/Modify +- All code files (refactoring) +- Documentation files (review) +- Performance optimizations + diff --git a/docs/content/stories/phase8/8.4.1-create-modulesnotification.md b/docs/content/stories/phase8/8.4.1-create-modulesnotification.md deleted file mode 100644 index 84f3079..0000000 --- a/docs/content/stories/phase8/8.4.1-create-modulesnotification.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.4.1: Create `modules/notification/`: - -## Metadata -- **Task ID**: 8.4.1 -- **Title**: Create `modules/notification/`: -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `modules/notification/`: - -## Requirements -- Create `modules/notification/`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.4.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.4.2-create-modulesanalytics.md b/docs/content/stories/phase8/8.4.2-create-modulesanalytics.md deleted file mode 100644 index 6e6beab..0000000 --- a/docs/content/stories/phase8/8.4.2-create-modulesanalytics.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.4.2: Create `modules/analytics/`: - -## Metadata -- **Task ID**: 8.4.2 -- **Title**: Create `modules/analytics/`: -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.4 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create `modules/analytics/`: - -## Requirements -- Create `modules/analytics/`: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.4.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.5.1-add-database-query-caching.md b/docs/content/stories/phase8/8.5.1-add-database-query-caching.md deleted file mode 100644 index d27b158..0000000 --- a/docs/content/stories/phase8/8.5.1-add-database-query-caching.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.5.1: Add database query caching - -## Metadata -- **Task ID**: 8.5.1 -- **Title**: Add database query caching -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add database query caching - -## Requirements -- Add database query caching - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.5.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.5.2-optimize-n1-queries.md b/docs/content/stories/phase8/8.5.2-optimize-n1-queries.md deleted file mode 100644 index 56ed6b5..0000000 --- a/docs/content/stories/phase8/8.5.2-optimize-n1-queries.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.5.2: Optimize N+1 queries - -## Metadata -- **Task ID**: 8.5.2 -- **Title**: Optimize N+1 queries -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Optimize N+1 queries - -## Requirements -- Optimize N+1 queries - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.5.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.5.3-add-response-caching-redis.md b/docs/content/stories/phase8/8.5.3-add-response-caching-redis.md deleted file mode 100644 index a0e1a4c..0000000 --- a/docs/content/stories/phase8/8.5.3-add-response-caching-redis.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.5.3: Add response caching (Redis) - -## Metadata -- **Task ID**: 8.5.3 -- **Title**: Add response caching (Redis) -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add response caching (Redis) - -## Requirements -- Add response caching (Redis) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.5.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.5.4-implement-connection-pooling-optimizations.md b/docs/content/stories/phase8/8.5.4-implement-connection-pooling-optimizations.md deleted file mode 100644 index 4b9a603..0000000 --- a/docs/content/stories/phase8/8.5.4-implement-connection-pooling-optimizations.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.5.4: Implement connection pooling optimizations - -## Metadata -- **Task ID**: 8.5.4 -- **Title**: Implement connection pooling optimizations -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Implement connection pooling optimizations - -## Requirements -- Implement connection pooling optimizations - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.5.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.5.5-add-database-read-replicas-support.md b/docs/content/stories/phase8/8.5.5-add-database-read-replicas-support.md deleted file mode 100644 index 546a485..0000000 --- a/docs/content/stories/phase8/8.5.5-add-database-read-replicas-support.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.5.5: Add database read replicas support - -## Metadata -- **Task ID**: 8.5.5 -- **Title**: Add database read replicas support -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.5 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add database read replicas support - -## Requirements -- Add database read replicas support - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.5.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.6.1-install-i18n-library.md b/docs/content/stories/phase8/8.6.1-install-i18n-library.md deleted file mode 100644 index 2f08702..0000000 --- a/docs/content/stories/phase8/8.6.1-install-i18n-library.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.6.1: Install i18n library - -## Metadata -- **Task ID**: 8.6.1 -- **Title**: Install i18n library -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Install i18n library - -## Requirements -- Install i18n library - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.6.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.6.2-add-locale-detection.md b/docs/content/stories/phase8/8.6.2-add-locale-detection.md deleted file mode 100644 index 9b6d99c..0000000 --- a/docs/content/stories/phase8/8.6.2-add-locale-detection.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.6.2: Add locale detection: - -## Metadata -- **Task ID**: 8.6.2 -- **Title**: Add locale detection: -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add locale detection: - -## Requirements -- Add locale detection: - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.6.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.6.3-create-message-catalogs.md b/docs/content/stories/phase8/8.6.3-create-message-catalogs.md deleted file mode 100644 index 09a85e1..0000000 --- a/docs/content/stories/phase8/8.6.3-create-message-catalogs.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.6.3: Create message catalogs - -## Metadata -- **Task ID**: 8.6.3 -- **Title**: Create message catalogs -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Create message catalogs - -## Requirements -- Create message catalogs - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.6.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.6.4-add-translation-support-for-error-messages.md b/docs/content/stories/phase8/8.6.4-add-translation-support-for-error-messages.md deleted file mode 100644 index 5e527c3..0000000 --- a/docs/content/stories/phase8/8.6.4-add-translation-support-for-error-messages.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.6.4: Add translation support for error messages - -## Metadata -- **Task ID**: 8.6.4 -- **Title**: Add translation support for error messages -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.6 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Add translation support for error messages - -## Requirements -- Add translation support for error messages - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.6.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.1-code-review-and-refactoring.md b/docs/content/stories/phase8/8.7.1-code-review-and-refactoring.md deleted file mode 100644 index 1d28157..0000000 --- a/docs/content/stories/phase8/8.7.1-code-review-and-refactoring.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.1: Code review and refactoring - -## Metadata -- **Task ID**: 8.7.1 -- **Title**: Code review and refactoring -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Code review and refactoring - -## Requirements -- Code review and refactoring - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.1 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.10-di-setup.md b/docs/content/stories/phase8/8.7.10-di-setup.md deleted file mode 100644 index 0304136..0000000 --- a/docs/content/stories/phase8/8.7.10-di-setup.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.10: DI setup - -## Metadata -- **Task ID**: 8.7.10 -- **Title**: DI setup -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -DI setup - -## Requirements -- DI setup - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.10 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.11-di-container.md b/docs/content/stories/phase8/8.7.11-di-container.md deleted file mode 100644 index 7c43f6a..0000000 --- a/docs/content/stories/phase8/8.7.11-di-container.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.11: DI container - -## Metadata -- **Task ID**: 8.7.11 -- **Title**: DI container -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -DI container - -## Requirements -- DI container - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.11 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.12-database-ent.md b/docs/content/stories/phase8/8.7.12-database-ent.md deleted file mode 100644 index 5ebce7c..0000000 --- a/docs/content/stories/phase8/8.7.12-database-ent.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.12: Database (Ent) - -## Metadata -- **Task ID**: 8.7.12 -- **Title**: Database (Ent) -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Database (Ent) - -## Requirements -- Database (Ent) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.12 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.13-health--metrics.md b/docs/content/stories/phase8/8.7.13-health--metrics.md deleted file mode 100644 index 4e0eaeb..0000000 --- a/docs/content/stories/phase8/8.7.13-health--metrics.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.13: Health & metrics - -## Metadata -- **Task ID**: 8.7.13 -- **Title**: Health & metrics -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Health & metrics - -## Requirements -- Health & metrics - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.13 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.14-error-bus.md b/docs/content/stories/phase8/8.7.14-error-bus.md deleted file mode 100644 index fa5f152..0000000 --- a/docs/content/stories/phase8/8.7.14-error-bus.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.14: Error bus - -## Metadata -- **Task ID**: 8.7.14 -- **Title**: Error bus -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Error bus - -## Requirements -- Error bus - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.14 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.15-http-server.md b/docs/content/stories/phase8/8.7.15-http-server.md deleted file mode 100644 index f816a16..0000000 --- a/docs/content/stories/phase8/8.7.15-http-server.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.15: HTTP server - -## Metadata -- **Task ID**: 8.7.15 -- **Title**: HTTP server -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -HTTP server - -## Requirements -- HTTP server - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.15 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.16-opentelemetry.md b/docs/content/stories/phase8/8.7.16-opentelemetry.md deleted file mode 100644 index 1f34d60..0000000 --- a/docs/content/stories/phase8/8.7.16-opentelemetry.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.16: OpenTelemetry - -## Metadata -- **Task ID**: 8.7.16 -- **Title**: OpenTelemetry -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -OpenTelemetry - -## Requirements -- OpenTelemetry - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.16 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.17-jwt-authentication.md b/docs/content/stories/phase8/8.7.17-jwt-authentication.md deleted file mode 100644 index b427202..0000000 --- a/docs/content/stories/phase8/8.7.17-jwt-authentication.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.17: JWT authentication - -## Metadata -- **Task ID**: 8.7.17 -- **Title**: JWT authentication -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -JWT authentication - -## Requirements -- JWT authentication - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.17 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.18-identity-management.md b/docs/content/stories/phase8/8.7.18-identity-management.md deleted file mode 100644 index 12e0e2e..0000000 --- a/docs/content/stories/phase8/8.7.18-identity-management.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.18: Identity management - -## Metadata -- **Task ID**: 8.7.18 -- **Title**: Identity management -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Identity management - -## Requirements -- Identity management - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.18 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.19-roles--permissions.md b/docs/content/stories/phase8/8.7.19-roles--permissions.md deleted file mode 100644 index 02b8b74..0000000 --- a/docs/content/stories/phase8/8.7.19-roles--permissions.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.19: Roles & permissions - -## Metadata -- **Task ID**: 8.7.19 -- **Title**: Roles & permissions -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Roles & permissions - -## Requirements -- Roles & permissions - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.19 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.2-bug-fixes.md b/docs/content/stories/phase8/8.7.2-bug-fixes.md deleted file mode 100644 index 4148103..0000000 --- a/docs/content/stories/phase8/8.7.2-bug-fixes.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.2: Bug fixes - -## Metadata -- **Task ID**: 8.7.2 -- **Title**: Bug fixes -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Bug fixes - -## Requirements -- Bug fixes - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.2 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.20-authorization-middleware.md b/docs/content/stories/phase8/8.7.20-authorization-middleware.md deleted file mode 100644 index cd6fcc2..0000000 --- a/docs/content/stories/phase8/8.7.20-authorization-middleware.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.20: Authorization middleware - -## Metadata -- **Task ID**: 8.7.20 -- **Title**: Authorization middleware -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Authorization middleware - -## Requirements -- Authorization middleware - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.20 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.21-audit-logging.md b/docs/content/stories/phase8/8.7.21-audit-logging.md deleted file mode 100644 index fc498e6..0000000 --- a/docs/content/stories/phase8/8.7.21-audit-logging.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.21: Audit logging - -## Metadata -- **Task ID**: 8.7.21 -- **Title**: Audit logging -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Audit logging - -## Requirements -- Audit logging - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.21 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.22-module-interface.md b/docs/content/stories/phase8/8.7.22-module-interface.md deleted file mode 100644 index 01295be..0000000 --- a/docs/content/stories/phase8/8.7.22-module-interface.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.22: Module interface - -## Metadata -- **Task ID**: 8.7.22 -- **Title**: Module interface -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Module interface - -## Requirements -- Module interface - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.22 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.23-static-registry.md b/docs/content/stories/phase8/8.7.23-static-registry.md deleted file mode 100644 index cce42e4..0000000 --- a/docs/content/stories/phase8/8.7.23-static-registry.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.23: Static registry - -## Metadata -- **Task ID**: 8.7.23 -- **Title**: Static registry -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Static registry - -## Requirements -- Static registry - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.23 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.24-permission-generation.md b/docs/content/stories/phase8/8.7.24-permission-generation.md deleted file mode 100644 index 7fe2a9e..0000000 --- a/docs/content/stories/phase8/8.7.24-permission-generation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.24: Permission generation - -## Metadata -- **Task ID**: 8.7.24 -- **Title**: Permission generation -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Permission generation - -## Requirements -- Permission generation - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.24 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.25-module-loader.md b/docs/content/stories/phase8/8.7.25-module-loader.md deleted file mode 100644 index c9e799d..0000000 --- a/docs/content/stories/phase8/8.7.25-module-loader.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.25: Module loader - -## Metadata -- **Task ID**: 8.7.25 -- **Title**: Module loader -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Module loader - -## Requirements -- Module loader - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.25 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.26-module-initialization.md b/docs/content/stories/phase8/8.7.26-module-initialization.md deleted file mode 100644 index 2ee74bb..0000000 --- a/docs/content/stories/phase8/8.7.26-module-initialization.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.26: Module initialization - -## Metadata -- **Task ID**: 8.7.26 -- **Title**: Module initialization -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Module initialization - -## Requirements -- Module initialization - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.26 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.27-blog-module-structure.md b/docs/content/stories/phase8/8.7.27-blog-module-structure.md deleted file mode 100644 index 051358c..0000000 --- a/docs/content/stories/phase8/8.7.27-blog-module-structure.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.27: Blog module structure - -## Metadata -- **Task ID**: 8.7.27 -- **Title**: Blog module structure -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Blog module structure - -## Requirements -- Blog module structure - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.27 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.28-domain-model.md b/docs/content/stories/phase8/8.7.28-domain-model.md deleted file mode 100644 index fc5cc49..0000000 --- a/docs/content/stories/phase8/8.7.28-domain-model.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.28: Domain model - -## Metadata -- **Task ID**: 8.7.28 -- **Title**: Domain model -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Domain model - -## Requirements -- Domain model - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.28 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.29-repository--service.md b/docs/content/stories/phase8/8.7.29-repository--service.md deleted file mode 100644 index a6921c1..0000000 --- a/docs/content/stories/phase8/8.7.29-repository--service.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.29: Repository & service - -## Metadata -- **Task ID**: 8.7.29 -- **Title**: Repository & service -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Repository & service - -## Requirements -- Repository & service - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.29 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.3-performance-profiling.md b/docs/content/stories/phase8/8.7.3-performance-profiling.md deleted file mode 100644 index b1f03ad..0000000 --- a/docs/content/stories/phase8/8.7.3-performance-profiling.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.3: Performance profiling - -## Metadata -- **Task ID**: 8.7.3 -- **Title**: Performance profiling -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Performance profiling - -## Requirements -- Performance profiling - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.3 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.30-api-handlers.md b/docs/content/stories/phase8/8.7.30-api-handlers.md deleted file mode 100644 index 7cd7af5..0000000 --- a/docs/content/stories/phase8/8.7.30-api-handlers.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.30: API handlers - -## Metadata -- **Task ID**: 8.7.30 -- **Title**: API handlers -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -API handlers - -## Requirements -- API handlers - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.30 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.31-integration-tests.md b/docs/content/stories/phase8/8.7.31-integration-tests.md deleted file mode 100644 index e52c5db..0000000 --- a/docs/content/stories/phase8/8.7.31-integration-tests.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.31: Integration tests - -## Metadata -- **Task ID**: 8.7.31 -- **Title**: Integration tests -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Integration tests - -## Requirements -- Integration tests - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.31 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.32-cache-redis.md b/docs/content/stories/phase8/8.7.32-cache-redis.md deleted file mode 100644 index cc1f5a9..0000000 --- a/docs/content/stories/phase8/8.7.32-cache-redis.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.32: Cache (Redis) - -## Metadata -- **Task ID**: 8.7.32 -- **Title**: Cache (Redis) -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Cache (Redis) - -## Requirements -- Cache (Redis) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.32 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.33-event-bus.md b/docs/content/stories/phase8/8.7.33-event-bus.md deleted file mode 100644 index abc3ea8..0000000 --- a/docs/content/stories/phase8/8.7.33-event-bus.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.33: Event bus - -## Metadata -- **Task ID**: 8.7.33 -- **Title**: Event bus -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Event bus - -## Requirements -- Event bus - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.33 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.34-blob-storage.md b/docs/content/stories/phase8/8.7.34-blob-storage.md deleted file mode 100644 index 73b899f..0000000 --- a/docs/content/stories/phase8/8.7.34-blob-storage.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.34: Blob storage - -## Metadata -- **Task ID**: 8.7.34 -- **Title**: Blob storage -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Blob storage - -## Requirements -- Blob storage - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.34 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.35-email-notification.md b/docs/content/stories/phase8/8.7.35-email-notification.md deleted file mode 100644 index 781f881..0000000 --- a/docs/content/stories/phase8/8.7.35-email-notification.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.35: Email notification - -## Metadata -- **Task ID**: 8.7.35 -- **Title**: Email notification -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Email notification - -## Requirements -- Email notification - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.35 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.36-schedulerjobs.md b/docs/content/stories/phase8/8.7.36-schedulerjobs.md deleted file mode 100644 index bd5e52d..0000000 --- a/docs/content/stories/phase8/8.7.36-schedulerjobs.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.36: Scheduler/jobs - -## Metadata -- **Task ID**: 8.7.36 -- **Title**: Scheduler/jobs -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Scheduler/jobs - -## Requirements -- Scheduler/jobs - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.36 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.37-multi-tenancy-optional.md b/docs/content/stories/phase8/8.7.37-multi-tenancy-optional.md deleted file mode 100644 index 3476ae9..0000000 --- a/docs/content/stories/phase8/8.7.37-multi-tenancy-optional.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.37: Multi-tenancy (optional) - -## Metadata -- **Task ID**: 8.7.37 -- **Title**: Multi-tenancy (optional) -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Multi-tenancy (optional) - -## Requirements -- Multi-tenancy (optional) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.37 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.38-opentelemetry.md b/docs/content/stories/phase8/8.7.38-opentelemetry.md deleted file mode 100644 index c57fba2..0000000 --- a/docs/content/stories/phase8/8.7.38-opentelemetry.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.38: OpenTelemetry - -## Metadata -- **Task ID**: 8.7.38 -- **Title**: OpenTelemetry -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -OpenTelemetry - -## Requirements -- OpenTelemetry - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.38 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.39-sentry-integration.md b/docs/content/stories/phase8/8.7.39-sentry-integration.md deleted file mode 100644 index 536293b..0000000 --- a/docs/content/stories/phase8/8.7.39-sentry-integration.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.39: Sentry integration - -## Metadata -- **Task ID**: 8.7.39 -- **Title**: Sentry integration -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Sentry integration - -## Requirements -- Sentry integration - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.39 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.4-security-audit.md b/docs/content/stories/phase8/8.7.4-security-audit.md deleted file mode 100644 index 8faaf14..0000000 --- a/docs/content/stories/phase8/8.7.4-security-audit.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.4: Security audit - -## Metadata -- **Task ID**: 8.7.4 -- **Title**: Security audit -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Security audit - -## Requirements -- Security audit - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.4 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.40-enhanced-logging.md b/docs/content/stories/phase8/8.7.40-enhanced-logging.md deleted file mode 100644 index 917eeb6..0000000 --- a/docs/content/stories/phase8/8.7.40-enhanced-logging.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.40: Enhanced logging - -## Metadata -- **Task ID**: 8.7.40 -- **Title**: Enhanced logging -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Enhanced logging - -## Requirements -- Enhanced logging - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.40 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.41-prometheus-metrics.md b/docs/content/stories/phase8/8.7.41-prometheus-metrics.md deleted file mode 100644 index a11bf75..0000000 --- a/docs/content/stories/phase8/8.7.41-prometheus-metrics.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.41: Prometheus metrics - -## Metadata -- **Task ID**: 8.7.41 -- **Title**: Prometheus metrics -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Prometheus metrics - -## Requirements -- Prometheus metrics - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.41 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.42-grafana-dashboards.md b/docs/content/stories/phase8/8.7.42-grafana-dashboards.md deleted file mode 100644 index 7cb5e38..0000000 --- a/docs/content/stories/phase8/8.7.42-grafana-dashboards.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.42: Grafana dashboards - -## Metadata -- **Task ID**: 8.7.42 -- **Title**: Grafana dashboards -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Grafana dashboards - -## Requirements -- Grafana dashboards - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.42 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.43-rate-limiting.md b/docs/content/stories/phase8/8.7.43-rate-limiting.md deleted file mode 100644 index 9f9c5b9..0000000 --- a/docs/content/stories/phase8/8.7.43-rate-limiting.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.43: Rate limiting - -## Metadata -- **Task ID**: 8.7.43 -- **Title**: Rate limiting -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Rate limiting - -## Requirements -- Rate limiting - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.43 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.44-security-hardening.md b/docs/content/stories/phase8/8.7.44-security-hardening.md deleted file mode 100644 index 0f9c0c7..0000000 --- a/docs/content/stories/phase8/8.7.44-security-hardening.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.44: Security hardening - -## Metadata -- **Task ID**: 8.7.44 -- **Title**: Security hardening -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Security hardening - -## Requirements -- Security hardening - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.44 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.45-unit-tests-80-coverage.md b/docs/content/stories/phase8/8.7.45-unit-tests-80-coverage.md deleted file mode 100644 index ceb608c..0000000 --- a/docs/content/stories/phase8/8.7.45-unit-tests-80-coverage.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.45: Unit tests (>80% coverage) - -## Metadata -- **Task ID**: 8.7.45 -- **Title**: Unit tests (>80% coverage) -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Unit tests (>80% coverage) - -## Requirements -- Unit tests (>80% coverage) - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.45 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.46-integration-tests.md b/docs/content/stories/phase8/8.7.46-integration-tests.md deleted file mode 100644 index 31ea61d..0000000 --- a/docs/content/stories/phase8/8.7.46-integration-tests.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.46: Integration tests - -## Metadata -- **Task ID**: 8.7.46 -- **Title**: Integration tests -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Integration tests - -## Requirements -- Integration tests - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.46 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.47-documentation.md b/docs/content/stories/phase8/8.7.47-documentation.md deleted file mode 100644 index 06cf4c2..0000000 --- a/docs/content/stories/phase8/8.7.47-documentation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.47: Documentation - -## Metadata -- **Task ID**: 8.7.47 -- **Title**: Documentation -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Documentation - -## Requirements -- Documentation - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.47 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.48-cicd-pipeline.md b/docs/content/stories/phase8/8.7.48-cicd-pipeline.md deleted file mode 100644 index 9f799ac..0000000 --- a/docs/content/stories/phase8/8.7.48-cicd-pipeline.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.48: CI/CD pipeline - -## Metadata -- **Task ID**: 8.7.48 -- **Title**: CI/CD pipeline -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -CI/CD pipeline - -## Requirements -- CI/CD pipeline - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.48 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.49-docker-images.md b/docs/content/stories/phase8/8.7.49-docker-images.md deleted file mode 100644 index b216214..0000000 --- a/docs/content/stories/phase8/8.7.49-docker-images.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.49: Docker images - -## Metadata -- **Task ID**: 8.7.49 -- **Title**: Docker images -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Docker images - -## Requirements -- Docker images - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.49 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.5-documentation-review.md b/docs/content/stories/phase8/8.7.5-documentation-review.md deleted file mode 100644 index 0f7b2af..0000000 --- a/docs/content/stories/phase8/8.7.5-documentation-review.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.5: Documentation review - -## Metadata -- **Task ID**: 8.7.5 -- **Title**: Documentation review -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Documentation review - -## Requirements -- Documentation review - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.5 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.50-deployment-guides.md b/docs/content/stories/phase8/8.7.50-deployment-guides.md deleted file mode 100644 index 5b1d767..0000000 --- a/docs/content/stories/phase8/8.7.50-deployment-guides.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.50: Deployment guides - -## Metadata -- **Task ID**: 8.7.50 -- **Title**: Deployment guides -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Deployment guides - -## Requirements -- Deployment guides - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.50 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.51-oidc-support.md b/docs/content/stories/phase8/8.7.51-oidc-support.md deleted file mode 100644 index bd92a29..0000000 --- a/docs/content/stories/phase8/8.7.51-oidc-support.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.51: OIDC support - -## Metadata -- **Task ID**: 8.7.51 -- **Title**: OIDC support -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -OIDC support - -## Requirements -- OIDC support - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.51 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.52-graphql-api.md b/docs/content/stories/phase8/8.7.52-graphql-api.md deleted file mode 100644 index d7ae527..0000000 --- a/docs/content/stories/phase8/8.7.52-graphql-api.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.52: GraphQL API - -## Metadata -- **Task ID**: 8.7.52 -- **Title**: GraphQL API -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -GraphQL API - -## Requirements -- GraphQL API - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.52 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.53-additional-modules.md b/docs/content/stories/phase8/8.7.53-additional-modules.md deleted file mode 100644 index ff63ef3..0000000 --- a/docs/content/stories/phase8/8.7.53-additional-modules.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.53: Additional modules - -## Metadata -- **Task ID**: 8.7.53 -- **Title**: Additional modules -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Additional modules - -## Requirements -- Additional modules - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.53 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.54-performance-optimization.md b/docs/content/stories/phase8/8.7.54-performance-optimization.md deleted file mode 100644 index 8b6ef02..0000000 --- a/docs/content/stories/phase8/8.7.54-performance-optimization.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.54: Performance optimization - -## Metadata -- **Task ID**: 8.7.54 -- **Title**: Performance optimization -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Performance optimization - -## Requirements -- Performance optimization - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.54 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.6-repository-structure.md b/docs/content/stories/phase8/8.7.6-repository-structure.md deleted file mode 100644 index 8612342..0000000 --- a/docs/content/stories/phase8/8.7.6-repository-structure.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.6: Repository structure - -## Metadata -- **Task ID**: 8.7.6 -- **Title**: Repository structure -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Repository structure - -## Requirements -- Repository structure - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.6 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.7-configuration-system.md b/docs/content/stories/phase8/8.7.7-configuration-system.md deleted file mode 100644 index 5ee8b31..0000000 --- a/docs/content/stories/phase8/8.7.7-configuration-system.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.7: Configuration system - -## Metadata -- **Task ID**: 8.7.7 -- **Title**: Configuration system -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Configuration system - -## Requirements -- Configuration system - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.7 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.8-logging-foundation.md b/docs/content/stories/phase8/8.7.8-logging-foundation.md deleted file mode 100644 index 3046551..0000000 --- a/docs/content/stories/phase8/8.7.8-logging-foundation.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.8: Logging foundation - -## Metadata -- **Task ID**: 8.7.8 -- **Title**: Logging foundation -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Logging foundation - -## Requirements -- Logging foundation - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.8 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/8.7.9-basic-cicd.md b/docs/content/stories/phase8/8.7.9-basic-cicd.md deleted file mode 100644 index 9807b10..0000000 --- a/docs/content/stories/phase8/8.7.9-basic-cicd.md +++ /dev/null @@ -1,40 +0,0 @@ -# Task 8.7.9: Basic CI/CD - -## Metadata -- **Task ID**: 8.7.9 -- **Title**: Basic CI/CD -- **Phase**: 8 - Advanced Features & Polish -- **Section**: 8.7 -- **Status**: Pending -- **Priority**: High -- **Estimated Time**: TBD -- **Dependencies**: TBD - -## Description -Basic CI/CD - -## Requirements -- Basic CI/CD - -## Implementation Steps -1. TODO: Add implementation steps -2. TODO: Add implementation steps -3. TODO: Add implementation steps - -## Acceptance Criteria -- [ ] Task 8.7.9 is completed -- [ ] All requirements are met -- [ ] Code compiles and tests pass - -## Related ADRs -- See relevant ADRs in `docs/adr/` - -## Implementation Notes -- TODO: Add implementation notes - -## Testing -```bash -# TODO: Add test commands -go test ./... -``` - diff --git a/docs/content/stories/phase8/README.md b/docs/content/stories/phase8/README.md index 192a892..cad59f8 100644 --- a/docs/content/stories/phase8/README.md +++ b/docs/content/stories/phase8/README.md @@ -1,54 +1,40 @@ -# Phase 8: Advanced Features & Polish (Optional) +# Phase 8: Advanced Features & Polish ## Overview -Implement advanced optional features including OIDC support, GraphQL API, API versioning, request/response transformation, and additional polish features. +Add advanced features (OIDC, GraphQL, API Gateway), performance optimization, additional sample modules, and final polish and bug fixes. -## Tasks +## Stories -### 8.1 OIDC Support -- [8.1.1 - Install OIDC Library](./8.1.1-install-githubcomcoreosgo-oidc.md) -- [8.1.2 - Implement OIDC Provider](./8.1.2-implement-oidc-provider.md) -- [8.1.3 - Add OIDC Client Support](./8.1.3-add-oidc-client-support.md) -- [8.1.4 - Document OIDC Setup](./8.1.4-document-oidc-setup-in-docsauthmd.md) +### 8.1 OpenID Connect (OIDC) Support +- [Story: 8.1 - OIDC Support](./8.1-oidc-support.md) +- **Goal:** Add OpenID Connect (OIDC) support for external identity providers. +- **Deliverables:** OIDC client, OIDC provider (optional), documentation ### 8.2 GraphQL API -- [8.2.1 - Install gqlgen](./8.2.1-install-githubcom99designsgqlgen.md) -- [8.2.2 - Create GraphQL Schema](./8.2.2-create-graphql-schema.md) -- [8.2.3 - Implement Resolvers](./8.2.3-implement-resolvers.md) -- [8.2.4 - Add GraphQL Endpoint](./8.2.4-add-graphql-endpoint-post-graphql.md) +- [Story: 8.2 - GraphQL API](./8.2-graphql-api.md) +- **Goal:** Add optional GraphQL API alongside REST API. +- **Deliverables:** GraphQL schema, resolvers, GraphQL endpoint -### 8.3 API Enhancements -- [8.3.1 - Add Request/Response Transformation](./8.3.1-add-requestresponse-transformation.md) -- [8.3.2 - Add API Key Authentication](./8.3.2-add-api-key-authentication.md) +### 8.3 Additional Sample Modules +- [Story: 8.3 - Additional Modules](./8.3-additional-modules.md) +- **Goal:** Create additional sample modules to demonstrate different use cases. +- **Deliverables:** Notification module, Analytics module -### 8.4 Advanced Features -- [8.4.1 - Implement Webhooks](./8.4.1-implement-webhooks.md) -- [8.4.2 - Add API Versioning](./8.4.2-add-api-versioning.md) -- [8.4.3 - Create Admin Dashboard](./8.4.3-create-admin-dashboard.md) - -### 8.5 Performance Optimization -- [8.5.1 - Add Database Query Optimization](./8.5.1-add-database-query-optimization.md) -- [8.5.2 - Implement Response Caching](./8.5.2-implement-response-caching.md) -- [8.5.3 - Add Connection Pooling](./8.5.3-add-connection-pooling.md) - -### 8.6 Security Enhancements -- [8.6.1 - Add CSRF Protection](./8.6.1-add-csrf-protection.md) -- [8.6.2 - Implement Content Security Policy](./8.6.2-implement-content-security-policy.md) -- [8.6.3 - Add Security Headers](./8.6.3-add-security-headers.md) +### 8.4 Final Polish and Optimization +- [Story: 8.4 - Final Polish](./8.4-final-polish.md) +- **Goal:** Final polish, bug fixes, performance optimization, and security audit. +- **Deliverables:** Code review, bug fixes, performance optimization, security audit, documentation review ## Deliverables Checklist -- [ ] OIDC authentication working -- [ ] GraphQL API implemented -- [ ] API versioning in place -- [ ] Webhooks support -- [ ] Performance optimizations applied -- [ ] Security enhancements complete +- [ ] OIDC support (optional) +- [ ] GraphQL API (optional) +- [ ] Additional sample modules +- [ ] Performance optimizations +- [ ] Final polish ## Acceptance Criteria -- OIDC login flow works -- GraphQL queries and mutations work -- API versions are properly handled -- Webhooks are triggered on events -- Performance meets benchmarks -- Security headers are properly set - +- Advanced features work correctly +- Performance is optimized +- Code quality is high +- Security audit passes +- Documentation is complete