# Makuro Base Template ๐Ÿš€ [![Bun](https://img.shields.io/badge/Bun-%23000000.svg?style=for-the-badge&logo=bun&logoColor=white)](https://bun.sh/) [![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB)](https://react.dev/) [![Mantine](https://img.shields.io/badge/Mantine-blue?style=for-the-badge&logo=mantine&logoColor=white)](https://mantine.dev/) [![Biome](https://img.shields.io/badge/Biome-60a5fa?style=for-the-badge&logo=biome&logoColor=white)](https://biomejs.dev/) **Makuro Base Template** is a high-performance, full-stack React development template leveraging the **Bun** runtime. It offers a unique "Single Port" architecture, combining a Bun/Elysia backend with a React frontend for an incredibly smooth developer experience. ## โœจ Key Features - **โšก Single Port Architecture**: Backend (Elysia) and Frontend (Vite Middleware) run on the same port (3000). No CORS issues, no proxy complexity. - **๐Ÿ“œ Contract-First API**: Strictly typed API using OpenAPI. Frontend types are automatically synced from backend schemas. - **โš›๏ธ React 19 + TanStack Router**: The latest React features with type-safe, file-based routing. - **๐ŸŽจ Mantine UI**: A comprehensive library of 100+ components and hooks, pre-configured with a modern dark theme. - **๐Ÿ“ฑ PWA & TWA Support**: Ready for mobile with Service Workers, Web Manifest, and Android Trusted Web Activity verification. - **๐Ÿ” React Dev Inspector**: `Alt/Option + Click` any element in your browser to jump directly to its source code in VS Code. - **๐Ÿงช Modern Testing**: Fast unit/integration tests with Bun's native runner and E2E testing with Playwright. ## ๐Ÿ›  Tech Stack | Layer | Technology | | :--- | :--- | | **Runtime** | [Bun](https://bun.sh/) (Fast all-in-one JS runtime) | | **Backend** | [ElysiaJS](https://elysiajs.com/) (Fast, type-safe web framework) | | **Frontend** | [React 19](https://react.dev/) (UI Library) | | **Routing** | [TanStack React Router](https://tanstack.com/router/latest) (Type-safe routing) | | **UI Framework** | [Mantine UI](https://mantine.dev/) (Component library) | | **Auth** | [Better Auth](https://www.better-auth.com/) (Complete auth solution) | | **Database** | [Prisma ORM](https://www.prisma.io/) (Database toolkit) | | **Testing** | [Bun Test](https://bun.sh/docs/cli/test) & [Playwright](https://playwright.dev/) | ## ๐Ÿ“ Project Structure ```text โ”œโ”€โ”€ __tests__/ # Consolidated test suite (API & E2E) โ”œโ”€โ”€ generated/ # Auto-generated API types and Prisma client โ”œโ”€โ”€ prisma/ # Database schema and migrations โ”œโ”€โ”€ scripts/ # Internal automation scripts โ””โ”€โ”€ src/ โ”œโ”€โ”€ api/ # Elysia backend route modules โ”œโ”€โ”€ middleware/ # Backend & Frontend middlewares โ”œโ”€โ”€ routes/ # TanStack file-based frontend routes โ”œโ”€โ”€ store/ # Global state (Valtio) โ”œโ”€โ”€ utils/ # Shared utilities (DB, Env, API Client) โ”œโ”€โ”€ frontend.tsx # React client entry point โ””โ”€โ”€ index.ts # Unified server entry point ``` ## ๐Ÿš€ Getting Started ### 1. Prerequisites Install [Bun](https://bun.sh/) if you haven't already. ### 2. Installation ```bash bun install ``` ### 3. Setup Environment ```bash cp .env.example .env # Fill in your DATABASE_URL and BETTER_AUTH_SECRET ``` ### 4. Database Initialization ```bash bun x prisma migrate dev ``` ### 5. Start Development ```bash bun run dev ``` - **App**: `http://localhost:3000` - **API Docs**: `http://localhost:3000/api/docs` (Swagger) ## ๐Ÿงช Testing Commands - **Unit/Integration (API)**: `bun run test` - **End-to-End (Browser)**: `bun run test:e2e` - **Visual Dashboard**: `bun run test:ui` ## ๐Ÿ“ Development Guidelines - **API Workflow**: 1. Define schema in `src/api/*.ts`. 2. Run `bun run gen:api` (or just start `dev` mode). 3. Use `apiClient` in the frontend with full type safety. - **Styling**: Prefer Mantine components and Style Props. - **Code Quality**: Code is automatically formatted on save if you have the Biome extension. Manual: `bun run check`. --- Created with โค๏ธ by [Malik Kurosaki](https://github.com/malikkurosaki)