$ show FoalTS/foal
FoalTS is a full-featured Node.js/TypeScript web framework structured as a monorepo with modular packages (core, CLI, JWT, TypeORM, GraphQL, storage, social auth, etc.). The framework provides declarative routing via decorators, a hook system for middleware/validation/authorization, dependency injection, and built-in support for OpenAPI, GraphQL, WebSockets, and file storage. Under the hood it uses Express, AJV, and TypeORM, with session stores for Redis, MongoDB, and SQL databases. The CLI generates projects, controllers, entities, and REST APIs, and includes upgrade commands across major versions. The codebase demonstrates solid engineering: thorough unit/e2e tests (over 2100 tests), documentation-as-tests, and a consistent pattern of abstract services (Store, Disk, Logger) resolved via configuration. Key reusable patterns include the hook/decorator system for validation and authentication, the abstract OAuth2 provider base class, and the CLI generator template engine. However, some deprecations (e.g., hashPasswordβPasswordService) and outdated Docker images in development config indicate moderate technical drift. The project is actively maintained with frequent releases, daily CI on Node 22/24, and a well-documented upgrade path.
The LLM identified 5 files worth highlighting for reuse:
Implements a reusable OAuth2 provider pattern with PKCE support, state validation, and token exchange. Concrete providers (Google, Facebook, GitHub, LinkedIn, Twitter) extend this class, overriding endpoints and scopes. Can be extracted for any OAuth2 integration.
A hook that parses multipart file uploads and validates them against a schema (max file size, number, allowed types). Uses busboy internally and integrates with the Disk service. Demonstrates a clean pattern for file upload handling with validation.
Generic CLI code generator that renders templates (Handlebars-like), copies fixtures, and modifies dependency manifests. Used by all scaffold commands (entity, controller, REST API). The pattern of template-driven file generation with testable assertions is reusable for any CLI tool.
Provides a logger with configurable formats (raw, dev, json, none), log levels, and context via AsyncLocalStorage. Supports error context and custom transports. The abstraction of logger configuration and context propagation is decoupled enough to reuse.
Concrete implementation of the framework's abstract SessionStore using TypeORM. Handles session CRUD, expiry cleanup, and user session queries. The pattern of an abstract store with TypeORM persistence is reusable for similar session caching needs.