---
name: bun-typescript-backend-architecture-bb33eefa2004
description: "An MCP server that provides on-demand skill loading for AI coding assistants."
---

# Bun + TypeScript Backend Architecture

## Bun Project Structure

```
my-bun-app/
├── src/
│   ├── routes/        # API routes
│   ├── services/      # Business logic
│   ├── middleware/    # Express-style middleware
│   ├── db/           # Database clients
│   └── index.ts      # Entry point
├── tests/
├── package.json
└── tsconfig.json
```

## TypeScript Config

```json
{
  "compilerOptions": {
    "strict": true,
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "skipLibCheck": true,
    "esModuleInterop": true
  }
}
```

## Bun HTTP Server

```typescript
// src/index.ts
const server = Bun.serve({
  port: 3000,
  fetch(req) {
    const url = new URL(req.url)
    
    if (url.pathname === '/users' && req.method === 'GET') {
      return Response.json({ users: [] })
    }
    
    return new Response('Not Found', { status: 404 })
  },
})

console.log(`Server running on port ${server.port}`)
```

## Database with Bun

```typescript
// Using Bun's built-in SQL client
const db = new Database('sqlite.db')

const users = db.query('SELECT * FROM users WHERE id = ?').get(userId)
```

## Checklist

- [ ] Install Bun
- [ ] Set up TypeScript
- [ ] Configure strict mode
- [ ] Set up routing
- [ ] Add database client
- [ ] Configure build output
- [ ] Set up testing


---
Source attribution: modbender
Original project: https://github.com/modbender/skill-library-mcp/blob/d9c8fe903b5b4e82237dbe8d0df8567783022e18/data/fswe/references/bun-typescript/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2025 skill-library-mcp contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: modbender
Original project: https://github.com/modbender/skill-library-mcp/blob/d9c8fe903b5b4e82237dbe8d0df8567783022e18/data/fswe/references/bun-typescript/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering
Roles: Backend Developer, DevOps / SRE, Full-Stack Developer
Specialties: Backend
Tools: Bun, SQLite
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 862fe8d7be11702c5591e839b3c7acfc1426c80f1e25a9d937daf7b989304f60
