Source Tree Structure

Last updated: October 6, 2025 Reading time: 6 minutes File size: 12 KB

Unified Project Structure

BATbern-Platform/
β”œβ”€β”€ shared-kernel/                     # Shared types, events, utilities
β”œβ”€β”€ services/                          # Domain services
β”‚   β”œβ”€β”€ event-management/              # Event Management Service
β”‚   β”œβ”€β”€ speaker-coordination/          # Speaker Coordination Service
β”‚   β”œβ”€β”€ partner-coordination/          # Partner Coordination Service
β”‚   β”œβ”€β”€ attendee-experience/           # Attendee Experience Service
β”‚   └── company-management/            # Company Management Service
β”œβ”€β”€ api-gateway/                       # Unified API Gateway
β”œβ”€β”€ web-frontend/                      # React Frontend Application
β”œβ”€β”€ infrastructure/                    # Infrastructure as Code
β”‚   β”œβ”€β”€ global-stacks/                 # Region-independent resources
β”‚   β”œβ”€β”€ core-infrastructure/           # Regional shared resources
β”‚   β”œβ”€β”€ domain-stacks/                 # Per-domain infrastructure
β”‚   └── environments/                  # Environment-specific configs
β”œβ”€β”€ e2e-tests/                         # End-to-end tests
β”œβ”€β”€ scripts/                           # Build and deployment scripts
β”œβ”€β”€ docs/                              # Documentation
└── README.md                          # Project overview

Service Structure Template

services/{domain-service}/
β”œβ”€β”€ src/main/java/ch/batbern/{domain}/
β”‚   β”œβ”€β”€ controller/                     # REST API controllers
β”‚   β”œβ”€β”€ service/                        # Business logic layer
β”‚   β”œβ”€β”€ repository/                     # Data access layer
β”‚   β”œβ”€β”€ domain/                         # Domain models and entities
β”‚   β”œβ”€β”€ dto/                           # Data transfer objects
β”‚   β”œβ”€β”€ exception/                     # Custom exceptions
β”‚   └── security/                      # Security components
β”œβ”€β”€ src/main/resources/
β”‚   β”œβ”€β”€ application.yml                # Configuration
β”‚   └── db/migration/                  # Flyway migrations
β”œβ”€β”€ src/test/java/                     # Unit and integration tests
β”œβ”€β”€ build.gradle                      # Build configuration
└── README.md                         # Service documentation

Frontend Structure

web-frontend/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/                    # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ common/                    # Shared components
β”‚   β”‚   β”œβ”€β”€ organizer/                 # Organizer-specific components
β”‚   β”‚   β”œβ”€β”€ speaker/                   # Speaker-specific components
β”‚   β”‚   β”œβ”€β”€ partner/                   # Partner-specific components
β”‚   β”‚   └── attendee/                  # Attendee-specific components
β”‚   β”œβ”€β”€ hooks/                         # Custom React hooks
β”‚   β”œβ”€β”€ services/                      # API client services
β”‚   β”œβ”€β”€ stores/                        # Zustand state stores
β”‚   β”œβ”€β”€ types/                         # TypeScript type definitions
β”‚   β”œβ”€β”€ utils/                         # Utility functions
β”‚   └── pages/                         # Page components
β”œβ”€β”€ public/                            # Static assets
β”œβ”€β”€ tests/                             # Component and integration tests
β”œβ”€β”€ e2e/                              # End-to-end tests
β”œβ”€β”€ package.json                       # Dependencies and scripts
β”œβ”€β”€ vite.config.ts                     # Vite configuration
└── tailwind.config.js                # Tailwind CSS configuration

Shared Kernel Structure

shared-kernel/
β”œβ”€β”€ src/main/java/ch/batbern/shared/
β”‚   β”œβ”€β”€ events/                        # Domain events
β”‚   β”‚   β”œβ”€β”€ EventCreatedEvent.java
β”‚   β”‚   β”œβ”€β”€ SpeakerInvitedEvent.java
β”‚   β”‚   └── PartnerAnalyticsEvent.java
β”‚   β”œβ”€β”€ types/                         # Shared value objects
β”‚   β”‚   β”œβ”€β”€ CompanyId.java
β”‚   β”‚   β”œβ”€β”€ EventId.java
β”‚   β”‚   └── UserId.java
β”‚   β”œβ”€β”€ exceptions/                    # Common exceptions
β”‚   β”‚   β”œβ”€β”€ DomainException.java
β”‚   β”‚   └── ValidationException.java
β”‚   └── utils/                         # Utility classes
β”‚       β”œβ”€β”€ DateTimeUtils.java
β”‚       └── ValidationUtils.java
β”œβ”€β”€ src/main/resources/
β”‚   └── application-shared.yml         # Shared configuration
└── build.gradle                      # Shared dependencies

