# generaltranslation/scira-multilingual architecture

> Architecture diagram of the GitHub repository generaltranslation/scira-multilingual, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/generaltranslation/scira-multilingual
- Repository: https://github.com/generaltranslation/scira-multilingual

## Overview

##### Project type and purpose
- Scira is a full-stack, server-rendered web application built with Next.js. Its purpose is to function as a minimalistic AI-powered search engine, combining model-based Q&A, web search grounding, and a variety of API-backed features (weather, maps, flight tracking, code execution, etc.).

##### File structure
- The top-level “app” directory contains Next.js App Router pages, layouts, global styles, and localized routes.
- The “app/api” directory defines serverless API routes (clean_images, proxy-image, raycast, search, upload) implemented with Next.js route handlers.
- The “components” folder houses React UI elements (atomic UI in components/ui, domain-specific widgets, logos).
- “hooks” and “lib” provide reusable logic and utilities.
- Configuration files (.env.example, Dockerfile, docker-compose.yml, next.config.mjs, postcss.config.mjs, tsconfig.json, vercel.json) indicate Docker-based and Vercel deployment, environment management, and build settings.
- No traditional database is present; data is fetched or computed on demand from external APIs.

##### Readme insights
- Confirms the use of Next.js, Tailwind CSS, Vercel AI SDK, Shadcn/UI.
- Details multiple AI and web APIs (Anthropic, xAI Grok, Llama 3, Groq, Tavily, Exa.AI, OpenWeather, Google Maps, Mapbox, TripAdvisor, AviationStack, E2B).
- Describes local development via Docker Compose or Node.js, and production deployment on Vercel.

- Client Layer (Web Browser)
- Edge/CDN Layer (Vercel’s CDN, static asset caching)
- Next.js Application
– Frontend (React pages, layouts, client-side hooks, UI components)
– Server/API Layer (Next.js Route Handlers under app/api, server-side providers.tsx)
- Environment & Configuration (ENV variables for API keys)
– AI Model Providers (Anthropic Claude, xAI Grok, Meta Llama, Groq Distill)
– Web Search/Knowledge (Tavily, Exa.AI)
– Feature APIs (OpenWeather, Google Maps, Mapbox, TripAdvisor, AviationStack, E2B code execution)
- Optional Infrastructure (Docker container for local dev)

