Installation
This guide covers running Macro locally for development. Macro uses a SolidJS frontend and Rust microservices backend.Prerequisites
Before you begin, ensure you have the following installed:- Doppler: For environment variable management
- Docker: Required for running backend services
- AWS: AWS credentials configured for development
- SQLX: For database migrations and queries
- Bun: JavaScript runtime and package manager for the frontend
- Just: Command runner (alternative to Make)
Initial setup
Export environment variables
Set the required AWS KMS ARN for SOPS encryption:
If you’re using
nix-shell, this step is handled automatically.Running the application
Backend services
Macro’s backend consists of multiple Rust microservices:- document-storage-service: Document storage API
- email_service: Email processing and sync
- comms_service: Messaging and channels
- search_service: Full-text search across all content
- authentication_service: User authentication
- connection_gateway: WebSocket gateway for real-time features
- Start all services
- Rebuild containers
By default,
convert_service and search_processing_service are not run locally as they’re not needed by the frontend when using dev assets.Frontend application
The frontend is built with SolidJS and can run as a web app or desktop app (via Tauri).Development workflow
Running tests
Code quality checks
Authentication for local testing
The app uses cookie-based authentication. To generate an access token for testing:This requires a
.env file with REFRESH_TOKEN and FUSIONAUTH_DOMAIN configured.Architecture overview
Understanding the project structure will help you navigate the codebase:Frontend architecture
- packages/app: Main application entry point
- packages/core: Shared components, utilities, and business logic
- packages/lexical-core: Rich text editor implementation based on Lexical
- block- packages*: Specialized UI components for different content types (email, canvas, chat)
- service- packages*: API clients that communicate with backend microservices
Backend architecture
Macro uses a microservices architecture with Rust:- Each service handles a specific domain (documents, email, messaging, search)
- Services communicate via REST APIs and WebSocket connections
- PostgreSQL database accessed via the
macro_db_clientcrate - AWS infrastructure managed with Pulumi
Development best practices
These guidelines help maintain code quality and consistency across the Macro codebase.
General principles
- Follow existing code styles: Check neighboring files for patterns before introducing new approaches
- Composability: Write small, testable, pure functions when possible
- Simplicity: Prioritize the simplest correct solution over introducing complexity
- Testing: Write tests for your changes. When fixing bugs, identify the issue with a test before fixing it
- Decoupling: Decouple pure business logic from UI and network layers
- Type-driven design: Let types guide function composition. Do not use
any
Frontend-specific guidelines
- Avoid deprecated APIs like
blockSignals,blockMemos,blockResources - Primitive UI components should be pure and prefer composition over complex global state
- Use semantic color tokens instead of default Tailwind styles
- All network calls to service clients should go through TanStack Query in the
queriespackage - For exhaustive switch statements, use
matchfromts-pattern - Check for existing
solid-primitivesbefore creating custom utilities - If you create or modify a Lexical Node, increment the version counter in
packages/core/component/LexicalMarkdown/version.ts
Troubleshooting
Services won’t start
- Ensure Docker is running
- Verify AWS credentials are configured
- Check that all environment variables are set correctly
- Try rebuilding containers:
just run_local --build
Frontend authentication issues
- Verify backend services are running
- Generate a fresh access token:
bun scripts/generate-access-token.ts - Check that
.envfile contains validREFRESH_TOKENandFUSIONAUTH_DOMAIN
Database connection errors
- Ensure PostgreSQL is running (usually managed by Docker Compose)
- Verify database migrations have run: check SQLX setup
- Confirm
macro_db_clientconfiguration matches your local setup
Next steps
Explore the codebase
Familiarize yourself with the directory structure and key packages
Run the test suite
Execute
bun run test to ensure everything is workingMake your first change
Try modifying a UI component and see it hot-reload in the browser
Join the community
Email [email protected] to connect with other developers