Infrastructure Structure

infrastructure/
β”œβ”€β”€ lib/                               # CDK construct library
β”‚   β”œβ”€β”€ core-infrastructure-stack.ts  # Core AWS resources
β”‚   β”œβ”€β”€ domain-service-stack.ts       # Service-specific resources
β”‚   β”œβ”€β”€ frontend-stack.ts             # Frontend deployment
β”‚   └── monitoring-stack.ts           # Observability resources
β”œβ”€β”€ bin/                               # CDK applications
β”‚   β”œβ”€β”€ core-app.ts                   # Core infrastructure app
β”‚   β”œβ”€β”€ domain-app.ts                 # Domain services app
β”‚   └── frontend-app.ts               # Frontend app
β”œβ”€β”€ environments/                      # Environment configs
β”‚   β”œβ”€β”€ dev.ts                        # Development environment
β”‚   β”œβ”€β”€ staging.ts                    # Staging environment
β”‚   └── prod.ts                       # Production environment
β”œβ”€β”€ cdk.json                          # CDK configuration
β”œβ”€β”€ package.json                      # CDK dependencies
└── tsconfig.json                     # TypeScript configuration

API Gateway Structure

api-gateway/
β”œβ”€β”€ src/main/java/ch/batbern/gateway/
β”‚   β”œβ”€β”€ config/                        # Gateway configuration
β”‚   β”‚   β”œβ”€β”€ SecurityConfig.java
β”‚   β”‚   β”œβ”€β”€ CorsConfig.java
β”‚   β”‚   └── RateLimitConfig.java
β”‚   β”œβ”€β”€ filter/                        # Request/response filters
β”‚   β”‚   β”œβ”€β”€ AuthenticationFilter.java
β”‚   β”‚   β”œβ”€β”€ LoggingFilter.java
β”‚   β”‚   └── RateLimitFilter.java
β”‚   β”œβ”€β”€ route/                         # Route configurations
β”‚   β”‚   β”œβ”€β”€ EventRoutes.java
β”‚   β”‚   β”œβ”€β”€ SpeakerRoutes.java
β”‚   β”‚   └── PartnerRoutes.java
β”‚   └── exception/                     # Gateway exceptions
β”‚       └── GatewayException.java
β”œβ”€β”€ src/main/resources/
β”‚   β”œβ”€β”€ application.yml                # Gateway configuration
β”‚   └── routes/                        # Route definitions
└── build.gradle                      # Gateway dependencies

End-to-End Tests Structure

e2e-tests/
β”œβ”€β”€ tests/                             # Test specifications
β”‚   β”œβ”€β”€ organizer/                     # Organizer workflows
β”‚   β”‚   β”œβ”€β”€ event-creation.spec.ts
β”‚   β”‚   └── speaker-management.spec.ts
β”‚   β”œβ”€β”€ speaker/                       # Speaker workflows
β”‚   β”‚   β”œβ”€β”€ invitation-response.spec.ts
β”‚   β”‚   └── material-upload.spec.ts
β”‚   β”œβ”€β”€ partner/                       # Partner workflows
β”‚   β”‚   β”œβ”€β”€ analytics-dashboard.spec.ts
β”‚   β”‚   └── roi-reports.spec.ts
β”‚   └── attendee/                      # Attendee workflows
β”‚       β”œβ”€β”€ event-registration.spec.ts
β”‚       └── content-search.spec.ts
β”œβ”€β”€ fixtures/                          # Test data
β”‚   β”œβ”€β”€ events.json
β”‚   β”œβ”€β”€ speakers.json
β”‚   └── companies.json
β”œβ”€β”€ page-objects/                      # Page object models
β”‚   β”œβ”€β”€ EventPage.ts
β”‚   β”œβ”€β”€ SpeakerPage.ts
β”‚   └── DashboardPage.ts
β”œβ”€β”€ utils/                            # Test utilities
β”‚   β”œβ”€β”€ auth-helper.ts
β”‚   └── data-factory.ts
β”œβ”€β”€ playwright.config.ts              # Playwright configuration
└── package.json                      # Test dependencies

