Pristine TS is a fast, lightweight, and modular Typescript framework for NodeJS, designed with a "serverless-first" philosophy.
Its primary mission is to provide a full-fledged enterprise-level framework with the lowest possible minimal footprint, specifically to solve the "cold start" problem in FaaS (Function as a Service) environments.
The framework is completely decoupled from any specific HTTP server. The core is a lightweight Event Pipeline: Map -> Intercept -> Handle -> Map Response.
- Kernel: The application entry point and DI container wrapper.
- Modules: Defined via
@Module(), structuring the application into feature sets. - Dependency Injection: Inverted DI pattern using
@injectable()and@moduleScoped(). - Event-Driven: Everything is an event. HTTP requests, SQS messages, and CLI commands are all normalized into
Eventobjects.
The monorepo contains several packages under packages/. Key packages include:
- Core:
@pristine-ts/core(Kernel, DI),@pristine-ts/common(Interfaces, Enums). - Networking:
@pristine-ts/networking(Controllers, Decorators),@pristine-ts/validation(Body Validation). - Configuration:
@pristine-ts/configuration(Config Management). - Security:
@pristine-ts/security(Guards, Authenticators). - Integrations:
@pristine-ts/aws,@pristine-ts/stripe,@pristine-ts/mysql, etc. - CLI:
@pristine-ts/cli(Command Line Interface).
- Language: TypeScript is mandatory.
- DI: All services must be
@injectable(). Use@moduleScoped()for isolation. - Contracts: Respect interfaces.
ConsoleManagerimplies a contract for CLI interaction. - No External Bloat: Avoid adding heavy dependencies. Use native Node.js APIs where possible to maintain the "lightweight" goal.
- Understand the Task: Analyze the request and the relevant code.
- Check Dependencies: Verify
package.jsonbefore using any library. - Implement: specific changes, adhering to the "serverless/minimal" philosophy.
- Verify: Run tests
npm run testand ensuring the build passes.
- Role: Handles all interactions with the standard output/input for CLI commands.
- Requirement: Must remain lightweight. Do not introduce heavy UI libraries like
inquirerororaunless absolutely necessary and approved. Implement features using native ANSI codes andreadline.
- Structure mirrors the framework's modularity.
getting-started/contains the primary learning path.
Note: This file is a living document for agents. Update it as you discover new patterns or requirements.