# Welcome to Core Foundation

Core Foundation is an enterprise-grade foundational package for building modular monolith APIs on **Laravel 11+** and **PHP 8.3+**.

It enforces a scalable architecture through abstract base classes, traits, conventions, and developer tooling. Whether you are building a simple API or a complex modular system, Core Foundation handles the heavy lifting of infrastructure, letting you focus exclusively on business logic.

## Technical Depth

Core Foundation isn't just a collection of helpers; it's a structural framework that solves common enterprise problems:

* 🏗️ **Modular Isolation**: True modular monolith support where modules can extend core models and resources without touching the source code.
* 🏬 **Smart Repositories**: A feature-complete repository pattern with operator-based filtering, request-driven sorting, and intelligent tag-based caching.
* 🚨 **3-Layer Exception System**: Consistent JSON error responses, automatic UUID generation for fatal errors, and domain-specific self-rendering exceptions.
* ⛓️ **Interception Pipelines**: Magenta-style method interception for services, allowing modules to hook into execution flows cleanly.
* ⏱️ **Integrated Observability**: Real-time performance monitoring via W3C Server-Timing headers and built-in static analysis for code complexity.
* 🧪 **Testing First**: A comprehensive testing suite with envelope-aware assertions and Octane-safe state management.

## Core Principles

1. **Deny by Default**: Security-first approach in policies and whitelisting in repositories.
2. **Consistency First**: Strict conventions for response envelopes, naming, and directory structures.
3. **Octane-Safe**: Every component is designed to run in long-lived processes without state leakage.
4. **Developer Experience**: Interactive scaffolding commands and automated API documentation as code.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://core-foundation-doc.rupeshstha.com.np/welcome-to-core-foundation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
