Status: [ ] Not Started | [ ] In Progress | [ ] Complete | [ ] Approved
This document defines the codebase organization, naming conventions, and module boundaries. Complete this document during the Global Setup phase before creating any feature specifications.
Directory Organization
Root Structure
[TODO: Define root directory structure]
Example:
project-root/
├── .flowstate/ # FlowState configuration and docs
├── packages/ # Monorepo packages
├── apps/ # Application entry points
├── libs/ # Shared libraries
├── tools/ # Build and dev tools
├── docs/ # Documentation
└── tests/ # Test suites
Package Structure
[TODO: Define package structure]
Example:
packages/{package-name}/
├── src/
│ ├── index.ts # Public exports
│ ├── types.ts # Type definitions
│ └── {feature}/ # Feature modules
├── tests/ # Package tests
├── package.json
├── tsconfig.json
└── README.md
Naming Conventions
Files and Directories
| Type | Convention | Example |
|---|
| Directories | [TODO] | [TODO] |
| React Components | [TODO] | [TODO] |
| Utility Files | [TODO] | [TODO] |
| Test Files | [TODO] | [TODO] |
| Type Files | [TODO] | [TODO] |
| Config Files | [TODO] | [TODO] |
Code Elements
| Type | Convention | Example |
|---|
| Classes | [TODO] | [TODO] |
| Functions | [TODO] | [TODO] |
| Variables | [TODO] | [TODO] |
| Constants | [TODO] | [TODO] |
| Types/Interfaces | [TODO] | [TODO] |
| Enums | [TODO] | [TODO] |
Database and API
| Type | Convention | Example |
|---|
| Table Names | [TODO] | [TODO] |
| Column Names | [TODO] | [TODO] |
| API Endpoints | [TODO] | [TODO] |
| Query Parameters | [TODO] | [TODO] |
Module Boundaries
Package Dependencies
[TODO: Define dependency rules]
Example:
apps/* → packages/* (allowed)
packages/* → libs/* (allowed)
libs/* → packages/* (NOT allowed - circular)
Layer Architecture
[TODO: Define layer structure]
Example:
UI Layer (components)
↓
Application Layer (hooks, services)
↓
Domain Layer (models, business logic)
↓
Infrastructure Layer (API, database)
Import Patterns
Import Order
import React from 'react';
import { useQuery } from '@tanstack/react-query';
import { Button } from '@project/ui';
import { useAuth } from '@project/auth';
import { UserCard } from './UserCard';
import { formatDate } from '../utils';
import type { User } from '@project/types';
Path Aliases
| Alias | Target | Usage |
|---|
| [TODO] | [TODO] | [TODO] |
| [TODO] | [TODO] | [TODO] |
Component Organization
Component Structure
Component Co-location
[TODO: Define co-location rules]
Example:
ComponentName/
├── index.ts # Public export
├── ComponentName.tsx # Main component
├── ComponentName.test.tsx # Tests
├── ComponentName.styles.ts # Styles (if applicable)
└── types.ts # Component-specific types
Test Organization
Test File Placement
| Test Type | Location | Naming |
|---|
| Unit Tests | [TODO] | [TODO] |
| Integration Tests | [TODO] | [TODO] |
| E2E Tests | [TODO] | [TODO] |
Test Structure
Configuration Files
Standard Config Files
| File | Purpose | Location |
|---|
| [TODO] | [TODO] | [TODO] |
| [TODO] | [TODO] | [TODO] |
Environment Configuration
| Environment | Config File | Purpose |
|---|
| Development | [TODO] | [TODO] |
| Testing | [TODO] | [TODO] |
| Production | [TODO] | [TODO] |
Documentation Structure
Documentation Types
| Type | Location | Purpose |
|---|
| API Docs | [TODO] | [TODO] |
| README | [TODO] | [TODO] |
| CLAUDE.md | [TODO] | [TODO] |
| Architecture | [TODO] | [TODO] |
Approval
| Role | Name | Date | Signature |
|---|
| Technical Lead | | | |
| Senior Developer | | | |
Last Updated: [Date] Document Owner: [Name]