Skip to content

Commit 8d43408

Browse files
committed
add AGENTS.md
1 parent 53f932a commit 8d43408

1 file changed

Lines changed: 122 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Hypergraph is a local-first framework for building web3 consumer applications that focuses on privacy-preserving apps with interoperable data using the GRC-20 standard. The project is currently in Developer Preview status.
8+
9+
## Common Development Commands
10+
11+
### Development
12+
```bash
13+
# Run specific apps
14+
cd apps/events && pnpm dev # Events demo app
15+
cd apps/privy-login-example && pnpm dev # Privy login example app
16+
cd apps/server && pnpm dev # Backend sync server
17+
cd apps/connect && pnpm dev # Geo Connect auth app
18+
```
19+
20+
### Testing
21+
```bash
22+
pnpm test # Run all tests with Vitest
23+
vitest # Direct vitest usage
24+
vitest run path/to/test.ts # Run specific test file
25+
```
26+
27+
### Linting & Type Checking
28+
```bash
29+
pnpm lint # Check code with Biome
30+
pnpm lint:fix # Auto-fix linting issues
31+
pnpm check # TypeScript type checking
32+
```
33+
34+
### Database
35+
```bash
36+
pnpm db:migrate:dev # Run database migrations
37+
pnpm db:studio # Open Prisma Studio
38+
```
39+
40+
### Building
41+
```bash
42+
pnpm build # Build all packages and apps
43+
pnpm clean # Clean all build artifacts
44+
```
45+
46+
## High-Level Architecture
47+
48+
### Monorepo Structure
49+
- **packages/** - Core libraries
50+
- `hypergraph/` - Main SDK with entity management, encryption, spaces, and inboxes
51+
- `hypergraph-react/` - React hooks and components
52+
- `create-hypergraph/` - Project scaffolding tool
53+
- **apps/** - Complete applications
54+
- `server/` - Backend sync server (Express + Prisma + SQLite/PostgreSQL)
55+
- `events/` - Demo app showcasing the framework (Vite + React)
56+
- `privy-login-example/` - Privy login example app (Vite + React)
57+
- `connect/` - Geo Connect authentication app
58+
- `next-example/` - Next.js integration example
59+
- **docs/** - Docusaurus documentation site
60+
61+
### Core Architecture Patterns
62+
63+
1. **Local-First with CRDTs**
64+
- Uses Automerge for conflict-free replicated data types
65+
- Offline-capable with sync when online
66+
- Data stored locally with optional server sync
67+
68+
2. **Privacy-Preserving**
69+
- Client-side encryption/decryption
70+
- Uses Noble cryptographic libraries
71+
- Secure key management patterns
72+
73+
3. **Space-Based Organization**
74+
- User data organized in "spaces" (private/public)
75+
- Each space has its own encryption keys
76+
- Spaces can be shared with other users
77+
78+
4. **Identity Management**
79+
- Ethereum-based authentication with Privy
80+
- Smart account support via Permissionless
81+
82+
5. **Knowledge Graph (GRC-20)**
83+
- Structured data format for interoperability
84+
- Entity-based data model
85+
- Schema-driven development with TypeSync
86+
87+
### Key Technologies
88+
- **TypeScript** with strict mode
89+
- **Effect** for functional programming patterns
90+
- **React** for UI applications
91+
- **Automerge** for CRDT implementation
92+
- **Viem** for Ethereum interactions
93+
- **Prisma** for database ORM
94+
- **GraphQL** for API queries
95+
- **Biome** for linting/formatting
96+
97+
### Development Patterns
98+
99+
1. **Effect Usage**
100+
- Use Effect for error handling and async operations
101+
- Prefer functional patterns with immutable data
102+
- Use Effect testing utilities in tests
103+
104+
2. **Module Structure**
105+
- Each module exports clear public API
106+
- Use barrel exports (index.ts)
107+
- Separate concerns by feature
108+
109+
3. **Testing Strategy**
110+
- Tests in `./test` directories
111+
- Test both success and error scenarios
112+
- Mock external dependencies appropriately
113+
114+
4. **Type Safety**
115+
- Use branded types for domain identifiers
116+
- Discriminated unions for state management
117+
- Strict TypeScript configuration
118+
119+
5. **Naming Conventions**
120+
- snake_case for service names and API endpoints
121+
- camelCase for variables and functions
122+
- PascalCase for types and components

0 commit comments

Comments
 (0)