This guide will help you set up ArchiGram.ai for local development.
- Bun >= 1.0.0 (recommended) or Node.js >= 18.0.0
- Git
- A Google Gemini API key
- Supabase (optional; required for community gallery)
# Clone the repository
git clone https://github.com/isatimur/archigram.ai.git
cd archigram.ai
# Install dependencies
bun install
# Set up environment variables
cp .env.example .env
# Edit .env and add your API keys
# Start development server
bun run devOpen http://localhost:5173 in your browser.
- Minimal: Only
VITE_GEMINI_API_KEY— AI and diagramming work; gallery uses static data. - Full: Add Supabase URL/key — live community gallery, publish, like, fork.
Minimal setup: VITE_GEMINI_API_KEY only. Add Supabase for community gallery.
Create a .env file in the root directory:
# Required: Google Gemini API Key
VITE_GEMINI_API_KEY=your_gemini_api_key_here
# Optional: Supabase (for community features)
VITE_SUPABASE_URL=your_supabase_project_url
VITE_SUPABASE_KEY=your_supabase_anon_key
# Optional: Plausible Analytics (self-hosted)
VITE_PLAUSIBLE_DOMAIN=archigram.ai- Go to Google AI Studio
- Click "Create API Key"
- Copy the key to your
.envfile
- Create a project at Supabase
- Go to Settings > API
- Copy the Project URL and anon/public key
- Run the migrations in
supabase-migrations.sql
| Command | Description |
|---|---|
bun run dev |
Start development server |
bun run build |
Build for production |
bun run preview |
Preview production build |
bun run test |
Run tests in watch mode |
bun run test:run |
Run tests once |
bun run test:coverage |
Run tests with coverage |
bun run test:ui |
Open Vitest UI |
bun run lint |
Run ESLint |
bun run lint:fix |
Fix ESLint errors |
bun run format |
Format code with Prettier |
bun run format:check |
Check formatting |
bun run type-check |
Run TypeScript type checker |
bun run validate |
Run all checks (type, lint, test) |
bun run cli |
CLI for diagram generation |
bun run mcp-server |
MCP server for AI agent integration |
archigram.ai/
├── components/ # React components
├── services/ # API clients (Gemini, Supabase)
├── utils/ # Helper functions
├── tests/ # Test files
├── public/ # Static assets
├── App.tsx # Main app component
├── index.tsx # Entry point
├── types.ts # TypeScript types
├── constants.ts # App constants
├── cli/ # CLI tool
└── mcp-server/ # MCP server for AI agents
The MCP server exposes ArchiGram to AI agents (Cursor, Claude Desktop, etc.) via the Model Context Protocol.
Tools:
generate_diagram— Generate Mermaid diagram from natural languageget_diagram— Fetch a community diagram by ID
Configuration:
Cursor — Add to .cursor/mcp.json (or project settings):
{
"mcpServers": {
"archigram": {
"command": "bun",
"args": ["run", "mcp-server", "--cwd", "/absolute/path/to/archigram.ai"]
}
}
}Claude Desktop — Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"archigram": {
"command": "bun",
"args": ["run", "mcp-server", "--cwd", "/absolute/path/to/archigram.ai"]
}
}
}Uses hosted API by default. Set GEMINI_API_KEY for local generation.
git checkout -b feature/your-feature-nameFollow the code style guide:
- Use TypeScript for all new code
- Follow existing patterns in the codebase
- Add tests for new functionality
- Keep components small and focused
# Run all checks
bun run validate
# Or run individually
bun run type-check
bun run lint
bun run test:runWe use Conventional Commits:
# Format: <type>(<scope>): <description>
git commit -m "feat(editor): add syntax highlighting for PlantUML"
git commit -m "fix(gallery): resolve pagination issue"
git commit -m "docs: update API documentation"Types: feat, fix, docs, style, refactor, test, chore
git push origin feature/your-feature-nameThen open a PR on GitHub.
# Watch mode (development)
bun run test
# Single run (CI)
bun run test:run
# With coverage report
bun run test:coverage
# Visual test UI
bun run test:uiTests are located in tests/ directory:
// tests/components/Editor.test.tsx
import { describe, it, expect } from 'vitest';
import { render, screen } from '../utils/test-utils';
import { Editor } from '../../components/Editor';
describe('Editor', () => {
it('renders textarea', () => {
render(<Editor value="" onChange={() => {}} />);
expect(screen.getByRole('textbox')).toBeInTheDocument();
});
});We aim for >50% coverage. Check current coverage:
bun run test:coverageCoverage report is generated in coverage/ directory.
- Prefer
typeoverinterfacefor object types - Use explicit return types for public functions
- Avoid
any- useunknownif type is truly unknown
- Use functional components with hooks
- Keep components under 200 lines
- Extract custom hooks for reusable logic
- Use
React.memo()for expensive renders
- Use Tailwind CSS utility classes
- Follow mobile-first responsive design
- Keep custom CSS minimal
Recommended extensions:
- ESLint
- Prettier
- TypeScript Vue Plugin (Volar)
- Tailwind CSS IntelliSense
- React DevTools for component inspection
- Network tab for API debugging
- Console for error messages
# Clear Bun cache
bun pm cache rm
# Reinstall dependencies
rm -rf node_modules bun.lockb
bun install
# Check Bun version
bun --versionbun install
bun run type-checkClear browser cache or try incognito mode.
- Check environment variables
- Verify Supabase project is active
- Check RLS policies
# Check for type errors
bun run type-check
# Check for lint errors
bun run lint
# Verbose build
bun run build --debug- Check existing issues
- Join GitHub Discussions
- Read the Architecture docs
Happy coding!