|
| 1 | +# Grünerator - Project Context |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +**Grünerator** is an AI-powered content creation platform built specifically for the German Green Party (Die Grünen). It enables users to generate political content (press releases, social media posts), create sharepics, and subtitle videos with domain-specific AI knowledge. |
| 6 | + |
| 7 | +This is a **monorepo** managed with **pnpm workspaces**, containing a full-stack application with web, mobile, and desktop clients. |
| 8 | + |
| 9 | +### Key Technologies |
| 10 | + |
| 11 | +* **Frontend:** React 19, Vite 7, Zustand (state management). |
| 12 | +* **Styling:** **Standard CSS with CSS Variables**. No frameworks like Tailwind or Bootstrap are used. |
| 13 | +* **Backend:** Node.js, Express.js (Cluster mode), PostgreSQL, Redis, Keycloak (Auth), Qdrant (Vector DB). |
| 14 | +* **AI:** Mistral AI (primary), Anthropic Claude (via Bedrock), Flux (Images), AssemblyAI (Transcription). |
| 15 | +* **Mobile:** React Native (Expo). |
| 16 | +* **Desktop:** Tauri (Rust + Web Frontend). |
| 17 | +* **Package Manager:** pnpm. |
| 18 | + |
| 19 | +## Architecture |
| 20 | + |
| 21 | +The system follows a multi-tier architecture designed for data sovereignty (EU hosting) and scalability. |
| 22 | + |
| 23 | +* **API (`apps/api`):** The core backend. |
| 24 | + * **Cluster Mode:** Uses Node.js `cluster` module for vertical scaling. |
| 25 | + * **AI Worker Pool:** Dedicated worker threads for non-blocking AI operations. |
| 26 | + * **Services:** Decoupled services for Auth, Database, Profiles, and specific AI tasks (Subtitler, Sharepic). |
| 27 | + * **Data Stores:** PostgreSQL (User/Content data), Redis (Sessions/Cache), Qdrant (Vector Embeddings). |
| 28 | +* **Web Client (`apps/web`):** The primary user interface. |
| 29 | + * **Feature-Sliced Design:** Modular architecture. |
| 30 | + * **Real-time:** Y.js for collaborative editing. |
| 31 | +* **Mobile App (`apps/mobile`):** Expo-based React Native app for iOS and Android. |
| 32 | +* **Desktop App (`apps/desktop`):** Tauri wrapper around the web frontend for offline/native capabilities. |
| 33 | + |
| 34 | +## Directory Structure |
| 35 | + |
| 36 | +* `apps/` |
| 37 | + * `api/`: Backend Express server. |
| 38 | + * `web/`: Main React frontend. |
| 39 | + * `mobile/`: React Native (Expo) mobile app. |
| 40 | + * `desktop/`: Tauri desktop app. |
| 41 | + * `sites/`: Static sites/landing pages. |
| 42 | +* `packages/`: Shared libraries (e.g., `@gruenerator/shared`). |
| 43 | +* `services/`: Microservices, specifically `mcp` (Model Context Protocol). |
| 44 | +* `docs/`: Documentation. |
| 45 | + |
| 46 | +## Building and Running |
| 47 | + |
| 48 | +The project uses `pnpm` for script management. Run these commands from the **root directory**. |
| 49 | + |
| 50 | +### Installation |
| 51 | +```bash |
| 52 | +pnpm install |
| 53 | +``` |
| 54 | + |
| 55 | +### Development |
| 56 | +* **Web + Backend:** |
| 57 | + ```bash |
| 58 | + pnpm dev:web # Starts frontend at localhost:5173 |
| 59 | + pnpm dev:backend # Starts backend at localhost:3000 (requires DBs running) |
| 60 | + ``` |
| 61 | +* **Mobile:** |
| 62 | + ```bash |
| 63 | + pnpm dev:mobile # Starts Expo bundler |
| 64 | + ``` |
| 65 | +* **Desktop:** |
| 66 | + ```bash |
| 67 | + pnpm --filter @gruenerator/desktop dev # Starts Tauri dev environment |
| 68 | + ``` |
| 69 | + |
| 70 | +### Production Build |
| 71 | +* **Web:** `pnpm build:web` |
| 72 | +* **Desktop:** `pnpm build:desktop` |
| 73 | +* **Shared:** `pnpm build:shared` |
| 74 | + |
| 75 | +### Testing |
| 76 | +* **Root:** `npm test` (Runs tests across packages) |
| 77 | +* **Backend Auth:** `pnpm --filter @gruenerator/api test:auth` |
| 78 | + |
| 79 | +## Development Conventions |
| 80 | + |
| 81 | +* **Language:** TypeScript is used across the entire stack. |
| 82 | +* **Styling:** |
| 83 | + * **NO Tailwind.** Use standard CSS files. |
| 84 | + * **Variables:** Use CSS variables defined in `apps/web/src/assets/styles/common/variables.css` for colors (`--primary-600`, `--secondary-600`), spacing, and theming. |
| 85 | + * **Structure:** |
| 86 | + * Global: `apps/web/src/assets/styles/common/` |
| 87 | + * Components: `apps/web/src/assets/styles/components/` |
| 88 | + * Features: `apps/web/src/features/**/*.css` |
| 89 | + * **Dark Mode:** Handled via `[data-theme="dark"]` and `@media (prefers-color-scheme: dark)` in `variables.css`. |
| 90 | +* **Commits:** Follows Semantic Release/Conventional Commits (e.g., `feat:`, `fix:`, `chore:`). |
| 91 | +* **Branching:** Create feature branches (`feature/name`) and PR to `main`. |
| 92 | +* **State Management:** `zustand` is preferred for global state in frontend apps. |
| 93 | +* **API Communication:** The backend exposes a REST API. Frontend uses `axios` or `tanstack-query` (implied from React context) for data fetching. |
| 94 | + |
| 95 | +## Environment Setup |
| 96 | + |
| 97 | +Ensure the following services are running locally or accessible: |
| 98 | +1. **PostgreSQL** (Port 5432) |
| 99 | +2. **Redis** (Port 6379) |
| 100 | +3. **Keycloak** (Auth Provider) |
| 101 | +4. **Qdrant** (Vector DB) |
| 102 | + |
| 103 | +Copy `.env.example` to `.env` in `apps/api` and `apps/web` and configure secrets (API keys, DB credentials). |
0 commit comments