···11+# Grain Social Monorepo
22+33+A photo-sharing social platform built on the [AT Protocol](https://atproto.com)
44+ecosystem, enabling users to create and share photo galleries in a decentralized
55+manner.
66+77+## Overview
88+99+Grain Social is a photo-sharing platform that leverages the AT Protocol for
1010+decentralized identity and data persistence. The platform allows users to upload
1111+photos, organize them into galleries, and share them with the AT Proto
1212+community.
1313+1414+## Architecture
1515+1616+This monorepo contains multiple services that work together to provide the
1717+complete Grain Social experience:
1818+1919+### 📱 [AppView](/appview)
2020+2121+The main frontend application built with Deno, TypeScript, and HTMX. Provides
2222+the user interface for photo management, gallery creation, and social
2323+interactions.
2424+2525+- **Tech Stack**: Deno, TypeScript, HTMX, Tailwind CSS, Preact
2626+- **Features**: Photo uploads, gallery management, social features, custom
2727+ layouts
2828+2929+### 🖼️ [Darkroom](/darkroom)
3030+3131+A Rust-based service for generating composite images and gallery previews.
3232+Handles image processing and screenshot generation for gallery sharing.
3333+3434+- **Tech Stack**: Rust, Axum, Tokio, Fantoccini
3535+- **Features**: Composite image generation, HTML previews, screenshot capture
3636+3737+### 🔔 [Notifications](/notifications)
3838+3939+Notification service for handling real-time updates and user notifications
4040+within the Grain Social ecosystem.
4141+4242+- **Tech Stack**: Deno, TypeScript
4343+- **Features**: Real-time notifications, event processing
4444+4545+### 🏷️ [Labeler](/labeler)
4646+4747+Content labeling and moderation service implementing AT Protocol's labeling
4848+standards for content moderation.
4949+5050+- **Tech Stack**: Deno, TypeScript
5151+- **Features**: Content labeling, moderation tools
5252+5353+### 🌐 [Infrastructure](/nginx)
5454+5555+Nginx reverse proxy configuration for routing requests between services.
5656+5757+### 🗂️ [Local Infrastructure](/local-infra)
5858+5959+Docker Compose setup for local development including PDS, PLC directory, and
6060+Jetstream services.
6161+6262+### 📝 [Lexicons](/lexicons)
6363+6464+AT Protocol lexicon definitions that define the data schemas and API contracts
6565+used across the platform.
6666+6767+## Quick Start
6868+6969+### Prerequisites
7070+7171+- [Deno](https://deno.land/) 2.2.6+
7272+- [Rust](https://rustup.rs/) 1.88+ (for Darkroom service)
7373+- [Docker](https://docker.com/) (for local infrastructure)
7474+- AT Protocol account ([Bluesky](https://bsky.app))
7575+7676+### Local Development
7777+7878+> **Note**: Local development documentation is work in progress and may be out
7979+> of date. Please file an issue if you encounter problems.
8080+8181+1. **Clone the repository**
8282+ ```bash
8383+ git clone https://github.com/grainsocial/grain.git
8484+ cd grain
8585+ ```
8686+8787+2. **Set up local infrastructure** (optional)
8888+ ```bash
8989+ # Add to /etc/hosts
9090+ echo "127.0.0.1 pds.dev.grain.social" | sudo tee -a /etc/hosts
9191+ echo "127.0.0.1 plc.dev.grain.social" | sudo tee -a /etc/hosts
9292+ echo "127.0.0.1 jetstream.dev.grain.social" | sudo tee -a /etc/hosts
9393+9494+ # Start services
9595+ cd local-infra
9696+ docker compose up -d
9797+ ```
9898+9999+3. **Start the AppView**
100100+ ```bash
101101+ cd appview
102102+ cp .env.example .env # Configure your environment
103103+ deno task sync # Backfill network data
104104+ deno task dev # Start development server
105105+ ```
106106+107107+4. **Start additional services** (in separate terminals)
108108+ ```bash
109109+ # Darkroom service
110110+ cd darkroom
111111+ set -a; source .env; set +a; cargo run
112112+113113+ # Notifications service
114114+ cd notifications
115115+ deno run -A main.ts
116116+ ```
117117+118118+### Environment Configuration
119119+120120+Each service requires specific environment variables. Check the individual
121121+service .env.example files for detailed configuration:
122122+123123+- [AppView](/appview/.env.example)
124124+- [Darkroom](/darkroom/.env.example)
125125+- [Labeler](/labeler/.env.example)
126126+- [Notifications](/notifications/.env.example)
127127+128128+## Key Features
129129+130130+- **🖼️ Photo Management**: Upload, organize, and add metadata to photos
131131+- **📚 Gallery Creation**: Create themed collections
132132+- **👥 Social Features**: Follow users, favorite galleries, comment and interact
133133+- **🎨 Custom Layouts**: Masonry and justified grid layout options
134134+- **🔍 Discovery**: Explore galleries and users across the network
135135+- **📱 Responsive Design**: Works across desktop and mobile devices
136136+- **🌐 Decentralized**: Built on AT Protocol for user data ownership
137137+138138+## Development Workflow
139139+140140+1. **Code Generation**: Lexicon changes require running codegen in relevant
141141+ services
142142+2. **Database Sync**: Use `deno task sync` to backfill AT Protocol data
143143+3. **Deployment**: Services are containerized and ready for deployment
144144+145145+## Contributing
146146+147147+1. Fork the repository
148148+2. Create a feature branch
149149+3. Make your changes following the existing code conventions
150150+4. Test your changes across relevant services
151151+5. Submit a pull request
152152+153153+## License
154154+155155+MIT License - see [LICENSE](LICENSE) for details.
156156+157157+## Credits
158158+159159+Developed by Chad Miller