Quick Reference Guide - MacPro Mako

Essential Technologies & Concepts

🚀 Core Technologies

Technology Purpose Key Files
TypeScript Type-safe JavaScript tsconfig.json, *.ts, *.tsx
React 18 Frontend UI framework react-app/src/
AWS CDK Infrastructure as Code lib/stacks/, bin/app.ts
AWS Lambda Serverless functions lib/lambda/
Bun Package manager & runtime bunfig.toml, package.json
Vite Build tool & dev server react-app/vite.config.ts

🏗️ Architecture Patterns

Monorepo Structure

``` macpro-mako/ ├── lib/ # Backend & Infrastructure ├── react-app/ # Frontend Application ├── bin/ # CLI & CDK Entry ├── test/ # E2E Tests └── mocks/ # Mock Services ```

AWS Services Used

📦 Package Management

Bun (Primary Package Manager)

# Install dependencies
bun install

# Run scripts
bun run <script-name>

# Add new package
bun add <package-name>

# Add dev dependency
bun add -d <package-name>

Key Scripts

bun run build          # Build all packages
bun run test           # Run unit tests
bun run e2e            # Run E2E tests
bun run lint           # Lint code
bun run format:write   # Format code
bun run cdk deploy     # Deploy to AWS

🔧 Development Tools

TypeScript Configuration

Testing Stack

Code Quality

🌐 Frontend Stack

React Ecosystem

// Key libraries
import React from 'react'
import { QueryClient } from '@tanstack/react-query'
import { useForm } from 'react-hook-form'
import { zodResolver } from '@hookform/resolvers/zod'

UI Components

State Management

☁️ AWS Infrastructure

CDK Stacks

// Main stacks defined in lib/stacks/
- NetworkingStack    // VPC, subnets, security groups
- ApiStack           // API Gateway, Lambda functions
- AuthStack          // Cognito user pools
- DataStack          // OpenSearch, S3
- UiInfraStack       // CloudFront, S3 hosting
- EmailStack         // Email processing
- AlertsStack        // SNS notifications

Deployment Stages

# Development stages
local → dev → val → production

# Deploy command
cdk deploy -c stage=<stage-name>

🔐 Authentication & Security

Cognito Integration

Security Features

📊 Data & Storage

OpenSearch (Elasticsearch)

S3 Storage

🔄 Development Workflow

1. Local Development

# Start frontend
bun run bun:dev

# Start backend (if needed)
bun run cdk:watch

# Run tests
bun run test

2. Code Changes

# Create feature branch
git checkout -b feature/new-feature

# Make changes and test
bun run test
bun run e2e

# Commit and push
git add .
git commit -m "feat: add new feature"
git push origin feature/new-feature

3. Deployment

# Deploy to development
cdk deploy -c stage=dev

# Deploy to production
cdk deploy -c stage=production

🛠️ Common Commands

Development

# Install dependencies
bun install

# Start development server
bun run bun:dev

# Run tests
bun run test

# Type checking
bun run test-tsc

# Lint code
bun run lint

# Format code
bun run format:write

AWS/CDK

# Bootstrap CDK (first time)
cdk bootstrap

# Deploy infrastructure
cdk deploy -c stage=local

# Watch for changes
cdk watch -c stage=local

# Destroy infrastructure
cdk destroy -c stage=local

Testing

# Unit tests
bun run test

# E2E tests
bun run e2e

# Test with UI
bun run test:ui

# Coverage report
bun run test:coverage

📁 Key File Locations

File Purpose
package.json Root dependencies & scripts
cdk.json CDK configuration
tsconfig.json TypeScript configuration
turbo.json Monorepo build configuration
bunfig.toml Bun configuration
react-app/vite.config.ts Frontend build configuration
lib/stacks/parent.ts Main CDK stack
bin/app.ts CDK application entry point

🔍 Environment Variables

Required for Deployment

PROJECT="your-project-name"
REGION_A="us-east-1"
CDK_DEFAULT_ACCOUNT="your-aws-account-id"
CDK_DEFAULT_REGION="us-east-1"

Optional for Development

STAGE="local"
AWS_ACCESS_KEY_ID="your-access-key"
AWS_SECRET_ACCESS_KEY="your-secret-key"

🚨 Troubleshooting

Common Issues

  1. Bun not found: Install with curl -fsSL https://bun.sh/install | bash
  2. CDK errors: Run cdk bootstrap first
  3. TypeScript errors: Clear cache with rm -rf node_modules/.cache
  4. Test failures: Check environment variables and AWS credentials

Getting Help


This quick reference covers the essential concepts and commands you'll need to work with the MacPro Mako codebase. For detailed explanations, refer to the main README.md file.