# FastAPIParser

**Kind:** Class

**Source:** [`atloria-monorepo/libs/parser-core/src/parsers/backend/fastapi.parser.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/parser-core/src/parsers/backend/fastapi.parser.ts#L39)

FastAPI Parser implementation

Uses regex-based parsing for Python files since we can't use Python AST directly in Node.js

**Implements:** `IParser`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `initialize` | `initialize(config: ParserConfig)` | `Promise<void>` |
| `canParse` | `canParse(filePath: string)` | `boolean` |
| `parseFile` | `parseFile(filePath: string, content: string)` | `Promise<ParseResult>` |
| `parseFiles` | `parseFiles(files: ParseFileInput[])` | `Promise<ParseResult[]>` |
| `destroy` | `destroy()` | `Promise<void>` |

## Properties

| Property | Type |
|---|---|
| `name` | `any` |
| `version` | `any` |
| `supportedPatterns` | `any` |

## Where it refuses work

- `FastAPIParser` stops the work with an early return when `!fileContent.trim()`.
- `FastAPIParser` stops the work with an early return when `!this.isFastAPIFile(fileContent, filePath)`.
- `FastAPIParser` stops the work with an early return when `content.includes('from fastapi') || content.includes('import fastapi') || content.include…`.
- `FastAPIParser` stops the work with an early return when `!m`.
- `FastAPIParser` stops the work with an early return when `!mounts.length && !reexports`.
- `FastAPIParser` stops the work with an early return when `segments.length === 0`.

## When something fails

- `FastAPIParser` handles failure in 1 place: it turns it into a return value in all 1.
