Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Ishaq74/concordia/llms.txt
Use this file to discover all available pages before exploring further.
System Architecture
Concordia is built as a server-side rendered (SSR) web application using modern web technologies. This document provides an overview of the system architecture, domain model, and core technical layers.High-Level Architecture
Concordia follows a layered architecture pattern with clear separation of concerns:SSR Architecture (Astro)
Concordia uses Astro 5.18.0 as its SSR framework, providing:- Server-Side Rendering: Pages are rendered on the server for optimal SEO and performance
- Static Site Generation: Static pages can be pre-rendered at build time
- API Routes: Server-side API endpoints for data mutations and complex operations
- File-based Routing: Intuitive page routing based on file structure
- Component Islands: Interactive client-side components embedded in SSR pages
Request Flow
Domain Model
The Concordia platform is organized around several core domains:Core Entities
Authentication & Usersuser- User accounts (Better Auth)profile- Public user profilesuser_role- Role assignments (citizen, owner, author, mediator, admin)organization- Organizational structuresmember- Organization membership
blog_posts- Blog articlesblog_translations- Multi-language contentblog_categories- Content categorizationblog_comments- User discussionsblog_media- Media assets
services_listings- Service offeringsservices_bookings- Reservationsservices_availability- Time slotsservices_reviews- User ratingsservices_categories- Service taxonomy
notification- User notificationsaudit_log- System audit trail
Entity Relationships
Database Layer
Drizzle ORM + PostgreSQL
Concordia uses Drizzle ORM 0.45.1 with PostgreSQL (viapg 8.18.0) for data persistence.
Key Features:
- Type-safe database queries
- Schema-first approach with TypeScript definitions
- Migration management
- Connection pooling
- Multi-environment support (local, test, production)
- Schemas defined in
/src/database/schemas/ - One schema file per domain entity
- Centralized exports via
schemas.ts - Migrations stored in
/src/database/migrations/
Authentication Layer
Concordia uses Better Auth 1.4.18 for authentication and authorization.Features
-
Multiple Authentication Methods:
- Email/password with verification
- OAuth providers (configurable)
- Magic link authentication
-
Session Management:
- Secure session tokens
- Session persistence
- Automatic session refresh
-
Role-Based Access Control (RBAC):
- Multiple roles per user
- Granular permissions
- Organization-level access control
-
Security Features:
- Rate limiting
- CSRF protection
- Password hashing (bcrypt)
- Email verification
Authentication Schema
Better Auth provides the following core tables:user- User accountssession- Active sessionsaccount- OAuth provider linksverification- Email verification tokensrate_limit- Rate limiting countersinvitation- Organization invitations
Authorization Model
Roles are managed via theuser_role table:
- Middleware for route protection
- Action-level authorization
- Row-level security policies (RLS)
Multi-Language Routing
Concordia supports 4 locales: French (fr), English (en), Arabic (ar), Spanish (es).URL Structure
Implementation
- Route Pattern:
/[lang]/...dynamic parameter - Locale Detection: Browser preferences, URL parameter, user profile
- Content Translation:
- UI translations:
/src/i18n/JSON files - Database translations:
*_translationstables
- UI translations:
- Locale Helper:
locale-url.tsfor URL generation
Translation Tables
Content with translations:blog_translations- Blog post contentservices_translations- Service descriptions- Future:
place_translation,article_content
Key Architectural Patterns
1. Server Actions
Server actions encapsulate business logic:2. Data Loaders
Loaders fetch data for page rendering:3. Component Modules
Components organized by domain:4. Type Safety
End-to-end type safety:- Database schema → TypeScript types (Drizzle)
- API contracts with typed responses
- Component props with TypeScript interfaces
Performance Optimizations
- Connection Pooling: Reused database connections (max: 5)
- Cached Drizzle Instance: Single database client per process
- SSR Caching: Static page generation where appropriate
- Image Optimization: Astro’s built-in image optimization
- Lazy Loading: Dynamic imports for large components
Security Architecture
- Input Validation: Server-side validation for all inputs
- SQL Injection Prevention: Parameterized queries via Drizzle ORM
- XSS Protection: Automatic escaping in Astro templates
- CSRF Protection: Built into Better Auth
- Rate Limiting: Request throttling per user/IP
- Audit Logging: All admin actions logged to
audit_log
Deployment Architecture
Concordia supports multiple deployment targets:- Node.js: Full SSR with
@astrojs/nodeadapter - Vercel: Optimized for Vercel platform with
@astrojs/vercel - Static: Pre-rendered static site for CDN deployment
Environment Configuration
Next Steps
- Tech Stack Details - Comprehensive technology breakdown
- Project Structure - File organization and conventions
- API Documentation - API endpoints and contracts