- Browser → Vercel CDN → Next.js Frontend (HTTP GET for pages & static assets)
- Frontend → Server/API Layer (fetch requests to /api/* routes)
- Server/API Layer → External Services (outbound API calls using environment credentials)
- Server/API Layer → Frontend (streaming responses via Vercel AI SDK, JSON payloads)

c. Architectural patterns & design principles:
- Serverless Micro-endpoints: each API route is an isolated serverless function
- App Router with nested layouts and localized routes
- Component-driven UI with atomic and domain widgets
- Dependency injection of API keys via environment variables
- Multi-stage Docker build for production image; Vercel native deployment

d. Key technologies & frameworks:
- Next.js (App Router, serverless routes)
- React + Shadcn/UI + Tailwind CSS
- Vercel AI SDK for streaming LLM responses
- Docker & Docker Compose for containerized local development
- Multiple third-party REST/GraphQL APIs

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client and CDN Layers
    subgraph "Client Layer"
        Browser["Web Browser"]:::frontend
    end
    subgraph "Edge/CDN Layer"
        CDN["Vercel CDN"]:::infra
    end
    Browser --> CDN

    %% Next.js Application
    subgraph "Next.js Application"
        subgraph "Frontend (React/UI)"
            FE["Next.js Frontend"]:::frontend
            Pages["App Router Pages"]:::frontend
            click Pages "https://github.com/generaltranslation/scira-multilingual/tree/main/app/[locale]"
            Styles["Layouts & Global Styles"]:::frontend
            click Styles "https://github.com/generaltranslation/scira-multilingual/blob/main/app/[locale]/layout.tsx"
            click Styles "https://github.com/generaltranslation/scira-multilingual/blob/main/app/[locale]/globals.css"
            click Styles "https://github.com/generaltranslation/scira-multilingual/blob/main/app/[locale]/manifest.ts"
            click Styles "https://github.com/generaltranslation/scira-multilingual/blob/main/app/[locale]/providers.tsx"
            UIComponents["Atomic UI Components"]:::frontend
            click UIComponents "https://github.com/generaltranslation/scira-multilingual/tree/main/components/ui"
            DomainWidgets["Domain-Specific Widgets"]:::frontend
            click DomainWidgets "https://github.com/generaltranslation/scira-multilingual/blob/main/components/flight-tracker.tsx"
            FE --> Pages
            FE --> Styles
            FE --> UIComponents
            FE --> DomainWidgets
        end
        subgraph "API & Server (Serverless Functions)"
            API_Clean["/api/clean_images"]:::backend
            click API_Clean "https://github.com/generaltranslation/scira-multilingual/blob/main/app/api/clean_images/route.ts"
            API_Proxy["/api/proxy-image"]:::backend
            click API_Proxy "https://github.com/generaltranslation/scira-multilingual/blob/main/app/api/proxy-image/route.ts"
            API_Raycast["/api/raycast"]:::backend
            click API_Raycast "https://github.com/generaltranslation/scira-multilingual/blob/main/app/api/raycast/route.ts"
            API_Search["/api/search"]:::backend
            click API_Search "https://github.com/generaltranslation/scira-multilingual/blob/main/app/api/search/route.ts"
            API_Upload["/api/upload"]:::backend
            click API_Upload "https://github.com/generaltranslation/scira-multilingual/blob/main/app/api/upload/route.ts"
            FE --> API_Clean
            FE --> API_Proxy
            FE --> API_Raycast
            FE --> API_Search
            FE --> API_Upload
        end
    end

    %% Environment & Configuration
    subgraph "Environment & Config"
        EnvExample[".env.example"]:::config
        click EnvExample "https://github.com/generaltranslation/scira-multilingual/blob/main/.env.example"
        EnvClient["env/client.ts"]:::config
        click EnvClient "https://github.com/generaltranslation/scira-multilingual/blob/main/env/client.ts"
        EnvServer["env/server.ts"]:::config
        click EnvServer "https://github.com/generaltranslation/scira-multilingual/blob/main/env/server.ts"
        NextConfig["next.config.mjs"]:::config
        click NextConfig "https://github.com/generaltranslation/scira-multilingual/blob/main/next.config.mjs"
        TSConfig["tsconfig.json"]:::config
        click TSConfig "https://github.com/generaltranslation/scira-multilingual/blob/main/tsconfig.json"
        PostCSS["postcss.config.mjs"]:::config
        click PostCSS "https://github.com/generaltranslation/scira-multilingual/blob/main/postcss.config.mjs"
        VercelConfig["vercel.json"]:::config
        click VercelConfig "https://github.com/generaltranslation/scira-multilingual/blob/main/vercel.json"
    end
    API_Clean --> EnvServer
    API_Proxy --> EnvServer
    API_Raycast --> EnvServer
    API_Search --> EnvServer
    API_Upload --> EnvServer

    %% External Services
    subgraph "External Services"
        subgraph "AI Model Providers"
            AI_Anthropic["Anthropic Claude"]:::external
            AI_xAI["xAI Grok"]:::external
            AI_Llama["Meta Llama 3"]:::external
            AI_Groq["Groq Distill"]:::external
        end
        subgraph "Search & Knowledge"
            S_Tavily["Tavily"]:::external
            S_Exa["Exa.AI"]:::external
        end
        subgraph "Feature APIs"
            F_Weather["OpenWeather"]:::external
            F_Maps["Google Maps/Mapbox"]:::external
            F_Trip["TripAdvisor"]:::external
            F_Aviation["AviationStack"]:::external
            F_E2B["E2B Code Exec"]:::external
        end
    end
    API_Search --> AI_Anthropic
    API_Search --> AI_xAI
    API_Search --> AI_Llama
    API_Search --> AI_Groq
    API_Search --> S_Tavily
    API_Search --> S_Exa
    API_Clean --> F_E2B
    API_Raycast --> S_Exa
    API_Upload --> F_Maps
    API_Upload --> F_Trip
    API_Upload --> F_Aviation
    API_Proxy --> F_Weather

    %% Infrastructure for Local Development
    subgraph "Infrastructure"
        Docker["Docker & Compose"]:::infra
        click Docker "https://github.com/generaltranslation/scira-multilingual/blob/main/docker-compose.yml"
    end
    Docker --> FE
    Docker --> API_Clean

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#FFDAB9,stroke:#333,stroke-width:1px
    classDef config fill:#FFFACD,stroke:#333,stroke-width:1px
    classDef infra fill:#D3D3D3,stroke:#333,stroke-width:1px
```
