Effortless Code Documentation

Generate professional documentation from your JavaScript, TypeScript, Vue, and TSX files โ€” all from the CLI.

View Pricing
db.ts.md
[โฌ…๏ธ Back to Table of Contents](../../README.md)
# ๐Ÿ“„ `db.ts`
## ๐Ÿ“š Table of Contents
- [Imports](#-imports)
- [Functions](#-functions)
## ๐Ÿงพ Summary
- **Functions**: 1
- **Classes**: 0
- **Imports**: 4
- **Interfaces**: 0
- **Type Aliases**: 0
## ๐Ÿ“ฆ Imports
| Name | Source |
|------|--------|
| `drizzle` | `drizzle-orm/neon-http` |
| `neon` | `@neondatabase/serverless` |
| `neonConfig` | `@neondatabase/serverless` |
| `H3Event` | `h3` |
## ๐Ÿ”ง Functions
### `getDb(event: H3Event): any`
Code
```ts
export function getDb(event?: H3Event) {
if (!_db) {
// Get database URL from runtime config
const config = useRuntimeConfig();
if (!config.DATABASE_URL) {
throw new Error('DATABASE_URL is missing from environment variables');
}

// Create SQL connection
const sql = neon(config.DATABASE_URL);

// Create Drizzle instance
_db = drizzle(sql, { schema });
console.log('Database connection initialized');
}

return _db;
}
```
- **Parameters**:
ย ย - `event: H3Event`
- **Return Type**: `any`
- **Calls**: `useRuntimeConfig`, `neon (from @neondatabase/serverless)`, `drizzle (from drizzle-orm/neon-http)`, `console.log`

Beautiful Documentation Sites

Syntax Scribe generates professional MkDocs sites from your code

MkDocs documentation example

Powerful Features for Modern Developers

Effortlessly generate documentation and improve your workflow

Deep Code Analysis

Parses functions, interfaces, types, and comments across your codebase.

Documentation Site Generation

Generates a mkdocs site.

Clean Markdown Support

Docs are readable, collapsible, and ready for GitHub READMEs, internal wikis and mkdocs.

No Comments Needed

Documentation is generated from source code not comments in your code.

Vue & TSX Support

Handles single file components and JSX-style files with ease.

Simple CLI Interface

Generate comprehensive documentation with a single command. No complex configuration required.

Local & Private

All parsing happens locally โ€” your code stays on your machine.

Easy to Use

Simple CLI commands to get you started in no time.

Great for Teams

Perfect for open source projects, internal codebases, and design systems.

How Syntax Scribe Works

A seamless workflow that adapts to how you code

1

Install & Setup

Install via NPM.

2

Run Syntax Scribe

Point Syntax Scribe at your codebase and let it analyze your code base and document it.

3

Enjoy your Documentation

Enjoy the clean, readable documentation generated by Syntax Scribe.

Loved by Developers Worldwide

Hear what our users have to say about Syntax Scribe

I use Syntax Scribe to generate docs for client handoffs. It makes me look 10x more professional and helps my clients maintain code long after I'm gone.

S

Sarah Johnson

Freelance Web Developer

We use Syntax Scribe internally to document our TypeScript services. It's fast, accurate, and keeps our engineering standards high with minimal effort.

C

Carlos D.

CTO at DevStack.io

Syntax Scribe saved me hours of documentation work for our component library. The Markdown output is clean, organized, and ready to ship. Worth every penny!

J

Jordan M.

Senior Frontend Engineer

Ready to dive in?Start your free trial today.

Try Syntax Scribe free for 14 days. No credit card required.