Skip to content

Architecture

Package Architecture

Functional Programming with Effect

This project adopts a functional programming approach with Effect, a TypeScript library for building robust and type-safe applications.

Why Effect?

  • Type-safe error handling: Errors are treated as values, not exceptions
  • Composability: Modular and reusable code via pipe and combinators
  • Built-in observability: Tracing and metrics compatible with OpenTelemetry
  • Resource management: Automatic acquisition and release (like try-with-resources)
  • Structured concurrency: Clean interruption and fiber management

ESLint Configuration

The project uses a strict ESLint configuration combining multiple plugins. See @univ-lehavre/atlas-shared-config for details.

TypeScript Strict

Based on tseslint.configs.strictTypeChecked with additional rules:

RuleDescription
strict-boolean-expressionsForbids implicit boolean coercions
no-floating-promisesRequires handling all promises
no-unnecessary-conditionDetects always true/false conditions
consistent-type-importsForces import type for type imports
switch-exhaustiveness-checkVerifies all cases are covered
no-explicit-anyForbids any (error, not warn)

Functional Programming

Based on eslint-plugin-functional:

RuleStatusDescription
no-expression-statementserrorForbids expressions without return
no-conditional-statementserrorForbids if/switch (forces ternaries/matching)
no-throw-statementserrorForbids throw (forces Effect)
no-try-statementserrorForbids try/catch (forces Effect)
immutable-dataerrorForbids mutation of objects/arrays
no-classesoffDisabled (Effect uses classes)

Security

Based on eslint-plugin-security:

RuleDescription
detect-unsafe-regexDetects regex vulnerable to ReDoS
detect-eval-with-expressionForbids eval() with expressions
detect-object-injectionWarns on dynamic access

Code Quality

RuleValueDescription
max-depth4Max nesting depth
max-lines-per-function60Max lines per function
complexity15Max cyclomatic complexity
no-consoleerrorForbids console.log (allow: warn, error)

Ignored Effect Patterns

Certain patterns are explicitly allowed for Effect and Hono:

javascript
// Effect patterns
Effect.runPromise(...)
pipe(value, Effect.map(...))
Layer.succeed(...)

// Hono patterns (route configuration)
app.get('/path', handler)
records.post('/', handler)

Test Files

Strict rules are disabled for *.test.ts and *.spec.ts files to allow classic test patterns.

Scripts

ready Script

The pnpm ci:checks script runs all checks before a release. The order is optimized according to the fail-fast principle: the fastest and most likely to fail checks are run first.

bash
pnpm ci:checks

Execution order:

  1. format:check - Format verification
  2. svelte:check - Svelte type checking
  3. lint - ESLint checks
  4. typecheck - TypeScript type checking
  5. test:coverage - Tests with coverage
  6. build - The longest, run last because if previous steps fail, no need to build

License Audit

The audit:licenses script verifies that all dependencies use allowed licenses:

bash
pnpm audit:licenses

Allowed licenses:

LicenseDescription
MITVery permissive license, most common in the npm ecosystem
Apache-2.0Permissive with patent protection
BSD-2-ClausePermissive, simplified version (2 clauses)
BSD-3-ClausePermissive, original version (3 clauses)
ISCEquivalent to MIT, simplified
0BSDPublic domain, no restrictions
UnlicenseExplicit public domain

Why these licenses?

All these licenses are permissive and allow:

  • Commercial use
  • Code modification
  • Distribution
  • Private use

They do not require sharing source code (unlike copyleft licenses like GPL), which is important for a project that may be used in various contexts.

MCP Servers

The project is configured to use Model Context Protocol (MCP) servers that provide documentation and tools to AI assistants.

Configuration

MCP servers are configured in .mcp.json:

json
{
  "mcpServers": {
    "effect-mcp": {
      "command": "pnpm",
      "args": ["dlx", "@niklaserik/effect-mcp"]
    },
    "svelte-mcp": {
      "command": "pnpm",
      "args": ["dlx", "@sveltejs/mcp"]
    },
    "appwrite-docs": {
      "command": "npx",
      "args": ["mcp-remote", "https://mcp-for-docs.appwrite.io"]
    },
    "appwrite-api": {
      "command": "uvx",
      "args": ["mcp-server-appwrite", "--all"],
      "env": {
        "APPWRITE_PROJECT_ID": "${APPWRITE_PROJECT_ID}",
        "APPWRITE_API_KEY": "${APPWRITE_API_KEY}",
        "APPWRITE_ENDPOINT": "${APPWRITE_ENDPOINT}"
      }
    },
    "openalex": {
      "command": "npx",
      "args": ["openalex-mcp"]
    }
  }
}

Available Servers

ServerDescription
effect-mcpEffect.js documentation
svelte-mcpSvelte 5 and SvelteKit documentation
appwrite-docsAppwrite documentation
appwrite-apiAppwrite API (requires env vars)
openalexOpenAlex API for academic research (240M+ articles)

Prerequisites

  • Node.js/npm: For effect-mcp, svelte-mcp, appwrite-docs, openalex
  • uv (Python): For appwrite-api (curl -LsSf https://astral.sh/uv/install.sh | sh)

Environment Variables for Appwrite

To use the appwrite-api server, configure:

bash
export APPWRITE_PROJECT_ID="your_project_id"
export APPWRITE_API_KEY="your_api_key"
export APPWRITE_ENDPOINT="https://appwrite.yourdomain.com/v1"

Third-party Platforms

Atlas relies on two third-party platforms for its features:

REDCap (Research Electronic Data Capture)

REDCap is a secure web application developed by Vanderbilt University for creating and managing online surveys and research databases.

FeatureValue
Partner institutions8,000+
Countries164
Scientific citations51,000+
ComplianceGDPR, HIPAA, 21 CFR Part 11
CostFree for Consortium members

REDCap enables web and mobile data collection (including offline). The CRF module provides TypeScript tools for interacting with the REDCap API.

Appwrite

Appwrite is an open-source backend platform providing essential services for application development:

ServiceDescription
AuthenticationLogin via email, OAuth, magic links
DatabaseData storage and querying
StorageFile management with encryption
FunctionsServerless code execution

Appwrite is compliant with SOC-2, GDPR and HIPAA standards. The ECRIN and AMARRE projects use Appwrite for authentication and user data management.