# bun_elysia_postgresql **Repository Path**: SuperWindcloud/bun_elysia_postgresql ## Basic Information - **Project Name**: bun_elysia_postgresql - **Description**: Bun + Elysia + Postgres.js ζžΆζž„ζ¨‘η‰ˆ - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-02-27 - **Last Updated**: 2025-02-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🦊 Bun + Elysia + Postgres.js Clean Architecture Example A clean architecture implementation using [Bun](https://bun.sh/), [Elysia](https://elysiajs.com/), and [Postgres.js](https://github.com/porsager/postgres) for building a robust and scalable API. ## 🌟 Overview This project demonstrates a clean architecture approach to building a web API using modern JavaScript technologies. It leverages [Bun](https://bun.sh/) as the runtime environment, [Elysia](https://elysiajs.com/) as the web framework, and [Postgres.js](https://github.com/porsager/postgres) for database interactions. The application follows clean architecture principles, ensuring a clear separation of concerns and maintainability. Key highlights: - Extremely fast startup times and test execution - Integrated debugging capabilities - Comprehensive Swagger documentation with strong typing - Scalable architecture achieved through careful structuring and Elysia's plugin system While Elysia doesn't provide a scalable structure out of the box, this boilerplate shows how to achieve clean architecture with some additional effort, making it an excellent starting point for serious application development. ## πŸ— Project Structure The project follows a clean architecture pattern with the following structure: ``` src/ β”œβ”€β”€ auth/ β”‚ β”œβ”€β”€ application/ β”‚ β”œβ”€β”€ domain/ β”‚ └── infrastructure/ β”œβ”€β”€ notes/ β”‚ β”œβ”€β”€ application/ β”‚ β”œβ”€β”€ domain/ β”‚ └── infrastructure/ β”œβ”€β”€ shared/ β”‚ └── infrastructure/ └── users/ β”œβ”€β”€ domain/ └── infrastructure/ ``` - `auth/`: Authentication-related modules - `notes/`: Note management modules - `users/`: User management modules - `shared/`: Shared utilities and configurations Each module is divided into: - `application/`: Use cases and business logic - `domain/`: Domain entities and types - `infrastructure/`: External interfaces (controllers, repositories) ## πŸ›  Setup `bun run start ` ## ✨ Features ### 🌐 Elysia Web Framework The project uses Elysia, a modern and performant web framework for Bun. It provides a clean and intuitive API for building web applications. ### πŸ—„οΈ Postgres.js [Fastest full-featured node & deno client](https://github.com/porsager/postgres-benchmarks#results), Postgres.js is used for database operations, offering a simple and efficient way to interact with PostgreSQL databases. ### πŸ› Clean Architecture The project follows clean architecture principles, separating concerns into distinct layers: Application, Domain, and Infrastructure. ### 🧹 ESLint + Prettier Code quality and consistency are maintained using ESLint and Prettier with a standardized configuration. ### πŸ“ Import Sorting Imports are automatically organized using the `eslint-plugin-simple-import-sort` plugin. ### πŸ” Environment Management Environment variables are managed securely using a combination of `.env` files and the `zod` library for validation. ### πŸ—ƒ Database Migration A simple database migration system is implemented using raw SQL scripts. ### πŸ“š Swagger Documentation API documentation is automatically generated using Swagger, making it easy for developers to understand and interact with the API. ## πŸ§ͺ Testing The project includes integration (E2E) tests to ensure the correct functionality of the API endpoints. Run the tests using: ``` bun test ```