Repository Overview
Macro is organized as a monorepo containing frontend, backend services, infrastructure, and tooling. This structure enables efficient development across the full stack while maintaining clear separation of concerns.Top-Level Structure
Frontend: js/app/
The frontend is built with SolidJS and supports both web and desktop (via Tauri).
Package Structure
Key Directories
packages/app
Application Entry PointMain application initialization for both web and desktop platforms. Contains routing, app shell, and platform-specific code.
packages/core
Shared Core LogicCommon utilities, components, state management, and business logic shared across the application.
packages/lexical-core
Text EditorLexical-based rich text editor used across emails, notes, channels, and tasks. Provides consistent editing experience.
packages/block-*
UI BlocksModular UI components for different features:
block-email: Email client UIblock-chat: Messaging/channels UIblock-canvas: Canvas/diagramming UIblock-docs: Document editing UI- And more…
packages/service-*
API ClientsType-safe client libraries for backend services:
service-document: Document storage APIservice-email: Email service APIservice-comms: Communication APIservice-search: Search API
src-tauri
Desktop BackendRust-based Tauri backend for desktop application. Handles native OS integration, file system access, and desktop-specific features.
Backend: rust/cloud-storage/
The backend is a Rust Cargo workspace containing 80+ crates organized as microservices.
Service Organization
Core Services
Document Storage Services
Document Storage Services
document-storage-service
- Main document storage API
- CRUD operations for documents
- Permissions and access control
- Document metadata management
- Document analysis and processing
- Content understanding
- Smart document features
- Static file serving
- File uploads and downloads
- S3 integration
Processing Services
Processing Services
convert_service
- Document format conversion
- File transformation
- Format compatibility
- Text extraction from documents
- PDF processing (pdfium)
- DOCX processing
- Search indexing pipeline
- OpenSearch integration
- Index management
Communication Services
Communication Services
comms_service
- Internal communication handling
- Messages and channels
- Real-time messaging
- Email processing and management
- Gmail sync
- Email storage and retrieval
- User notifications
- Push notifications
- Notification preferences
Infrastructure Services
Infrastructure Services
authentication_service
- User authentication
- FusionAuth integration
- Session management
- WebSocket gateway
- Real-time connection management
- Connection tracking in DynamoDB
- Contact management
- User connections
- ContactsDB integration
Search Services
Search Services
search_service
- Search API endpoint
- Query processing
- Result ranking
- Full-text search across all content types
- Background search indexing
- OpenSearch document updates
- Search event queue processing
Shared Crates
The workspace includes shared utility crates:-
Database Clients:
macro_db_client: PostgreSQL client for MacroDBcomms_db_client: Communication database clientcontacts_db_client: Contacts database clientemail_db_client: Email database client
-
Common Utilities:
- Shared types and models
- Common middleware
- Error handling utilities
- Authentication helpers
Infrastructure: infra/
Infrastructure as code using Pulumi with TypeScript.
Infrastructure Structure
Key Components
stacks/
Deployment StacksPulumi stack definitions for different environments and services. Each stack manages related AWS resources.
lambda/
Lambda FunctionsServerless function configurations:
- Document text extraction
- DOCX unzipping
- Chat deletion handlers
- Email suppression
- And more…
resources/
Reusable ResourcesShared AWS resource definitions and templates used across stacks.
Scripts: scripts/
Build and utility scripts for development and deployment.
Development Files
Root Level Files
justfile: Main task runner configuration with development commandslocal_stack.just: LocalStack recipes for local AWS emulationdocker-compose.yml: Service orchestration for local developmentdocker-compose-databases.yml: Database containers configurationRUNNING_LOCALLY.md: Local development guideREADME.md: Project overview and directory structure
Rust Workspace
Cargo.toml: Workspace manifest defining all cratesCargo.lock: Dependency lock file.sqlx/: SQLx offline query cache
Frontend Workspace
package.json: Workspace package configurationturbo.json: Turborepo build configurationtsconfig.json: TypeScript configuration
Navigation Guide
Finding Features
Identify the Layer
Determine if the feature is:
- Frontend: User interface (look in
js/app/packages/) - Backend: API or processing (look in
rust/cloud-storage/) - Infrastructure: AWS resources (look in
infra/)
Find the Service
Match the feature to a service:
- Email →
email_service/orblock-email/ - Documents →
document-storage-service/orblock-docs/ - Search →
search_service/or search components - Messaging →
comms_service/orblock-chat/
Working with Databases
Database schemas and migrations:- Schema:
macro-api/database/schema.prisma - Migrations: Service-specific
migrations/directories - SQL clients:
*_db_client/crates in Rust workspace
Finding Tests
- Rust tests:
test.rsfiles in service directories - Frontend tests: Co-located with components
- Integration tests:
tests/directories in services
File Naming Conventions
Rust Services
- Services:
{feature}_service/ - Database clients:
{db_name}_db_client/ - Libraries:
{functionality}/ - Tests:
test.rsin module directory
Frontend Packages
- Blocks:
block-{feature}/ - Services:
service-{backend}/ - Shared:
core/,lexical-core/
Infrastructure
- Stacks:
stacks/{service}-{environment}/ - Lambdas:
lambda/{function-name}/
Next Steps
Getting Started
Set up your local development environment
Architecture
Learn about the system architecture