Scripts Structure

scripts/
β”œβ”€β”€ development/                       # Development scripts
β”‚   β”œβ”€β”€ setup-local-env.sh           # Local environment setup
β”‚   β”œβ”€β”€ start-services.sh            # Start all services
β”‚   └── generate-test-data.sh        # Generate test data
β”œβ”€β”€ deployment/                       # Deployment scripts
β”‚   β”œβ”€β”€ deploy-to-staging.sh         # Staging deployment
β”‚   β”œβ”€β”€ deploy-to-production.sh      # Production deployment
β”‚   └── rollback.sh                  # Rollback script
β”œβ”€β”€ maintenance/                      # Maintenance scripts
β”‚   β”œβ”€β”€ backup-database.sh           # Database backup
β”‚   β”œβ”€β”€ clear-cache.sh               # Cache clearing
β”‚   └── health-check.sh              # System health check
└── ci/                               # CI/CD scripts
    β”œβ”€β”€ build-and-test.sh            # Build and test pipeline
    β”œβ”€β”€ security-scan.sh             # Security scanning
    └── performance-test.sh          # Performance testing

Documentation Structure

docs/
β”œβ”€β”€ architecture/                      # Architecture documentation
β”‚   β”œβ”€β”€ 01-system-overview.md
β”‚   β”œβ”€β”€ 02-infrastructure-deployment.md
β”‚   β”œβ”€β”€ 03-data-architecture.md
β”‚   β”œβ”€β”€ 04-api-design.md
β”‚   β”œβ”€β”€ 05-frontend-architecture.md
β”‚   β”œβ”€β”€ 06-backend-architecture.md
β”‚   β”œβ”€β”€ 07-development-standards.md
β”‚   β”œβ”€β”€ 08-operations-security.md
β”‚   β”œβ”€β”€ 09-aiml-architecture.md
β”‚   β”œβ”€β”€ coding-standards.md           # Coding standards and conventions
β”‚   β”œβ”€β”€ tech-stack.md                 # Technology stack details
β”‚   β”œβ”€β”€ source-tree.md                # This file - source tree structure
β”‚   └── index.md                      # Architecture overview
β”œβ”€β”€ api/                              # API documentation
β”‚   β”œβ”€β”€ openapi.yml                   # OpenAPI specification
β”‚   β”œβ”€β”€ endpoints/                    # Endpoint documentation
β”‚   └── examples/                     # Request/response examples
β”œβ”€β”€ deployment/                       # Deployment guides
β”‚   β”œβ”€β”€ local-setup.md                # Local development setup
β”‚   β”œβ”€β”€ staging-deployment.md         # Staging deployment guide
β”‚   └── production-deployment.md      # Production deployment guide
β”œβ”€β”€ guides/                           # Developer guides
β”‚   β”œβ”€β”€ getting-started.md            # Getting started guide
β”‚   β”œβ”€β”€ testing-guide.md              # Testing best practices
β”‚   └── troubleshooting.md            # Common issues and solutions
└── prd/                              # Product requirements
    β”œβ”€β”€ epic-*.md                     # Epic specifications
    └── user-stories/                 # User story details

Key Directory Conventions

Naming Conventions

  • Directories: kebab-case for multi-word directories
  • Java packages: lowercase following Java conventions
  • TypeScript files: camelCase.ts or PascalCase.tsx for components
  • Configuration files: kebab-case.yml or camelCase.json

File Organization Principles

  1. Domain Separation: Each bounded context has its own service directory
  2. Layered Architecture: Clear separation of concerns within services
  3. Shared Resources: Common code in shared-kernel, reusable infrastructure
  4. Test Proximity: Tests close to the code they test
  5. Configuration Management: Environment-specific configs in dedicated directories

Integration Points

  • API Gateway: Central entry point routing to domain services
  • Shared Kernel: Common types and events shared across services
  • Infrastructure: Shared AWS resources and deployment configurations
  • Frontend: Single React application consuming all domain APIs